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; 20const hilog = requireNapi('hilog'); 21const measure = requireNapi('measure'); 22 23export var IconType; 24(function (c12) { 25 c12[c12['BADGE'] = 1] = 'BADGE'; 26 c12[c12['NORMAL_ICON'] = 2] = 'NORMAL_ICON'; 27 c12[c12['SYSTEM_ICON'] = 3] = 'SYSTEM_ICON'; 28 c12[c12['HEAD_SCULPTURE'] = 4] = 'HEAD_SCULPTURE'; 29 c12[c12['APP_ICON'] = 5] = 'APP_ICON'; 30 c12[c12['PREVIEW'] = 6] = 'PREVIEW'; 31 c12[c12['LONGITUDINAL'] = 7] = 'LONGITUDINAL'; 32 c12[c12['VERTICAL'] = 8] = 'VERTICAL'; 33})(IconType || (IconType = {})); 34var FontSizeScaleLevel; 35(function (b12) { 36 b12[b12['LEVEL1'] = 1.75] = 'LEVEL1'; 37 b12[b12['LEVEL2'] = 2] = 'LEVEL2'; 38 b12[b12['LEVEL3'] = 3.2] = 'LEVEL3'; 39})(FontSizeScaleLevel || (FontSizeScaleLevel = {})); 40var ItemHeight; 41(function (a12) { 42 a12[a12['FIRST_HEIGHT'] = 48] = 'FIRST_HEIGHT'; 43 a12[a12['SECOND_HEIGHT'] = 56] = 'SECOND_HEIGHT'; 44 a12[a12['THIRD_HEIGHT'] = 64] = 'THIRD_HEIGHT'; 45 a12[a12['FOURTH_HEIGHT'] = 72] = 'FOURTH_HEIGHT'; 46 a12[a12['FIFTH_HEIGHT'] = 96] = 'FIFTH_HEIGHT'; 47})(ItemHeight || (ItemHeight = {})); 48const TEXT_MAX_LINE = 1; 49const ITEM_BORDER_SHOWN = 2; 50const TEXT_COLUMN_SPACE = 4; 51const TEXT_SAFE_MARGIN = 8; 52const LISTITEM_PADDING = 6; 53const SWITCH_PADDING = 4; 54const STACK_PADDING = 4; 55const BADGE_SIZE = 8; 56const SMALL_ICON_SIZE = 16; 57const SYSTEM_ICON_SIZE = 24; 58const TEXT_ARROW_HEIGHT = 32; 59const SAFE_LIST_PADDING = 32; 60const HEADSCULPTURE_SIZE = 40; 61const BUTTON_SIZE = 28; 62const APP_ICON_SIZE = 64; 63const PREVIEW_SIZE = 96; 64const LONGITUDINAL_SIZE = 96; 65const VERTICAL_SIZE = 96; 66const NORMAL_ITEM_ROW_SPACE = 16; 67const SPECIAL_ITEM_ROW_SPACE = 0; 68const SPECIAL_ICON_SIZE = 0; 69const DEFAULT_ROW_SPACE = 0; 70const SPECICAL_ROW_SPACE = 4; 71const OPERATEITEM_ICONLIKE_SIZE = 24; 72const OPERATEITEM_SELECTIONBOX_PADDING_SIZE = 2; 73const OPERATEITEM_ARROW_WIDTH = 12; 74const OPERATEITEM_ICON_CLICKABLE_SIZE = 40; 75const OPERATEITEM_IMAGE_SIZE = 48; 76const RIGHT_CONTENT_NULL_RIGHTWIDTH = '0vp'; 77const LEFT_PART_WIDTH = 'calc(66% - 16vp)'; 78const RIGHT_PART_WIDTH = '34%'; 79const RIGHT_ONLY_ARROW_WIDTH = '24vp'; 80const RIGHT_ONLY_IMAGE_WIDTH = '54vp'; 81const RIGHT_ONLY_ICON_WIDTH = '40vp'; 82const RIGHT_ICON_SUB_ICON_WIDTH = '80vp'; 83const RIGHT_ONLY_RADIO_WIDTH = '30vp'; 84const RIGHT_ONLY_CHECKBOX_WIDTH = '30vp'; 85const RIGHT_ONLY_SWITCH_WIDTH = '44vp'; 86const ACCESSIBILITY_LEVEL_AUTO = 'auto'; 87const ACCESSIBILITY_LEVEL_YES = 'yes'; 88const ACCESSIBILITY_LEVEL_NO = 'no'; 89const RESOURCE_TYPE_SYMBOL = 40000; 90const ICON_SIZE_MAP = new Map([ 91 [IconType.BADGE, BADGE_SIZE], 92 [IconType.NORMAL_ICON, SMALL_ICON_SIZE], 93 [IconType.SYSTEM_ICON, SYSTEM_ICON_SIZE], 94 [IconType.HEAD_SCULPTURE, HEADSCULPTURE_SIZE], 95 [IconType.APP_ICON, APP_ICON_SIZE], 96 [IconType.PREVIEW, PREVIEW_SIZE], 97 [IconType.LONGITUDINAL, LONGITUDINAL_SIZE], 98 [IconType.VERTICAL, VERTICAL_SIZE] 99]); 100const IS_SUPPORT_SUBCOMPONENT_EVENT = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_focus_dynamic_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value !== 1; 101const RECOVER_ITEM_SCALE = 1; 102const CLEAR_SHADOW = -1; 103const OPERATE_ITEM_RADIUS = 50; 104const OPERATE_ITEM_BACKGROUND_COLOR = '#33000000'; 105const DEFUALT_RADIO_CHECKBOX_BORDER_COLOR = { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_switch_outline_off'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 106const OPERATE_ITEM_COLOR = '#99000000'; 107const TEXT_SUPPORT_MARQUEE = 1; 108const IS_MARQUEE_OR_ELLIPSIS = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_right_textOverflow'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value; 109const UNUSUAL = -1; 110const FOCUSED_BG_COLOR = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_container_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 111const NORMAL_BG_COLOR = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_container_normal_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 112const FOCUSED_ITEM_SCALE = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_focus_magnification'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value; 113const FOCUSED_SHADOW = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_focus_shadow_attribute'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }) 114 .value; 115const NORMAL_SHADOW = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_normal_shadow_attribute'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }) 116 .value; 117const ITEM_PADDING = { 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_padding'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 118const OPERATEITEM_ARROW_MARGIN_WIDTH = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_arrow_margin'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value; 119const APPICON_ITEMLENGTH = LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_AppIcon_ItemLength'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value; 120class Util { 121 static isSymbolResource(y11) { 122 if (!Util.isResourceType(y11)) { 123 return false; 124 } 125 let z11 = y11; 126 return z11.type === RESOURCE_TYPE_SYMBOL; 127 } 128 static isResourceType(x11) { 129 if (!x11) { 130 return false; 131 } 132 if (typeof x11 === 'string' || typeof x11 === 'undefined') { 133 return false; 134 } 135 return true; 136 } 137} 138class ContentItemStruct extends ViewPU { 139 constructor(r11, s11, t11, u11 = -1, v11 = undefined, w11) { 140 super(r11, t11, u11, w11); 141 if (typeof v11 === 'function') { 142 this.paramsGenerator_ = v11; 143 } 144 this.__iconStyle = new SynchedPropertySimpleOneWayPU(s11.iconStyle, this, 'iconStyle'); 145 this.__icon = new SynchedPropertyObjectOneWayPU(s11.icon, this, 'icon'); 146 this.__symbolStyle = new SynchedPropertyObjectOneWayPU(s11.symbolStyle, this, 'symbolStyle'); 147 this.__primaryText = new SynchedPropertyObjectOneWayPU(s11.primaryText, this, 'primaryText'); 148 this.__secondaryText = new SynchedPropertyObjectOneWayPU(s11.secondaryText, this, 'secondaryText'); 149 this.__description = new SynchedPropertyObjectOneWayPU(s11.description, this, 'description'); 150 this.__itemRowSpace = new ObservedPropertySimplePU(NORMAL_ITEM_ROW_SPACE, this, 'itemRowSpace'); 151 this.__leftWidth = new SynchedPropertySimpleOneWayPU(s11.leftWidth, this, 'leftWidth'); 152 this.__primaryTextColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'primaryTextColor'); 153 this.__secondaryTextColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryTextColor'); 154 this.__descriptionColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'descriptionColor'); 155 this.__fontSizeScale = new SynchedPropertySimpleOneWayPU(s11.fontSizeScale, this, 'fontSizeScale'); 156 this.__parentDirection = new SynchedPropertySimpleOneWayPU(s11.parentDirection, this, 'parentDirection'); 157 this.__itemDirection = new SynchedPropertySimpleOneWayPU(s11.itemDirection, this, 'itemDirection'); 158 this.__isFocus = new SynchedPropertySimpleOneWayPU(s11.isFocus, this, 'isFocus'); 159 this.__primaryTextSize = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_body1'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'primaryTextSize'); 160 this.__primaryTextColors = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'primaryTextColors'); 161 this.__itemHeight = new SynchedPropertyObjectOneWayPU(s11.itemHeight, this, 'itemHeight'); 162 this.__iconColor = new ObservedPropertyObjectPU(null, this, 'iconColor'); 163 this.__secondaryTextColors = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.font_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryTextColors'); 164 this.__secondaryThirdTextSize = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_left_secondary_tertiary_text_size'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryThirdTextSize'); 165 this.__descriptionColors = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.font_tertiary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'descriptionColors'); 166 this.__isWrapText = new SynchedPropertyObjectTwoWayPU(s11.isWrapText, this, 'isWrapText'); 167 this.__isWrapFirstText = new ObservedPropertyObjectPU(false, this, 'isWrapFirstText'); 168 this.__isWrapSecondText = new ObservedPropertyObjectPU(false, this, 'isWrapSecondText'); 169 this.__isWrapThirdText = new ObservedPropertyObjectPU(false, this, 'isWrapThirdText'); 170 this.setInitiallyProvidedValue(s11); 171 this.declareWatch('iconStyle', this.onPropChange); 172 this.declareWatch('icon', this.onPropChange); 173 this.declareWatch('symbolStyle', this.onPropChange); 174 this.declareWatch('primaryText', this.onPropChange); 175 this.declareWatch('secondaryText', this.onPropChange); 176 this.declareWatch('description', this.onPropChange); 177 this.declareWatch('primaryTextColor', this.onPropChange); 178 this.declareWatch('secondaryTextColor', this.onPropChange); 179 this.declareWatch('descriptionColor', this.onPropChange); 180 this.declareWatch('isFocus', this.onPropChange); 181 this.declareWatch('isWrapFirstText', this.onWrapChange); 182 this.declareWatch('isWrapSecondText', this.onWrapChange); 183 this.declareWatch('isWrapThirdText', this.onWrapChange); 184 this.finalizeConstruction(); 185 } 186 setInitiallyProvidedValue(q11) { 187 if (q11.iconStyle === undefined) { 188 this.__iconStyle.set(null); 189 } 190 if (q11.icon === undefined) { 191 this.__icon.set(null); 192 } 193 if (q11.symbolStyle === undefined) { 194 this.__symbolStyle.set(null); 195 } 196 if (q11.primaryText === undefined) { 197 this.__primaryText.set(null); 198 } 199 if (q11.secondaryText === undefined) { 200 this.__secondaryText.set(null); 201 } 202 if (q11.description === undefined) { 203 this.__description.set(null); 204 } 205 if (q11.itemRowSpace !== undefined) { 206 this.itemRowSpace = q11.itemRowSpace; 207 } 208 if (q11.leftWidth === undefined) { 209 this.__leftWidth.set(LEFT_PART_WIDTH); 210 } 211 if (q11.primaryTextColor !== undefined) { 212 this.primaryTextColor = q11.primaryTextColor; 213 } 214 if (q11.secondaryTextColor !== undefined) { 215 this.secondaryTextColor = q11.secondaryTextColor; 216 } 217 if (q11.descriptionColor !== undefined) { 218 this.descriptionColor = q11.descriptionColor; 219 } 220 if (q11.isFocus === undefined) { 221 this.__isFocus.set(false); 222 } 223 if (q11.primaryTextSize !== undefined) { 224 this.primaryTextSize = q11.primaryTextSize; 225 } 226 if (q11.primaryTextColors !== undefined) { 227 this.primaryTextColors = q11.primaryTextColors; 228 } 229 if (q11.itemHeight === undefined) { 230 this.__itemHeight.set(null); 231 } 232 if (q11.iconColor !== undefined) { 233 this.iconColor = q11.iconColor; 234 } 235 if (q11.secondaryTextColors !== undefined) { 236 this.secondaryTextColors = q11.secondaryTextColors; 237 } 238 if (q11.secondaryThirdTextSize !== undefined) { 239 this.secondaryThirdTextSize = q11.secondaryThirdTextSize; 240 } 241 if (q11.descriptionColors !== undefined) { 242 this.descriptionColors = q11.descriptionColors; 243 } 244 if (q11.isWrapFirstText !== undefined) { 245 this.isWrapFirstText = q11.isWrapFirstText; 246 } 247 if (q11.isWrapSecondText !== undefined) { 248 this.isWrapSecondText = q11.isWrapSecondText; 249 } 250 if (q11.isWrapThirdText !== undefined) { 251 this.isWrapThirdText = q11.isWrapThirdText; 252 } 253 } 254 updateStateVars(p11) { 255 this.__iconStyle.reset(p11.iconStyle); 256 this.__icon.reset(p11.icon); 257 this.__symbolStyle.reset(p11.symbolStyle); 258 this.__primaryText.reset(p11.primaryText); 259 this.__secondaryText.reset(p11.secondaryText); 260 this.__description.reset(p11.description); 261 this.__leftWidth.reset(p11.leftWidth); 262 this.__fontSizeScale.reset(p11.fontSizeScale); 263 this.__parentDirection.reset(p11.parentDirection); 264 this.__itemDirection.reset(p11.itemDirection); 265 this.__isFocus.reset(p11.isFocus); 266 this.__itemHeight.reset(p11.itemHeight); 267 } 268 purgeVariableDependenciesOnElmtId(o11) { 269 this.__iconStyle.purgeDependencyOnElmtId(o11); 270 this.__icon.purgeDependencyOnElmtId(o11); 271 this.__symbolStyle.purgeDependencyOnElmtId(o11); 272 this.__primaryText.purgeDependencyOnElmtId(o11); 273 this.__secondaryText.purgeDependencyOnElmtId(o11); 274 this.__description.purgeDependencyOnElmtId(o11); 275 this.__itemRowSpace.purgeDependencyOnElmtId(o11); 276 this.__leftWidth.purgeDependencyOnElmtId(o11); 277 this.__primaryTextColor.purgeDependencyOnElmtId(o11); 278 this.__secondaryTextColor.purgeDependencyOnElmtId(o11); 279 this.__descriptionColor.purgeDependencyOnElmtId(o11); 280 this.__fontSizeScale.purgeDependencyOnElmtId(o11); 281 this.__parentDirection.purgeDependencyOnElmtId(o11); 282 this.__itemDirection.purgeDependencyOnElmtId(o11); 283 this.__isFocus.purgeDependencyOnElmtId(o11); 284 this.__primaryTextSize.purgeDependencyOnElmtId(o11); 285 this.__primaryTextColors.purgeDependencyOnElmtId(o11); 286 this.__itemHeight.purgeDependencyOnElmtId(o11); 287 this.__iconColor.purgeDependencyOnElmtId(o11); 288 this.__secondaryTextColors.purgeDependencyOnElmtId(o11); 289 this.__secondaryThirdTextSize.purgeDependencyOnElmtId(o11); 290 this.__descriptionColors.purgeDependencyOnElmtId(o11); 291 this.__isWrapText.purgeDependencyOnElmtId(o11); 292 this.__isWrapFirstText.purgeDependencyOnElmtId(o11); 293 this.__isWrapSecondText.purgeDependencyOnElmtId(o11); 294 this.__isWrapThirdText.purgeDependencyOnElmtId(o11); 295 } 296 aboutToBeDeleted() { 297 this.__iconStyle.aboutToBeDeleted(); 298 this.__icon.aboutToBeDeleted(); 299 this.__symbolStyle.aboutToBeDeleted(); 300 this.__primaryText.aboutToBeDeleted(); 301 this.__secondaryText.aboutToBeDeleted(); 302 this.__description.aboutToBeDeleted(); 303 this.__itemRowSpace.aboutToBeDeleted(); 304 this.__leftWidth.aboutToBeDeleted(); 305 this.__primaryTextColor.aboutToBeDeleted(); 306 this.__secondaryTextColor.aboutToBeDeleted(); 307 this.__descriptionColor.aboutToBeDeleted(); 308 this.__fontSizeScale.aboutToBeDeleted(); 309 this.__parentDirection.aboutToBeDeleted(); 310 this.__itemDirection.aboutToBeDeleted(); 311 this.__isFocus.aboutToBeDeleted(); 312 this.__primaryTextSize.aboutToBeDeleted(); 313 this.__primaryTextColors.aboutToBeDeleted(); 314 this.__itemHeight.aboutToBeDeleted(); 315 this.__iconColor.aboutToBeDeleted(); 316 this.__secondaryTextColors.aboutToBeDeleted(); 317 this.__secondaryThirdTextSize.aboutToBeDeleted(); 318 this.__descriptionColors.aboutToBeDeleted(); 319 this.__isWrapText.aboutToBeDeleted(); 320 this.__isWrapFirstText.aboutToBeDeleted(); 321 this.__isWrapSecondText.aboutToBeDeleted(); 322 this.__isWrapThirdText.aboutToBeDeleted(); 323 SubscriberManager.Get().delete(this.id__()); 324 this.aboutToBeDeletedInternal(); 325 } 326 get iconStyle() { 327 return this.__iconStyle.get(); 328 } 329 set iconStyle(n11) { 330 this.__iconStyle.set(n11); 331 } 332 get icon() { 333 return this.__icon.get(); 334 } 335 set icon(m11) { 336 this.__icon.set(m11); 337 } 338 get symbolStyle() { 339 return this.__symbolStyle.get(); 340 } 341 set symbolStyle(l11) { 342 this.__symbolStyle.set(l11); 343 } 344 get primaryText() { 345 return this.__primaryText.get(); 346 } 347 set primaryText(k11) { 348 this.__primaryText.set(k11); 349 } 350 get secondaryText() { 351 return this.__secondaryText.get(); 352 } 353 set secondaryText(j11) { 354 this.__secondaryText.set(j11); 355 } 356 get description() { 357 return this.__description.get(); 358 } 359 set description(i11) { 360 this.__description.set(i11); 361 } 362 get itemRowSpace() { 363 return this.__itemRowSpace.get(); 364 } 365 set itemRowSpace(h11) { 366 this.__itemRowSpace.set(h11); 367 } 368 get leftWidth() { 369 return this.__leftWidth.get(); 370 } 371 set leftWidth(g11) { 372 this.__leftWidth.set(g11); 373 } 374 get primaryTextColor() { 375 return this.__primaryTextColor.get(); 376 } 377 set primaryTextColor(f11) { 378 this.__primaryTextColor.set(f11); 379 } 380 get secondaryTextColor() { 381 return this.__secondaryTextColor.get(); 382 } 383 set secondaryTextColor(e11) { 384 this.__secondaryTextColor.set(e11); 385 } 386 get descriptionColor() { 387 return this.__descriptionColor.get(); 388 } 389 set descriptionColor(d11) { 390 this.__descriptionColor.set(d11); 391 } 392 get fontSizeScale() { 393 return this.__fontSizeScale.get(); 394 } 395 set fontSizeScale(c11) { 396 this.__fontSizeScale.set(c11); 397 } 398 get parentDirection() { 399 return this.__parentDirection.get(); 400 } 401 set parentDirection(b11) { 402 this.__parentDirection.set(b11); 403 } 404 get itemDirection() { 405 return this.__itemDirection.get(); 406 } 407 set itemDirection(a11) { 408 this.__itemDirection.set(a11); 409 } 410 get isFocus() { 411 return this.__isFocus.get(); 412 } 413 set isFocus(z10) { 414 this.__isFocus.set(z10); 415 } 416 get primaryTextSize() { 417 return this.__primaryTextSize.get(); 418 } 419 set primaryTextSize(y10) { 420 this.__primaryTextSize.set(y10); 421 } 422 get primaryTextColors() { 423 return this.__primaryTextColors.get(); 424 } 425 set primaryTextColors(x10) { 426 this.__primaryTextColors.set(x10); 427 } 428 get itemHeight() { 429 return this.__itemHeight.get(); 430 } 431 set itemHeight(w10) { 432 this.__itemHeight.set(w10); 433 } 434 get iconColor() { 435 return this.__iconColor.get(); 436 } 437 set iconColor(v10) { 438 this.__iconColor.set(v10); 439 } 440 get secondaryTextColors() { 441 return this.__secondaryTextColors.get(); 442 } 443 set secondaryTextColors(u10) { 444 this.__secondaryTextColors.set(u10); 445 } 446 get secondaryThirdTextSize() { 447 return this.__secondaryThirdTextSize.get(); 448 } 449 set secondaryThirdTextSize(t10) { 450 this.__secondaryThirdTextSize.set(t10); 451 } 452 get descriptionColors() { 453 return this.__descriptionColors.get(); 454 } 455 set descriptionColors(s10) { 456 this.__descriptionColors.set(s10); 457 } 458 get isWrapText() { 459 return this.__isWrapText.get(); 460 } 461 set isWrapText(r10) { 462 this.__isWrapText.set(r10); 463 } 464 get isWrapFirstText() { 465 return this.__isWrapFirstText.get(); 466 } 467 set isWrapFirstText(q10) { 468 this.__isWrapFirstText.set(q10); 469 } 470 get isWrapSecondText() { 471 return this.__isWrapSecondText.get(); 472 } 473 set isWrapSecondText(p10) { 474 this.__isWrapSecondText.set(p10); 475 } 476 get isWrapThirdText() { 477 return this.__isWrapThirdText.get(); 478 } 479 set isWrapThirdText(o10) { 480 this.__isWrapThirdText.set(o10); 481 } 482 onWillApplyTheme(n10) { 483 this.primaryTextColor = n10.colors.fontPrimary; 484 this.secondaryTextColor = n10.colors.fontSecondary; 485 this.descriptionColor = n10.colors.fontTertiary; 486 } 487 onPropChange() { 488 if (this.icon == null && this.symbolStyle == null && this.iconStyle == null) { 489 this.itemRowSpace = SPECIAL_ITEM_ROW_SPACE; 490 } 491 else { 492 this.itemRowSpace = NORMAL_ITEM_ROW_SPACE; 493 } 494 if (!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus) { 495 this.primaryTextColors = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_left_text_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 496 this.secondaryTextColors = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_left_secondary_text_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 497 this.descriptionColors = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_left_secondary_text_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 498 } 499 else { 500 this.primaryTextColors = this.primaryTextColor; 501 this.secondaryTextColors = this.secondaryTextColor; 502 this.descriptionColors = this.descriptionColor; 503 } 504 } 505 onWrapChange() { 506 this.isWrapText = this.isWrapFirstText || this.isWrapSecondText || this.isWrapThirdText; 507 } 508 getContentItemIconFillColor() { 509 switch (this.iconStyle) { 510 case IconType.BADGE: 511 return { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_badge_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 512 case IconType.SYSTEM_ICON: 513 return { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_icon_normal_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 514 default: 515 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 516 } 517 } 518 judgeIsWrap(j10, k10, l10) { 519 let m10 = this.getSingleRowTextHeight(j10, k10); 520 return l10 > m10; 521 } 522 getSingleRowTextHeight(g10, h10) { 523 if (g10 && h10) { 524 let i10 = px2vp(measure.measureTextSize({ 525 textContent: g10, 526 fontSize: h10, 527 maxLines: TEXT_MAX_LINE 528 }).height); 529 return i10; 530 } 531 return 0; 532 } 533 aboutToAppear() { 534 this.onPropChange(); 535 } 536 createIcon(p9 = null) { 537 this.observeComponentCreation2((q9, r9) => { 538 If.create(); 539 if (this.iconStyle != null && ICON_SIZE_MAP.has(this.iconStyle)) { 540 this.ifElseBranchUpdateFunction(0, () => { 541 this.observeComponentCreation2((s9, t9) => { 542 If.create(); 543 if (this.symbolStyle != null) { 544 this.ifElseBranchUpdateFunction(0, () => { 545 this.observeComponentCreation2((e10, f10) => { 546 SymbolGlyph.create(); 547 SymbolGlyph.fontColor([this.getContentItemIconFillColor()]); 548 SymbolGlyph.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.symbolStyle)); 549 SymbolGlyph.fontSize(`${ICON_SIZE_MAP.get(this.iconStyle)}vp`); 550 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 551 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 552 SymbolGlyph.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_Image_Radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 553 SymbolGlyph.focusable(false); 554 SymbolGlyph.draggable(false); 555 SymbolGlyph.flexShrink(0); 556 }, SymbolGlyph); 557 }); 558 } 559 else if (this.icon != null) { 560 this.ifElseBranchUpdateFunction(1, () => { 561 this.observeComponentCreation2((u9, v9) => { 562 If.create(); 563 if (Util.isSymbolResource(ObservedObject.GetRawObject(this.icon))) { 564 this.ifElseBranchUpdateFunction(0, () => { 565 this.observeComponentCreation2((c10, d10) => { 566 SymbolGlyph.create(this.icon); 567 SymbolGlyph.fontSize(`${ICON_SIZE_MAP.get(this.iconStyle)}vp`); 568 SymbolGlyph.fontColor([this.getContentItemIconFillColor()]); 569 SymbolGlyph.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_Image_Radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 570 SymbolGlyph.focusable(false); 571 SymbolGlyph.draggable(false); 572 SymbolGlyph.flexShrink(0); 573 }, SymbolGlyph); 574 }); 575 } 576 else { 577 this.ifElseBranchUpdateFunction(1, () => { 578 this.observeComponentCreation2((w9, x9) => { 579 If.create(); 580 if (this.iconStyle <= IconType.PREVIEW) { 581 this.ifElseBranchUpdateFunction(0, () => { 582 this.observeComponentCreation2((a10, b10) => { 583 Image.create(this.icon); 584 Image.objectFit(ImageFit.Contain); 585 Image.width(ICON_SIZE_MAP.get(this.iconStyle)); 586 Image.height(ICON_SIZE_MAP.get(this.iconStyle)); 587 Image.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_Image_Radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 588 Image.focusable(false); 589 Image.draggable(false); 590 Image.fillColor(this.getContentItemIconFillColor()); 591 Image.flexShrink(0); 592 }, Image); 593 }); 594 } 595 else { 596 this.ifElseBranchUpdateFunction(1, () => { 597 this.observeComponentCreation2((y9, z9) => { 598 Image.create(this.icon); 599 Image.objectFit(ImageFit.Contain); 600 Image.constraintSize({ 601 minWidth: SPECIAL_ICON_SIZE, 602 maxWidth: ICON_SIZE_MAP.get(this.iconStyle), 603 minHeight: SPECIAL_ICON_SIZE, 604 maxHeight: ICON_SIZE_MAP.get(this.iconStyle) 605 }); 606 Image.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_Image_Radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 607 Image.focusable(false); 608 Image.draggable(false); 609 Image.fillColor(this.getContentItemIconFillColor()); 610 Image.flexShrink(0); 611 }, Image); 612 }); 613 } 614 }, If); 615 If.pop(); 616 }); 617 } 618 }, If); 619 If.pop(); 620 }); 621 } 622 else { 623 this.ifElseBranchUpdateFunction(2, () => { 624 }); 625 } 626 }, If); 627 If.pop(); 628 }); 629 } 630 else { 631 this.ifElseBranchUpdateFunction(1, () => { 632 }); 633 } 634 }, If); 635 If.pop(); 636 } 637 createText(w8 = null) { 638 this.observeComponentCreation2((n9, o9) => { 639 Column.create({ space: TEXT_COLUMN_SPACE }); 640 Column.flexShrink(1); 641 Column.margin(this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 ? undefined : { 642 top: TEXT_SAFE_MARGIN, 643 bottom: TEXT_SAFE_MARGIN 644 }); 645 Column.alignItems(HorizontalAlign.Start); 646 }, Column); 647 this.observeComponentCreation2((j9, k9) => { 648 Text.create(this.primaryText); 649 Text.fontSize(ObservedObject.GetRawObject(this.primaryTextSize)); 650 Text.fontColor(ObservedObject.GetRawObject(this.primaryTextColors)); 651 Text.textOverflow({ 652 overflow: IS_MARQUEE_OR_ELLIPSIS === TEXT_SUPPORT_MARQUEE ? TextOverflow.None : 653 TextOverflow.Ellipsis 654 }); 655 Text.fontWeight(FontWeight.Medium); 656 Text.focusable(true); 657 Text.draggable(false); 658 Text.onSizeChange((l9, m9) => { 659 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 660 this.isWrapFirstText = this.judgeIsWrap(ObservedObject.GetRawObject(this.primaryText), ObservedObject.GetRawObject(this.primaryTextSize), m9.height); 661 } 662 }); 663 }, Text); 664 Text.pop(); 665 this.observeComponentCreation2((d9, e9) => { 666 If.create(); 667 if (this.secondaryText != null) { 668 this.ifElseBranchUpdateFunction(0, () => { 669 this.observeComponentCreation2((f9, g9) => { 670 Text.create(this.secondaryText); 671 Text.fontSize(ObservedObject.GetRawObject(this.secondaryThirdTextSize)); 672 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 673 Text.textOverflow({ 674 overflow: IS_MARQUEE_OR_ELLIPSIS === TEXT_SUPPORT_MARQUEE ? TextOverflow.None : 675 TextOverflow.Ellipsis 676 }); 677 Text.draggable(false); 678 Text.onSizeChange((h9, i9) => { 679 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 680 this.isWrapSecondText = this.judgeIsWrap(ObservedObject.GetRawObject(this.secondaryText), ObservedObject.GetRawObject(this.secondaryThirdTextSize), i9.height); 681 } 682 }); 683 }, Text); 684 Text.pop(); 685 }); 686 } 687 else { 688 this.ifElseBranchUpdateFunction(1, () => { 689 }); 690 } 691 }, If); 692 If.pop(); 693 this.observeComponentCreation2((x8, y8) => { 694 If.create(); 695 if (this.description != null) { 696 this.ifElseBranchUpdateFunction(0, () => { 697 this.observeComponentCreation2((z8, a9) => { 698 Text.create(this.description); 699 Text.fontSize(ObservedObject.GetRawObject(this.secondaryThirdTextSize)); 700 Text.fontColor(ObservedObject.GetRawObject(this.descriptionColors)); 701 Text.textOverflow({ 702 overflow: IS_MARQUEE_OR_ELLIPSIS === TEXT_SUPPORT_MARQUEE ? TextOverflow.None : 703 TextOverflow.Ellipsis 704 }); 705 Text.draggable(false); 706 Text.onSizeChange((b9, c9) => { 707 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 708 this.isWrapThirdText = this.judgeIsWrap(ObservedObject.GetRawObject(this.description), ObservedObject.GetRawObject(this.secondaryThirdTextSize), c9.height); 709 } 710 }); 711 }, Text); 712 Text.pop(); 713 }); 714 } 715 else { 716 this.ifElseBranchUpdateFunction(1, () => { 717 }); 718 } 719 }, If); 720 If.pop(); 721 Column.pop(); 722 } 723 isColumnDirection() { 724 return this.itemDirection === FlexDirection.Column; 725 } 726 isParentColumnDirection() { 727 return this.parentDirection === FlexDirection.Column; 728 } 729 getItemSpace() { 730 if (this.isColumnDirection()) { 731 return LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.padding_level1'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 732 } 733 return LengthMetrics.vp(this.itemRowSpace); 734 } 735 initialRender() { 736 this.observeComponentCreation2((u8, v8) => { 737 Flex.create({ 738 space: { main: this.getItemSpace() }, 739 direction: this.itemDirection, 740 justifyContent: FlexAlign.Start, 741 alignItems: this.isColumnDirection() ? ItemAlign.Start : ItemAlign.Center, 742 }); 743 Flex.height(this.itemDirection === FlexDirection.Column ? 'auto' : undefined); 744 Flex.margin({ 745 end: this.isParentColumnDirection() ? 746 LengthMetrics.vp(0) : 747 LengthMetrics.vp(16) 748 }); 749 Flex.padding({ start: LengthMetrics.vp(LISTITEM_PADDING) }); 750 Flex.flexShrink(this.isParentColumnDirection() ? 0 : 1); 751 }, Flex); 752 this.createIcon.bind(this)(); 753 this.createText.bind(this)(); 754 Flex.pop(); 755 } 756 rerender() { 757 this.updateDirtyElements(); 758 } 759} 760class CreateIconParam { 761} 762class OperateItemStruct extends ViewPU { 763 constructor(o8, p8, q8, r8 = -1, s8 = undefined, t8) { 764 super(o8, q8, r8, t8); 765 if (typeof s8 === 'function') { 766 this.paramsGenerator_ = s8; 767 } 768 this.__arrow = new SynchedPropertyObjectOneWayPU(p8.arrow, this, 'arrow'); 769 this.__icon = new SynchedPropertyObjectOneWayPU(p8.icon, this, 'icon'); 770 this.__subIcon = new SynchedPropertyObjectOneWayPU(p8.subIcon, this, 'subIcon'); 771 this.__button = new SynchedPropertyObjectOneWayPU(p8.button, this, 'button'); 772 this.__switch = new SynchedPropertyObjectOneWayPU(p8.switch, this, 'switch'); 773 this.__checkBox = new SynchedPropertyObjectOneWayPU(p8.checkBox, this, 'checkBox'); 774 this.__radio = new SynchedPropertyObjectOneWayPU(p8.radio, this, 'radio'); 775 this.__image = new SynchedPropertyObjectOneWayPU(p8.image, this, 'image'); 776 this.__symbolStyle = new SynchedPropertyObjectOneWayPU(p8.symbolStyle, this, 'symbolStyle'); 777 this.__text = new SynchedPropertyObjectOneWayPU(p8.text, this, 'text'); 778 this.__switchState = new ObservedPropertySimplePU(false, this, 'switchState'); 779 this.__radioState = new ObservedPropertySimplePU(false, this, 'radioState'); 780 this.__checkBoxState = new ObservedPropertySimplePU(false, this, 'checkBoxState'); 781 this.__rightWidth = new SynchedPropertySimpleOneWayPU(p8.rightWidth, this, 'rightWidth'); 782 this.__secondaryTextColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryTextColor'); 783 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, 'hoveringColor'); 784 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, 'activedColor'); 785 this.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(p8.parentCanFocus, this, 'parentCanFocus'); 786 this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(p8.parentCanTouch, this, 'parentCanTouch'); 787 this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(p8.parentIsHover, this, 'parentIsHover'); 788 this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(p8.parentCanHover, this, 'parentCanHover'); 789 this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(p8.parentIsActive, this, 'parentIsActive'); 790 this.__parentFrontColor = new SynchedPropertyObjectTwoWayPU(p8.parentFrontColor, this, 'parentFrontColor'); 791 this.__parentDirection = new SynchedPropertySimpleTwoWayPU(p8.parentDirection, this, 'parentDirection'); 792 this.__rowSpace = new ObservedPropertySimplePU(DEFAULT_ROW_SPACE, this, 'rowSpace'); 793 this.__isFocus = new SynchedPropertySimpleTwoWayPU(p8.isFocus, this, 'isFocus'); 794 this.__secondaryTextSize = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_body2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryTextSize'); 795 this.__secondaryTextColors = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.font_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'secondaryTextColors'); 796 this.__iconColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_right_icon_normal_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'iconColor'); 797 this.__isChecked = new SynchedPropertySimpleTwoWayPU(p8.isChecked, this, 'isChecked'); 798 this.setInitiallyProvidedValue(p8); 799 this.declareWatch('arrow', this.onPropChange); 800 this.declareWatch('icon', this.onPropChange); 801 this.declareWatch('subIcon', this.onPropChange); 802 this.declareWatch('button', this.onPropChange); 803 this.declareWatch('switch', this.onPropChange); 804 this.declareWatch('checkBox', this.onPropChange); 805 this.declareWatch('radio', this.onPropChange); 806 this.declareWatch('image', this.onPropChange); 807 this.declareWatch('symbolStyle', this.onPropChange); 808 this.declareWatch('text', this.onPropChange); 809 this.declareWatch('secondaryTextColor', this.onFocusChange); 810 this.declareWatch('isFocus', this.onFocusChange); 811 this.declareWatch('isChecked', this.onPropChange); 812 this.finalizeConstruction(); 813 } 814 setInitiallyProvidedValue(n8) { 815 if (n8.arrow === undefined) { 816 this.__arrow.set(null); 817 } 818 if (n8.icon === undefined) { 819 this.__icon.set(null); 820 } 821 if (n8.subIcon === undefined) { 822 this.__subIcon.set(null); 823 } 824 if (n8.button === undefined) { 825 this.__button.set(null); 826 } 827 if (n8.switch === undefined) { 828 this.__switch.set(null); 829 } 830 if (n8.checkBox === undefined) { 831 this.__checkBox.set(null); 832 } 833 if (n8.radio === undefined) { 834 this.__radio.set(null); 835 } 836 if (n8.image === undefined) { 837 this.__image.set(null); 838 } 839 if (n8.symbolStyle === undefined) { 840 this.__symbolStyle.set(null); 841 } 842 if (n8.text === undefined) { 843 this.__text.set(null); 844 } 845 if (n8.switchState !== undefined) { 846 this.switchState = n8.switchState; 847 } 848 if (n8.radioState !== undefined) { 849 this.radioState = n8.radioState; 850 } 851 if (n8.checkBoxState !== undefined) { 852 this.checkBoxState = n8.checkBoxState; 853 } 854 if (n8.rightWidth === undefined) { 855 this.__rightWidth.set(RIGHT_PART_WIDTH); 856 } 857 if (n8.secondaryTextColor !== undefined) { 858 this.secondaryTextColor = n8.secondaryTextColor; 859 } 860 if (n8.hoveringColor !== undefined) { 861 this.hoveringColor = n8.hoveringColor; 862 } 863 if (n8.activedColor !== undefined) { 864 this.activedColor = n8.activedColor; 865 } 866 if (n8.rowSpace !== undefined) { 867 this.rowSpace = n8.rowSpace; 868 } 869 if (n8.secondaryTextSize !== undefined) { 870 this.secondaryTextSize = n8.secondaryTextSize; 871 } 872 if (n8.secondaryTextColors !== undefined) { 873 this.secondaryTextColors = n8.secondaryTextColors; 874 } 875 if (n8.iconColor !== undefined) { 876 this.iconColor = n8.iconColor; 877 } 878 } 879 updateStateVars(m8) { 880 this.__arrow.reset(m8.arrow); 881 this.__icon.reset(m8.icon); 882 this.__subIcon.reset(m8.subIcon); 883 this.__button.reset(m8.button); 884 this.__switch.reset(m8.switch); 885 this.__checkBox.reset(m8.checkBox); 886 this.__radio.reset(m8.radio); 887 this.__image.reset(m8.image); 888 this.__symbolStyle.reset(m8.symbolStyle); 889 this.__text.reset(m8.text); 890 this.__rightWidth.reset(m8.rightWidth); 891 } 892 purgeVariableDependenciesOnElmtId(l8) { 893 this.__arrow.purgeDependencyOnElmtId(l8); 894 this.__icon.purgeDependencyOnElmtId(l8); 895 this.__subIcon.purgeDependencyOnElmtId(l8); 896 this.__button.purgeDependencyOnElmtId(l8); 897 this.__switch.purgeDependencyOnElmtId(l8); 898 this.__checkBox.purgeDependencyOnElmtId(l8); 899 this.__radio.purgeDependencyOnElmtId(l8); 900 this.__image.purgeDependencyOnElmtId(l8); 901 this.__symbolStyle.purgeDependencyOnElmtId(l8); 902 this.__text.purgeDependencyOnElmtId(l8); 903 this.__switchState.purgeDependencyOnElmtId(l8); 904 this.__radioState.purgeDependencyOnElmtId(l8); 905 this.__checkBoxState.purgeDependencyOnElmtId(l8); 906 this.__rightWidth.purgeDependencyOnElmtId(l8); 907 this.__secondaryTextColor.purgeDependencyOnElmtId(l8); 908 this.__hoveringColor.purgeDependencyOnElmtId(l8); 909 this.__activedColor.purgeDependencyOnElmtId(l8); 910 this.__parentCanFocus.purgeDependencyOnElmtId(l8); 911 this.__parentCanTouch.purgeDependencyOnElmtId(l8); 912 this.__parentIsHover.purgeDependencyOnElmtId(l8); 913 this.__parentCanHover.purgeDependencyOnElmtId(l8); 914 this.__parentIsActive.purgeDependencyOnElmtId(l8); 915 this.__parentFrontColor.purgeDependencyOnElmtId(l8); 916 this.__parentDirection.purgeDependencyOnElmtId(l8); 917 this.__rowSpace.purgeDependencyOnElmtId(l8); 918 this.__isFocus.purgeDependencyOnElmtId(l8); 919 this.__secondaryTextSize.purgeDependencyOnElmtId(l8); 920 this.__secondaryTextColors.purgeDependencyOnElmtId(l8); 921 this.__iconColor.purgeDependencyOnElmtId(l8); 922 this.__isChecked.purgeDependencyOnElmtId(l8); 923 } 924 aboutToBeDeleted() { 925 this.__arrow.aboutToBeDeleted(); 926 this.__icon.aboutToBeDeleted(); 927 this.__subIcon.aboutToBeDeleted(); 928 this.__button.aboutToBeDeleted(); 929 this.__switch.aboutToBeDeleted(); 930 this.__checkBox.aboutToBeDeleted(); 931 this.__radio.aboutToBeDeleted(); 932 this.__image.aboutToBeDeleted(); 933 this.__symbolStyle.aboutToBeDeleted(); 934 this.__text.aboutToBeDeleted(); 935 this.__switchState.aboutToBeDeleted(); 936 this.__radioState.aboutToBeDeleted(); 937 this.__checkBoxState.aboutToBeDeleted(); 938 this.__rightWidth.aboutToBeDeleted(); 939 this.__secondaryTextColor.aboutToBeDeleted(); 940 this.__hoveringColor.aboutToBeDeleted(); 941 this.__activedColor.aboutToBeDeleted(); 942 this.__parentCanFocus.aboutToBeDeleted(); 943 this.__parentCanTouch.aboutToBeDeleted(); 944 this.__parentIsHover.aboutToBeDeleted(); 945 this.__parentCanHover.aboutToBeDeleted(); 946 this.__parentIsActive.aboutToBeDeleted(); 947 this.__parentFrontColor.aboutToBeDeleted(); 948 this.__parentDirection.aboutToBeDeleted(); 949 this.__rowSpace.aboutToBeDeleted(); 950 this.__isFocus.aboutToBeDeleted(); 951 this.__secondaryTextSize.aboutToBeDeleted(); 952 this.__secondaryTextColors.aboutToBeDeleted(); 953 this.__iconColor.aboutToBeDeleted(); 954 this.__isChecked.aboutToBeDeleted(); 955 SubscriberManager.Get().delete(this.id__()); 956 this.aboutToBeDeletedInternal(); 957 } 958 get arrow() { 959 return this.__arrow.get(); 960 } 961 set arrow(k8) { 962 this.__arrow.set(k8); 963 } 964 get icon() { 965 return this.__icon.get(); 966 } 967 set icon(j8) { 968 this.__icon.set(j8); 969 } 970 get subIcon() { 971 return this.__subIcon.get(); 972 } 973 set subIcon(i8) { 974 this.__subIcon.set(i8); 975 } 976 get button() { 977 return this.__button.get(); 978 } 979 set button(h8) { 980 this.__button.set(h8); 981 } 982 get switch() { 983 return this.__switch.get(); 984 } 985 set switch(g8) { 986 this.__switch.set(g8); 987 } 988 get checkBox() { 989 return this.__checkBox.get(); 990 } 991 set checkBox(f8) { 992 this.__checkBox.set(f8); 993 } 994 get radio() { 995 return this.__radio.get(); 996 } 997 set radio(e8) { 998 this.__radio.set(e8); 999 } 1000 get image() { 1001 return this.__image.get(); 1002 } 1003 set image(d8) { 1004 this.__image.set(d8); 1005 } 1006 get symbolStyle() { 1007 return this.__symbolStyle.get(); 1008 } 1009 set symbolStyle(c8) { 1010 this.__symbolStyle.set(c8); 1011 } 1012 get text() { 1013 return this.__text.get(); 1014 } 1015 set text(b8) { 1016 this.__text.set(b8); 1017 } 1018 get switchState() { 1019 return this.__switchState.get(); 1020 } 1021 set switchState(a8) { 1022 this.__switchState.set(a8); 1023 } 1024 get radioState() { 1025 return this.__radioState.get(); 1026 } 1027 set radioState(z7) { 1028 this.__radioState.set(z7); 1029 } 1030 get checkBoxState() { 1031 return this.__checkBoxState.get(); 1032 } 1033 set checkBoxState(y7) { 1034 this.__checkBoxState.set(y7); 1035 } 1036 get rightWidth() { 1037 return this.__rightWidth.get(); 1038 } 1039 set rightWidth(x7) { 1040 this.__rightWidth.set(x7); 1041 } 1042 get secondaryTextColor() { 1043 return this.__secondaryTextColor.get(); 1044 } 1045 set secondaryTextColor(w7) { 1046 this.__secondaryTextColor.set(w7); 1047 } 1048 get hoveringColor() { 1049 return this.__hoveringColor.get(); 1050 } 1051 set hoveringColor(v7) { 1052 this.__hoveringColor.set(v7); 1053 } 1054 get activedColor() { 1055 return this.__activedColor.get(); 1056 } 1057 set activedColor(u7) { 1058 this.__activedColor.set(u7); 1059 } 1060 get parentCanFocus() { 1061 return this.__parentCanFocus.get(); 1062 } 1063 set parentCanFocus(t7) { 1064 this.__parentCanFocus.set(t7); 1065 } 1066 get parentCanTouch() { 1067 return this.__parentCanTouch.get(); 1068 } 1069 set parentCanTouch(s7) { 1070 this.__parentCanTouch.set(s7); 1071 } 1072 get parentIsHover() { 1073 return this.__parentIsHover.get(); 1074 } 1075 set parentIsHover(r7) { 1076 this.__parentIsHover.set(r7); 1077 } 1078 get parentCanHover() { 1079 return this.__parentCanHover.get(); 1080 } 1081 set parentCanHover(q7) { 1082 this.__parentCanHover.set(q7); 1083 } 1084 get parentIsActive() { 1085 return this.__parentIsActive.get(); 1086 } 1087 set parentIsActive(p7) { 1088 this.__parentIsActive.set(p7); 1089 } 1090 get parentFrontColor() { 1091 return this.__parentFrontColor.get(); 1092 } 1093 set parentFrontColor(o7) { 1094 this.__parentFrontColor.set(o7); 1095 } 1096 get parentDirection() { 1097 return this.__parentDirection.get(); 1098 } 1099 set parentDirection(n7) { 1100 this.__parentDirection.set(n7); 1101 } 1102 get rowSpace() { 1103 return this.__rowSpace.get(); 1104 } 1105 set rowSpace(m7) { 1106 this.__rowSpace.set(m7); 1107 } 1108 get isFocus() { 1109 return this.__isFocus.get(); 1110 } 1111 set isFocus(l7) { 1112 this.__isFocus.set(l7); 1113 } 1114 get secondaryTextSize() { 1115 return this.__secondaryTextSize.get(); 1116 } 1117 set secondaryTextSize(k7) { 1118 this.__secondaryTextSize.set(k7); 1119 } 1120 get secondaryTextColors() { 1121 return this.__secondaryTextColors.get(); 1122 } 1123 set secondaryTextColors(j7) { 1124 this.__secondaryTextColors.set(j7); 1125 } 1126 get iconColor() { 1127 return this.__iconColor.get(); 1128 } 1129 set iconColor(i7) { 1130 this.__iconColor.set(i7); 1131 } 1132 get isChecked() { 1133 return this.__isChecked.get(); 1134 } 1135 set isChecked(h7) { 1136 this.__isChecked.set(h7); 1137 } 1138 onWillApplyTheme(g7) { 1139 this.secondaryTextColor = g7.colors.fontSecondary; 1140 this.hoveringColor = g7.colors.interactiveHover; 1141 this.activedColor = g7.colors.interactiveActive; 1142 } 1143 onFocusChange() { 1144 if (!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus) { 1145 this.secondaryTextColors = { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_right_text_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1146 } 1147 else { 1148 this.secondaryTextColors = this.secondaryTextColor; 1149 } 1150 this.iconColor = this.isFocus ? { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_right_icon_focus_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_right_icon_normal_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1151 } 1152 onPropChange() { 1153 if (this.switch != null) { 1154 this.switchState = IS_SUPPORT_SUBCOMPONENT_EVENT ? this.switch.isCheck : this.isChecked; 1155 } 1156 if (this.radio != null) { 1157 this.radioState = IS_SUPPORT_SUBCOMPONENT_EVENT ? this.radio.isCheck : this.isChecked; 1158 } 1159 if (this.checkBox != null) { 1160 this.checkBoxState = IS_SUPPORT_SUBCOMPONENT_EVENT ? this.checkBox.isCheck : this.isChecked; 1161 } 1162 if ((this.button == null && this.image == null && this.symbolStyle == null && this.text != null) && 1163 ((this.icon != null) || (this.icon == null && this.arrow != null))) { 1164 this.rowSpace = SPECICAL_ROW_SPACE; 1165 } 1166 else { 1167 this.rowSpace = DEFAULT_ROW_SPACE; 1168 } 1169 } 1170 getUnselectedColor() { 1171 if (IS_SUPPORT_SUBCOMPONENT_EVENT) { 1172 return DEFUALT_RADIO_CHECKBOX_BORDER_COLOR; 1173 } 1174 return this.isFocus ? OPERATE_ITEM_COLOR : DEFUALT_RADIO_CHECKBOX_BORDER_COLOR; 1175 } 1176 aboutToAppear() { 1177 if (this.switch !== null) { 1178 this.isChecked = this.switch.isCheck; 1179 } 1180 if (this.radio !== null) { 1181 this.isChecked = this.radio.isCheck; 1182 } 1183 if (this.checkBox !== null) { 1184 this.isChecked = this.checkBox.isCheck; 1185 } 1186 this.onPropChange(); 1187 this.onFocusChange(); 1188 } 1189 createButton(y6 = null) { 1190 this.observeComponentCreation2((d7, e7) => { 1191 Button.createWithChild(); 1192 Button.padding({ top: 0, bottom: 0 }); 1193 Button.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1194 Button.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? HitTestMode.Block : HitTestMode.None); 1195 Button.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1196 Button.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary_activated_transparent'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1197 Button.constraintSize({ 1198 minHeight: BUTTON_SIZE 1199 }); 1200 Button.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_button_normal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1201 Button.labelStyle({ 1202 maxLines: TEXT_MAX_LINE 1203 }); 1204 Button.onFocus(() => { 1205 this.parentCanFocus = false; 1206 }); 1207 Button.onHover((f7) => { 1208 this.parentCanHover = false; 1209 if (f7 && this.parentFrontColor === this.hoveringColor && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1210 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1211 } 1212 if (!f7) { 1213 this.parentCanHover = true; 1214 if (this.parentIsHover) { 1215 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1216 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1217 } 1218 } 1219 }); 1220 Button.accessibilityLevel(this.button?.accessibilityLevel ?? ACCESSIBILITY_LEVEL_AUTO); 1221 Button.accessibilityText(getAccessibilityText(this.button?.accessibilityText ?? '')); 1222 Button.accessibilityDescription(getAccessibilityText(this.button?.accessibilityDescription ?? '')); 1223 }, Button); 1224 this.observeComponentCreation2((b7, c7) => { 1225 Row.create(); 1226 Row.padding({ 1227 left: TEXT_SAFE_MARGIN, 1228 right: TEXT_SAFE_MARGIN 1229 }); 1230 }, Row); 1231 this.observeComponentCreation2((z6, a7) => { 1232 Text.create(this.button?.text); 1233 Text.focusable(true); 1234 }, Text); 1235 Text.pop(); 1236 Row.pop(); 1237 Button.pop(); 1238 } 1239 createIcon(j6, k6 = null) { 1240 this.observeComponentCreation2((v6, w6) => { 1241 Button.createWithChild({ type: ButtonType.Normal }); 1242 Button.shadow(CLEAR_SHADOW); 1243 Button.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? HitTestMode.Block : HitTestMode.None); 1244 Button.backgroundColor(Color.Transparent); 1245 Button.height(OPERATEITEM_ICON_CLICKABLE_SIZE); 1246 Button.width(OPERATEITEM_ICON_CLICKABLE_SIZE); 1247 Button.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1248 Button.onFocus(() => { 1249 this.parentCanFocus = false; 1250 }); 1251 Button.onHover((x6) => { 1252 this.parentCanHover = false; 1253 if (x6 && this.parentFrontColor === this.hoveringColor && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1254 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1255 } 1256 if (!x6) { 1257 this.parentCanHover = true; 1258 if (this.parentIsHover) { 1259 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1260 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1261 } 1262 } 1263 }); 1264 Button.onClick(j6.icon?.action); 1265 Button.accessibilityLevel(getAccessibilityLevelOnAction(j6.icon?.accessibilityLevel, j6.icon?.action)); 1266 Button.accessibilityText(getAccessibilityText(j6.icon?.accessibilityText ?? '')); 1267 Button.accessibilityDescription(getAccessibilityText(j6.icon?.accessibilityDescription ?? '')); 1268 Button.flexShrink(0); 1269 }, Button); 1270 this.observeComponentCreation2((l6, m6) => { 1271 If.create(); 1272 if (j6.icon?.symbolStyle) { 1273 this.ifElseBranchUpdateFunction(0, () => { 1274 this.observeComponentCreation2((t6, u6) => { 1275 SymbolGlyph.create(); 1276 SymbolGlyph.fontColor([this.iconColor]); 1277 SymbolGlyph.attributeModifier.bind(this)(j6.icon?.symbolStyle); 1278 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1279 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1280 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1281 SymbolGlyph.focusable(true); 1282 SymbolGlyph.draggable(false); 1283 }, SymbolGlyph); 1284 }); 1285 } 1286 else { 1287 this.ifElseBranchUpdateFunction(1, () => { 1288 this.observeComponentCreation2((n6, o6) => { 1289 If.create(); 1290 if (Util.isSymbolResource(j6.icon?.value)) { 1291 this.ifElseBranchUpdateFunction(0, () => { 1292 this.observeComponentCreation2((r6, s6) => { 1293 SymbolGlyph.create(j6.icon?.value); 1294 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1295 SymbolGlyph.fontColor([this.iconColor]); 1296 SymbolGlyph.focusable(true); 1297 SymbolGlyph.draggable(false); 1298 }, SymbolGlyph); 1299 }); 1300 } 1301 else { 1302 this.ifElseBranchUpdateFunction(1, () => { 1303 this.observeComponentCreation2((p6, q6) => { 1304 Image.create(j6.icon?.value); 1305 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1306 Image.width(OPERATEITEM_ICONLIKE_SIZE); 1307 Image.focusable(true); 1308 Image.fillColor(ObservedObject.GetRawObject(this.iconColor)); 1309 Image.draggable(false); 1310 }, Image); 1311 }); 1312 } 1313 }, If); 1314 If.pop(); 1315 }); 1316 } 1317 }, If); 1318 If.pop(); 1319 Button.pop(); 1320 } 1321 createImage(c6 = null) { 1322 this.observeComponentCreation2((d6, e6) => { 1323 If.create(); 1324 if (Util.isSymbolResource(ObservedObject.GetRawObject(this.image))) { 1325 this.ifElseBranchUpdateFunction(0, () => { 1326 this.observeComponentCreation2((h6, i6) => { 1327 SymbolGlyph.create(this.image); 1328 SymbolGlyph.fontSize(`${OPERATEITEM_IMAGE_SIZE}vp`); 1329 SymbolGlyph.draggable(false); 1330 SymbolGlyph.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1331 }, SymbolGlyph); 1332 }); 1333 } 1334 else { 1335 this.ifElseBranchUpdateFunction(1, () => { 1336 this.observeComponentCreation2((f6, g6) => { 1337 Image.create(this.image); 1338 Image.height(OPERATEITEM_IMAGE_SIZE); 1339 Image.width(OPERATEITEM_IMAGE_SIZE); 1340 Image.draggable(false); 1341 Image.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1342 }, Image); 1343 }); 1344 } 1345 }, If); 1346 If.pop(); 1347 } 1348 createSymbol(z5 = null) { 1349 this.observeComponentCreation2((a6, b6) => { 1350 SymbolGlyph.create(); 1351 SymbolGlyph.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.symbolStyle)); 1352 SymbolGlyph.fontSize(`${OPERATEITEM_IMAGE_SIZE}vp`); 1353 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1354 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1355 SymbolGlyph.draggable(false); 1356 SymbolGlyph.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1357 }, SymbolGlyph); 1358 } 1359 createText(w5 = null) { 1360 this.observeComponentCreation2((x5, y5) => { 1361 Text.create(this.text); 1362 Text.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1363 Text.fontSize(ObservedObject.GetRawObject(this.secondaryTextSize)); 1364 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 1365 Text.textOverflow({ 1366 overflow: IS_MARQUEE_OR_ELLIPSIS === TEXT_SUPPORT_MARQUEE ? TextOverflow.MARQUEE : 1367 TextOverflow.None 1368 }); 1369 Text.marqueeOptions({ 1370 start: this.isFocus || this.parentIsHover, 1371 fadeout: true, 1372 marqueeStartPolicy: MarqueeStartPolicy.DEFAULT 1373 }); 1374 Text.maxLines(LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_maxLines_right'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value); 1375 Text.draggable(false); 1376 Text.flexShrink(1); 1377 }, Text); 1378 Text.pop(); 1379 } 1380 createArrow(i5 = null) { 1381 this.observeComponentCreation2((t5, u5) => { 1382 Button.createWithChild({ type: ButtonType.Normal }); 1383 Button.shadow(CLEAR_SHADOW); 1384 Button.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1385 Button.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? 1386 (this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) : HitTestMode.None); 1387 Button.backgroundColor(Color.Transparent); 1388 Button.height(OPERATEITEM_ICONLIKE_SIZE); 1389 Button.width(OPERATEITEM_ARROW_WIDTH); 1390 Button.onFocus(() => { 1391 this.parentCanFocus = false; 1392 }); 1393 Button.stateEffect(this.arrow?.action !== undefined); 1394 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 1395 Button.onHover((v5) => { 1396 if (this.arrow?.action === undefined) { 1397 return; 1398 } 1399 if (v5 && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1400 this.parentCanHover = false; 1401 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1402 } 1403 else { 1404 this.parentCanHover = true; 1405 if (this.parentIsHover) { 1406 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1407 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1408 } 1409 } 1410 }); 1411 Button.onClick(this.arrow?.action); 1412 Button.accessibilityLevel(getAccessibilityLevelOnAction(this.arrow?.accessibilityLevel, this.arrow?.action)); 1413 Button.accessibilityText(getAccessibilityText(this.arrow?.accessibilityText ?? '')); 1414 Button.accessibilityDescription(getAccessibilityText(this.arrow?.accessibilityDescription ?? '')); 1415 }, Button); 1416 this.observeComponentCreation2((j5, k5) => { 1417 If.create(); 1418 if (this.arrow?.symbolStyle) { 1419 this.ifElseBranchUpdateFunction(0, () => { 1420 this.observeComponentCreation2((r5, s5) => { 1421 SymbolGlyph.create(); 1422 SymbolGlyph.fontColor([IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor]); 1423 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 1424 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1425 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1426 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1427 SymbolGlyph.focusable(true); 1428 SymbolGlyph.draggable(false); 1429 }, SymbolGlyph); 1430 }); 1431 } 1432 else { 1433 this.ifElseBranchUpdateFunction(1, () => { 1434 this.observeComponentCreation2((l5, m5) => { 1435 If.create(); 1436 if (Util.isSymbolResource(this.arrow?.value)) { 1437 this.ifElseBranchUpdateFunction(0, () => { 1438 this.observeComponentCreation2((p5, q5) => { 1439 SymbolGlyph.create(this.arrow?.value); 1440 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1441 SymbolGlyph.fontColor([IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor]); 1442 SymbolGlyph.focusable(true); 1443 SymbolGlyph.draggable(false); 1444 }, SymbolGlyph); 1445 }); 1446 } 1447 else { 1448 this.ifElseBranchUpdateFunction(1, () => { 1449 this.observeComponentCreation2((n5, o5) => { 1450 Image.create(this.arrow?.value); 1451 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1452 Image.width(OPERATEITEM_ARROW_WIDTH); 1453 Image.focusable(true); 1454 Image.fillColor(IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor); 1455 Image.draggable(false); 1456 Image.matchTextDirection(true); 1457 }, Image); 1458 }); 1459 } 1460 }, If); 1461 If.pop(); 1462 }); 1463 } 1464 }, If); 1465 If.pop(); 1466 Button.pop(); 1467 } 1468 createRadio(d5 = null) { 1469 this.observeComponentCreation2((e5, f5) => { 1470 Radio.create({ value: '', group: '' }); 1471 Radio.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1472 Radio.checked(this.radioState); 1473 Radio.radioStyle({ 1474 uncheckedBorderColor: this.getUnselectedColor() 1475 }); 1476 Radio.backgroundColor(!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus ? OPERATE_ITEM_BACKGROUND_COLOR : 1477 Color.Transparent); 1478 Radio.borderRadius(OPERATE_ITEM_RADIUS); 1479 Radio.onChange((h5) => { 1480 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 1481 this.radioState = h5; 1482 this.isChecked = h5; 1483 } 1484 if (this.radio?.onChange) { 1485 this.radio?.onChange(h5); 1486 } 1487 }); 1488 Radio.height(OPERATEITEM_ICONLIKE_SIZE); 1489 Radio.width(OPERATEITEM_ICONLIKE_SIZE); 1490 Radio.padding(OPERATEITEM_SELECTIONBOX_PADDING_SIZE); 1491 Radio.onFocus(() => { 1492 this.parentCanFocus = false; 1493 }); 1494 Radio.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? HitTestMode.Block : HitTestMode.None); 1495 Radio.flexShrink(0); 1496 Radio.onHover((g5) => { 1497 this.parentCanHover = false; 1498 if (g5 && this.parentFrontColor === this.hoveringColor && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1499 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1500 } 1501 if (!g5) { 1502 this.parentCanHover = true; 1503 if (this.parentIsHover) { 1504 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1505 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1506 } 1507 } 1508 }); 1509 Radio.accessibilityLevel(getAccessibilityLevelOnChange(this.radio?.accessibilityLevel, this.radio?.onChange)); 1510 Radio.accessibilityText(getAccessibilityText(this.radio?.accessibilityText ?? '')); 1511 Radio.accessibilityDescription(getAccessibilityText(this.radio?.accessibilityDescription ?? '')); 1512 }, Radio); 1513 } 1514 createCheckBox(y4 = null) { 1515 this.observeComponentCreation2((z4, a5) => { 1516 Checkbox.create(); 1517 Checkbox.borderRadius(IS_SUPPORT_SUBCOMPONENT_EVENT ? UNUSUAL : OPERATE_ITEM_RADIUS); 1518 Checkbox.unselectedColor(this.getUnselectedColor()); 1519 Checkbox.backgroundColor(!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus ? OPERATE_ITEM_BACKGROUND_COLOR : 1520 Color.Transparent); 1521 Checkbox.margin({ end: LengthMetrics.vp(LISTITEM_PADDING) }); 1522 Checkbox.select(this.checkBoxState); 1523 Checkbox.onChange((c5) => { 1524 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 1525 this.checkBoxState = c5; 1526 this.isChecked = c5; 1527 } 1528 if (this.checkBox?.onChange) { 1529 this.checkBox?.onChange(c5); 1530 } 1531 }); 1532 Checkbox.height(OPERATEITEM_ICONLIKE_SIZE); 1533 Checkbox.width(OPERATEITEM_ICONLIKE_SIZE); 1534 Checkbox.padding(OPERATEITEM_SELECTIONBOX_PADDING_SIZE); 1535 Checkbox.onFocus(() => { 1536 this.parentCanFocus = false; 1537 }); 1538 Checkbox.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? HitTestMode.Block : HitTestMode.None); 1539 Checkbox.flexShrink(0); 1540 Checkbox.onHover((b5) => { 1541 this.parentCanHover = false; 1542 if (b5 && this.parentFrontColor === this.hoveringColor && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1543 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1544 } 1545 if (!b5) { 1546 this.parentCanHover = true; 1547 if (this.parentIsHover) { 1548 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1549 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1550 } 1551 } 1552 }); 1553 Checkbox.accessibilityLevel(getAccessibilityLevelOnChange(this.checkBox?.accessibilityLevel, this.checkBox?.onChange)); 1554 Checkbox.accessibilityText(getAccessibilityText(this.checkBox?.accessibilityText ?? '')); 1555 Checkbox.accessibilityDescription(getAccessibilityText(this.checkBox?.accessibilityDescription ?? '')); 1556 }, Checkbox); 1557 Checkbox.pop(); 1558 } 1559 createSwitch(r4 = null) { 1560 this.observeComponentCreation2((v4, w4) => { 1561 Row.create(); 1562 Row.margin({ end: LengthMetrics.vp(SWITCH_PADDING) }); 1563 Row.height(OPERATEITEM_ICON_CLICKABLE_SIZE); 1564 Row.width(OPERATEITEM_ICON_CLICKABLE_SIZE); 1565 Row.justifyContent(FlexAlign.Center); 1566 Row.onFocus(() => { 1567 this.parentCanFocus = false; 1568 }); 1569 Row.onHover((x4) => { 1570 this.parentCanHover = false; 1571 if (x4 && this.parentFrontColor === this.hoveringColor && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1572 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1573 } 1574 if (!x4) { 1575 this.parentCanHover = true; 1576 if (this.parentIsHover) { 1577 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1578 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1579 } 1580 } 1581 }); 1582 }, Row); 1583 this.observeComponentCreation2((s4, t4) => { 1584 Toggle.create({ type: ToggleType.Switch, isOn: this.switchState }); 1585 Toggle.borderRadius(IS_SUPPORT_SUBCOMPONENT_EVENT ? UNUSUAL : OPERATE_ITEM_RADIUS); 1586 Toggle.backgroundColor(!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus ? OPERATE_ITEM_BACKGROUND_COLOR : 1587 Color.Transparent); 1588 Toggle.switchPointColor(!IS_SUPPORT_SUBCOMPONENT_EVENT && this.isFocus && !this.switchState ? OPERATE_ITEM_COLOR : 1589 UNUSUAL); 1590 Toggle.onChange((u4) => { 1591 this.switchState = u4; 1592 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 1593 this.isChecked = u4; 1594 } 1595 if (this.switch?.onChange) { 1596 this.switch?.onChange(u4); 1597 } 1598 }); 1599 Toggle.onClick(() => { 1600 this.switchState = !this.switchState; 1601 }); 1602 Toggle.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? HitTestMode.Block : HitTestMode.None); 1603 Toggle.accessibilityLevel(getAccessibilityLevelOnChange(this.switch?.accessibilityLevel, this.switch?.onChange)); 1604 Toggle.accessibilityText(getAccessibilityText(this.switch?.accessibilityText ?? '')); 1605 Toggle.accessibilityDescription(getAccessibilityText(this.switch?.accessibilityDescription ?? '')); 1606 }, Toggle); 1607 Toggle.pop(); 1608 Row.pop(); 1609 } 1610 createTextArrow(j3 = null) { 1611 this.observeComponentCreation2((o4, p4) => { 1612 Button.createWithChild({ type: ButtonType.Normal }); 1613 Button.shadow(CLEAR_SHADOW); 1614 Button.hitTestBehavior(IS_SUPPORT_SUBCOMPONENT_EVENT ? 1615 (this.arrow?.action !== undefined ? HitTestMode.Block : HitTestMode.Transparent) : HitTestMode.None); 1616 Button.labelStyle({ 1617 maxLines: TEXT_MAX_LINE 1618 }); 1619 Button.backgroundColor(Color.Transparent); 1620 Button.constraintSize({ minHeight: TEXT_ARROW_HEIGHT }); 1621 Button.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1622 Button.onFocus(() => { 1623 this.parentCanFocus = false; 1624 }); 1625 Button.padding({ 1626 top: 0, 1627 bottom: 0, 1628 left: 0, 1629 right: 0 1630 }); 1631 Button.stateEffect(this.arrow?.action !== undefined); 1632 Button.hoverEffect(this.arrow?.action !== undefined ? HoverEffect.Auto : HoverEffect.None); 1633 Button.onHover((q4) => { 1634 if (this.arrow?.action === undefined) { 1635 return; 1636 } 1637 if (q4 && IS_SUPPORT_SUBCOMPONENT_EVENT) { 1638 this.parentCanHover = false; 1639 this.parentFrontColor = this.parentIsActive ? this.activedColor : Color.Transparent.toString(); 1640 } 1641 else { 1642 this.parentCanHover = true; 1643 if (this.parentIsHover) { 1644 this.parentFrontColor = this.parentIsHover ? this.hoveringColor : 1645 (this.parentIsActive ? this.activedColor : Color.Transparent.toString()); 1646 } 1647 } 1648 }); 1649 Button.onClick(this.arrow?.action); 1650 Button.accessibilityLevel(getAccessibilityLevelOnAction(this.arrow?.accessibilityLevel, this.arrow?.action)); 1651 Button.accessibilityText(`${this.text} ${getAccessibilityText(this.arrow?.accessibilityText ?? '')}`); 1652 Button.accessibilityDescription(getAccessibilityText(this.arrow?.accessibilityDescription ?? '')); 1653 }, Button); 1654 this.observeComponentCreation2((k3, l3) => { 1655 If.create(); 1656 if (this.parentDirection === FlexDirection.Column) { 1657 this.ifElseBranchUpdateFunction(0, () => { 1658 this.observeComponentCreation2((m4, n4) => { 1659 Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }); 1660 Flex.padding({ 1661 start: LengthMetrics.vp(TEXT_SAFE_MARGIN), 1662 end: LengthMetrics.vp(LISTITEM_PADDING) 1663 }); 1664 }, Flex); 1665 this.observeComponentCreation2((k4, l4) => { 1666 Text.create(this.text); 1667 Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_body2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1668 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColor)); 1669 Text.focusable(true); 1670 Text.draggable(false); 1671 Text.constraintSize({ 1672 maxWidth: `calc(100% - ${OPERATEITEM_ARROW_WIDTH}vp)` 1673 }); 1674 }, Text); 1675 Text.pop(); 1676 this.observeComponentCreation2((a4, b4) => { 1677 If.create(); 1678 if (this.arrow?.symbolStyle) { 1679 this.ifElseBranchUpdateFunction(0, () => { 1680 this.observeComponentCreation2((i4, j4) => { 1681 SymbolGlyph.create(); 1682 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1683 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 1684 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1685 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1686 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1687 SymbolGlyph.focusable(false); 1688 SymbolGlyph.draggable(false); 1689 }, SymbolGlyph); 1690 }); 1691 } 1692 else { 1693 this.ifElseBranchUpdateFunction(1, () => { 1694 this.observeComponentCreation2((c4, d4) => { 1695 If.create(); 1696 if (Util.isSymbolResource(this.arrow?.value)) { 1697 this.ifElseBranchUpdateFunction(0, () => { 1698 this.observeComponentCreation2((g4, h4) => { 1699 SymbolGlyph.create(this.arrow?.value); 1700 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1701 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1702 SymbolGlyph.focusable(false); 1703 SymbolGlyph.draggable(false); 1704 }, SymbolGlyph); 1705 }); 1706 } 1707 else { 1708 this.ifElseBranchUpdateFunction(1, () => { 1709 this.observeComponentCreation2((e4, f4) => { 1710 Image.create(this.arrow?.value); 1711 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1712 Image.width(OPERATEITEM_ARROW_WIDTH); 1713 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1714 Image.focusable(false); 1715 Image.draggable(false); 1716 Image.matchTextDirection(true); 1717 }, Image); 1718 }); 1719 } 1720 }, If); 1721 If.pop(); 1722 }); 1723 } 1724 }, If); 1725 If.pop(); 1726 Flex.pop(); 1727 }); 1728 } 1729 else { 1730 this.ifElseBranchUpdateFunction(1, () => { 1731 this.observeComponentCreation2((y3, z3) => { 1732 Row.create({ space: SPECICAL_ROW_SPACE }); 1733 Row.padding({ 1734 start: LengthMetrics.vp(TEXT_SAFE_MARGIN), 1735 end: LengthMetrics.vp(LISTITEM_PADDING) 1736 }); 1737 }, Row); 1738 this.observeComponentCreation2((w3, x3) => { 1739 Text.create(this.text); 1740 Text.fontSize(ObservedObject.GetRawObject(this.secondaryTextSize)); 1741 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTextColors)); 1742 Text.textOverflow({ 1743 overflow: IS_MARQUEE_OR_ELLIPSIS === TEXT_SUPPORT_MARQUEE ? TextOverflow.MARQUEE : 1744 TextOverflow.None 1745 }); 1746 Text.marqueeOptions({ 1747 start: this.isFocus || this.parentIsHover, 1748 fadeout: true, 1749 marqueeStartPolicy: MarqueeStartPolicy.DEFAULT 1750 }); 1751 Text.maxLines(LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_maxLines_right'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value); 1752 Text.focusable(true); 1753 Text.draggable(false); 1754 Text.constraintSize({ 1755 maxWidth: `calc(100% - ${OPERATEITEM_ARROW_WIDTH + OPERATEITEM_ARROW_MARGIN_WIDTH}vp)` 1756 }); 1757 Text.margin({ right: OPERATEITEM_ARROW_MARGIN_WIDTH }); 1758 }, Text); 1759 Text.pop(); 1760 this.observeComponentCreation2((m3, n3) => { 1761 If.create(); 1762 if (this.arrow?.symbolStyle) { 1763 this.ifElseBranchUpdateFunction(0, () => { 1764 this.observeComponentCreation2((u3, v3) => { 1765 SymbolGlyph.create(); 1766 SymbolGlyph.fontColor([IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.icon_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor]); 1767 SymbolGlyph.attributeModifier.bind(this)(this.arrow?.symbolStyle); 1768 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1769 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1770 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1771 SymbolGlyph.focusable(false); 1772 SymbolGlyph.draggable(false); 1773 }, SymbolGlyph); 1774 }); 1775 } 1776 else { 1777 this.ifElseBranchUpdateFunction(1, () => { 1778 this.observeComponentCreation2((o3, p3) => { 1779 If.create(); 1780 if (Util.isSymbolResource(this.arrow?.value)) { 1781 this.ifElseBranchUpdateFunction(0, () => { 1782 this.observeComponentCreation2((s3, t3) => { 1783 SymbolGlyph.create(this.arrow?.value); 1784 SymbolGlyph.fontSize(`${OPERATEITEM_ICONLIKE_SIZE}vp`); 1785 SymbolGlyph.fontColor([IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.icon_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor]); 1786 SymbolGlyph.focusable(false); 1787 SymbolGlyph.draggable(false); 1788 }, SymbolGlyph); 1789 }); 1790 } 1791 else { 1792 this.ifElseBranchUpdateFunction(1, () => { 1793 this.observeComponentCreation2((q3, r3) => { 1794 Image.create(this.arrow?.value); 1795 Image.height(OPERATEITEM_ICONLIKE_SIZE); 1796 Image.width(OPERATEITEM_ARROW_WIDTH); 1797 Image.fillColor(IS_SUPPORT_SUBCOMPONENT_EVENT ? { 'id': -1, 'type': 10001, params: ['sys.color.icon_fourth'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : this.iconColor); 1798 Image.focusable(false); 1799 Image.draggable(false); 1800 Image.matchTextDirection(true); 1801 }, Image); 1802 }); 1803 } 1804 }, If); 1805 If.pop(); 1806 }); 1807 } 1808 }, If); 1809 If.pop(); 1810 Row.pop(); 1811 }); 1812 } 1813 }, If); 1814 If.pop(); 1815 Button.pop(); 1816 } 1817 getFlexOptions() { 1818 let i3 = { alignItems: ItemAlign.Center }; 1819 if (this.parentDirection === FlexDirection.Column) { 1820 i3.justifyContent = FlexAlign.SpaceBetween; 1821 } 1822 else { 1823 i3.space = { main: LengthMetrics.vp(this.rowSpace) }; 1824 i3.justifyContent = FlexAlign.End; 1825 } 1826 return i3; 1827 } 1828 initialRender() { 1829 this.observeComponentCreation2((g3, h3) => { 1830 Flex.create(this.getFlexOptions()); 1831 Flex.width(this.parentDirection === FlexDirection.Column ? undefined : this.rightWidth); 1832 }, Flex); 1833 this.observeComponentCreation2((c3, d3) => { 1834 If.create(); 1835 if (this.button != null) { 1836 this.ifElseBranchUpdateFunction(0, () => { 1837 this.createButton.bind(this)(); 1838 }); 1839 } 1840 else if (this.symbolStyle != null) { 1841 this.ifElseBranchUpdateFunction(1, () => { 1842 this.createSymbol.bind(this)(); 1843 }); 1844 } 1845 else if (this.image != null) { 1846 this.ifElseBranchUpdateFunction(2, () => { 1847 this.createImage.bind(this)(); 1848 }); 1849 } 1850 else if (this.icon != null && this.text != null) { 1851 this.ifElseBranchUpdateFunction(3, () => { 1852 this.createText.bind(this)(); 1853 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', { icon: () => (this['__icon'] ? this['__icon'] : this['icon']) })); 1854 }); 1855 } 1856 else if (this.arrow != null && this.text == null) { 1857 this.ifElseBranchUpdateFunction(4, () => { 1858 this.createArrow.bind(this)(); 1859 }); 1860 } 1861 else if (this.arrow != null && this.text != null) { 1862 this.ifElseBranchUpdateFunction(5, () => { 1863 this.createTextArrow.bind(this)(); 1864 }); 1865 } 1866 else if (this.text != null) { 1867 this.ifElseBranchUpdateFunction(6, () => { 1868 this.createText.bind(this)(); 1869 }); 1870 } 1871 else if (this.radio != null) { 1872 this.ifElseBranchUpdateFunction(7, () => { 1873 this.createRadio.bind(this)(); 1874 }); 1875 } 1876 else if (this.checkBox != null) { 1877 this.ifElseBranchUpdateFunction(8, () => { 1878 this.createCheckBox.bind(this)(); 1879 }); 1880 } 1881 else if (this.switch != null) { 1882 this.ifElseBranchUpdateFunction(9, () => { 1883 this.createSwitch.bind(this)(); 1884 }); 1885 } 1886 else if (this.icon != null) { 1887 this.ifElseBranchUpdateFunction(10, () => { 1888 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', { icon: () => (this['__icon'] ? this['__icon'] : this['icon']) })); 1889 this.observeComponentCreation2((e3, f3) => { 1890 If.create(); 1891 if (this.subIcon != null) { 1892 this.ifElseBranchUpdateFunction(0, () => { 1893 this.createIcon.bind(this)(makeBuilderParameterProxy('createIcon', { icon: () => (this['__subIcon'] ? this['__subIcon'] : this['subIcon']) })); 1894 }); 1895 } 1896 else { 1897 this.ifElseBranchUpdateFunction(1, () => { 1898 }); 1899 } 1900 }, If); 1901 If.pop(); 1902 }); 1903 } 1904 else { 1905 this.ifElseBranchUpdateFunction(11, () => { 1906 }); 1907 } 1908 }, If); 1909 If.pop(); 1910 Flex.pop(); 1911 } 1912 rerender() { 1913 this.updateDirtyElements(); 1914 } 1915} 1916function getAccessibilityText(x2) { 1917 try { 1918 let b3 = ''; 1919 if (typeof x2 === 'string') { 1920 b3 = x2; 1921 } 1922 else { 1923 b3 = getContext().resourceManager.getStringSync(x2); 1924 } 1925 return b3; 1926 } 1927 catch (y2) { 1928 let z2 = y2.code; 1929 let a3 = y2.message; 1930 hilog.error(0x3900, 'Ace', `getAccessibilityText error, code: ${z2}, message: ${a3}`); 1931 return ''; 1932 } 1933} 1934function getAccessibilityLevelOnChange(v2, w2) { 1935 if (v2) { 1936 return v2; 1937 } 1938 if (w2) { 1939 return ACCESSIBILITY_LEVEL_YES; 1940 } 1941 return ACCESSIBILITY_LEVEL_NO; 1942} 1943function getAccessibilityLevelOnAction(t2, u2) { 1944 if (t2) { 1945 return t2; 1946 } 1947 if (u2) { 1948 return ACCESSIBILITY_LEVEL_YES; 1949 } 1950 return ACCESSIBILITY_LEVEL_NO; 1951} 1952export class ComposeListItem extends ViewPU { 1953 constructor(i2, j2, k2, l2 = -1, m2 = undefined, n2) { 1954 super(i2, k2, l2, n2); 1955 if (typeof m2 === 'function') { 1956 this.paramsGenerator_ = m2; 1957 } 1958 this.__contentItem = new SynchedPropertyObjectOneWayPU(j2.contentItem, this, 'contentItem'); 1959 this.__operateItem = new SynchedPropertyObjectOneWayPU(j2.operateItem, this, 'operateItem'); 1960 this.__frontColor = new ObservedPropertyObjectPU(NORMAL_BG_COLOR, this, 'frontColor'); 1961 this.__borderSize = new ObservedPropertySimplePU(0, this, 'borderSize'); 1962 this.__canFocus = new ObservedPropertySimplePU(false, this, 'canFocus'); 1963 this.__canTouch = new ObservedPropertySimplePU(true, this, 'canTouch'); 1964 this.__canHover = new ObservedPropertySimplePU(true, this, 'canHover'); 1965 this.__isHover = new ObservedPropertySimplePU(false, this, 'isHover'); 1966 this.__itemHeight = new ObservedPropertySimplePU(ItemHeight.FIRST_HEIGHT, this, 'itemHeight'); 1967 this.__isActive = new ObservedPropertySimplePU(false, this, 'isActive'); 1968 this.__hoveringColor = new ObservedPropertyObjectPU('#0d000000', this, 'hoveringColor'); 1969 this.__touchDownColor = new ObservedPropertyObjectPU('#1a000000', this, 'touchDownColor'); 1970 this.__activedColor = new ObservedPropertyObjectPU('#1a0a59f7', this, 'activedColor'); 1971 this.__focusOutlineColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, this, 'focusOutlineColor'); 1972 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 1973 this.__containerDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, 'containerDirection'); 1974 this.__contentItemDirection = new ObservedPropertySimplePU(FlexDirection.Row, this, 'contentItemDirection'); 1975 this.__containerPadding = new ObservedPropertyObjectPU(undefined, this, 'containerPadding'); 1976 this.__textArrowLeftSafeOffset = new ObservedPropertySimplePU(0, this, 'textArrowLeftSafeOffset'); 1977 this.isFollowingSystemFontScale = this.getUIContext().isFollowingSystemFontScale(); 1978 this.maxFontScale = this.getUIContext().getMaxFontScale(); 1979 this.callbackId = undefined; 1980 this.__accessibilityTextBuilder = new ObservedPropertySimplePU('', this, 'accessibilityTextBuilder'); 1981 this.__isFocus = new ObservedPropertySimplePU(false, this, 'isFocus'); 1982 this.__isChecked = new ObservedPropertySimplePU(false, this, 'isChecked'); 1983 this.__isWrapText = new ObservedPropertySimplePU(false, this, 'isWrapText'); 1984 this.envCallback = { 1985 onConfigurationUpdated: (p2) => { 1986 if (p2 === undefined || !this.isFollowingSystemFontScale) { 1987 this.fontSizeScale = 1; 1988 return; 1989 } 1990 try { 1991 this.fontSizeScale = Math.min(this.maxFontScale, p2.fontSizeScale ?? 1); 1992 } 1993 catch (q2) { 1994 let r2 = q2.code; 1995 let s2 = q2.message; 1996 hilog.error(0x3900, 'Ace', `ComposeListItem environmentCallback error: ${r2}, ${s2}`); 1997 } 1998 }, 1999 onMemoryLevel: (o2) => { 2000 } 2001 }; 2002 this.setInitiallyProvidedValue(j2); 2003 this.declareWatch('contentItem', this.onPropChange); 2004 this.declareWatch('operateItem', this.onPropChange); 2005 this.declareWatch('fontSizeScale', this.onFontSizeScaleChange); 2006 this.declareWatch('isWrapText', this.onWrapChange); 2007 this.finalizeConstruction(); 2008 } 2009 setInitiallyProvidedValue(h2) { 2010 if (h2.contentItem === undefined) { 2011 this.__contentItem.set(null); 2012 } 2013 if (h2.operateItem === undefined) { 2014 this.__operateItem.set(null); 2015 } 2016 if (h2.frontColor !== undefined) { 2017 this.frontColor = h2.frontColor; 2018 } 2019 if (h2.borderSize !== undefined) { 2020 this.borderSize = h2.borderSize; 2021 } 2022 if (h2.canFocus !== undefined) { 2023 this.canFocus = h2.canFocus; 2024 } 2025 if (h2.canTouch !== undefined) { 2026 this.canTouch = h2.canTouch; 2027 } 2028 if (h2.canHover !== undefined) { 2029 this.canHover = h2.canHover; 2030 } 2031 if (h2.isHover !== undefined) { 2032 this.isHover = h2.isHover; 2033 } 2034 if (h2.itemHeight !== undefined) { 2035 this.itemHeight = h2.itemHeight; 2036 } 2037 if (h2.isActive !== undefined) { 2038 this.isActive = h2.isActive; 2039 } 2040 if (h2.hoveringColor !== undefined) { 2041 this.hoveringColor = h2.hoveringColor; 2042 } 2043 if (h2.touchDownColor !== undefined) { 2044 this.touchDownColor = h2.touchDownColor; 2045 } 2046 if (h2.activedColor !== undefined) { 2047 this.activedColor = h2.activedColor; 2048 } 2049 if (h2.focusOutlineColor !== undefined) { 2050 this.focusOutlineColor = h2.focusOutlineColor; 2051 } 2052 if (h2.fontSizeScale !== undefined) { 2053 this.fontSizeScale = h2.fontSizeScale; 2054 } 2055 if (h2.containerDirection !== undefined) { 2056 this.containerDirection = h2.containerDirection; 2057 } 2058 if (h2.contentItemDirection !== undefined) { 2059 this.contentItemDirection = h2.contentItemDirection; 2060 } 2061 if (h2.containerPadding !== undefined) { 2062 this.containerPadding = h2.containerPadding; 2063 } 2064 if (h2.textArrowLeftSafeOffset !== undefined) { 2065 this.textArrowLeftSafeOffset = h2.textArrowLeftSafeOffset; 2066 } 2067 if (h2.isFollowingSystemFontScale !== undefined) { 2068 this.isFollowingSystemFontScale = h2.isFollowingSystemFontScale; 2069 } 2070 if (h2.maxFontScale !== undefined) { 2071 this.maxFontScale = h2.maxFontScale; 2072 } 2073 if (h2.callbackId !== undefined) { 2074 this.callbackId = h2.callbackId; 2075 } 2076 if (h2.accessibilityTextBuilder !== undefined) { 2077 this.accessibilityTextBuilder = h2.accessibilityTextBuilder; 2078 } 2079 if (h2.isFocus !== undefined) { 2080 this.isFocus = h2.isFocus; 2081 } 2082 if (h2.isChecked !== undefined) { 2083 this.isChecked = h2.isChecked; 2084 } 2085 if (h2.isWrapText !== undefined) { 2086 this.isWrapText = h2.isWrapText; 2087 } 2088 if (h2.envCallback !== undefined) { 2089 this.envCallback = h2.envCallback; 2090 } 2091 } 2092 updateStateVars(g2) { 2093 this.__contentItem.reset(g2.contentItem); 2094 this.__operateItem.reset(g2.operateItem); 2095 } 2096 purgeVariableDependenciesOnElmtId(f2) { 2097 this.__contentItem.purgeDependencyOnElmtId(f2); 2098 this.__operateItem.purgeDependencyOnElmtId(f2); 2099 this.__frontColor.purgeDependencyOnElmtId(f2); 2100 this.__borderSize.purgeDependencyOnElmtId(f2); 2101 this.__canFocus.purgeDependencyOnElmtId(f2); 2102 this.__canTouch.purgeDependencyOnElmtId(f2); 2103 this.__canHover.purgeDependencyOnElmtId(f2); 2104 this.__isHover.purgeDependencyOnElmtId(f2); 2105 this.__itemHeight.purgeDependencyOnElmtId(f2); 2106 this.__isActive.purgeDependencyOnElmtId(f2); 2107 this.__hoveringColor.purgeDependencyOnElmtId(f2); 2108 this.__touchDownColor.purgeDependencyOnElmtId(f2); 2109 this.__activedColor.purgeDependencyOnElmtId(f2); 2110 this.__focusOutlineColor.purgeDependencyOnElmtId(f2); 2111 this.__fontSizeScale.purgeDependencyOnElmtId(f2); 2112 this.__containerDirection.purgeDependencyOnElmtId(f2); 2113 this.__contentItemDirection.purgeDependencyOnElmtId(f2); 2114 this.__containerPadding.purgeDependencyOnElmtId(f2); 2115 this.__textArrowLeftSafeOffset.purgeDependencyOnElmtId(f2); 2116 this.__accessibilityTextBuilder.purgeDependencyOnElmtId(f2); 2117 this.__isFocus.purgeDependencyOnElmtId(f2); 2118 this.__isChecked.purgeDependencyOnElmtId(f2); 2119 this.__isWrapText.purgeDependencyOnElmtId(f2); 2120 } 2121 aboutToBeDeleted() { 2122 this.__contentItem.aboutToBeDeleted(); 2123 this.__operateItem.aboutToBeDeleted(); 2124 this.__frontColor.aboutToBeDeleted(); 2125 this.__borderSize.aboutToBeDeleted(); 2126 this.__canFocus.aboutToBeDeleted(); 2127 this.__canTouch.aboutToBeDeleted(); 2128 this.__canHover.aboutToBeDeleted(); 2129 this.__isHover.aboutToBeDeleted(); 2130 this.__itemHeight.aboutToBeDeleted(); 2131 this.__isActive.aboutToBeDeleted(); 2132 this.__hoveringColor.aboutToBeDeleted(); 2133 this.__touchDownColor.aboutToBeDeleted(); 2134 this.__activedColor.aboutToBeDeleted(); 2135 this.__focusOutlineColor.aboutToBeDeleted(); 2136 this.__fontSizeScale.aboutToBeDeleted(); 2137 this.__containerDirection.aboutToBeDeleted(); 2138 this.__contentItemDirection.aboutToBeDeleted(); 2139 this.__containerPadding.aboutToBeDeleted(); 2140 this.__textArrowLeftSafeOffset.aboutToBeDeleted(); 2141 this.__accessibilityTextBuilder.aboutToBeDeleted(); 2142 this.__isFocus.aboutToBeDeleted(); 2143 this.__isChecked.aboutToBeDeleted(); 2144 this.__isWrapText.aboutToBeDeleted(); 2145 SubscriberManager.Get().delete(this.id__()); 2146 this.aboutToBeDeletedInternal(); 2147 } 2148 get contentItem() { 2149 return this.__contentItem.get(); 2150 } 2151 set contentItem(e2) { 2152 this.__contentItem.set(e2); 2153 } 2154 get operateItem() { 2155 return this.__operateItem.get(); 2156 } 2157 set operateItem(d2) { 2158 this.__operateItem.set(d2); 2159 } 2160 get frontColor() { 2161 return this.__frontColor.get(); 2162 } 2163 set frontColor(c2) { 2164 this.__frontColor.set(c2); 2165 } 2166 get borderSize() { 2167 return this.__borderSize.get(); 2168 } 2169 set borderSize(b2) { 2170 this.__borderSize.set(b2); 2171 } 2172 get canFocus() { 2173 return this.__canFocus.get(); 2174 } 2175 set canFocus(a2) { 2176 this.__canFocus.set(a2); 2177 } 2178 get canTouch() { 2179 return this.__canTouch.get(); 2180 } 2181 set canTouch(z1) { 2182 this.__canTouch.set(z1); 2183 } 2184 get canHover() { 2185 return this.__canHover.get(); 2186 } 2187 set canHover(y1) { 2188 this.__canHover.set(y1); 2189 } 2190 get isHover() { 2191 return this.__isHover.get(); 2192 } 2193 set isHover(x1) { 2194 this.__isHover.set(x1); 2195 } 2196 get itemHeight() { 2197 return this.__itemHeight.get(); 2198 } 2199 set itemHeight(w1) { 2200 this.__itemHeight.set(w1); 2201 } 2202 get isActive() { 2203 return this.__isActive.get(); 2204 } 2205 set isActive(v1) { 2206 this.__isActive.set(v1); 2207 } 2208 get hoveringColor() { 2209 return this.__hoveringColor.get(); 2210 } 2211 set hoveringColor(u1) { 2212 this.__hoveringColor.set(u1); 2213 } 2214 get touchDownColor() { 2215 return this.__touchDownColor.get(); 2216 } 2217 set touchDownColor(t1) { 2218 this.__touchDownColor.set(t1); 2219 } 2220 get activedColor() { 2221 return this.__activedColor.get(); 2222 } 2223 set activedColor(s1) { 2224 this.__activedColor.set(s1); 2225 } 2226 get focusOutlineColor() { 2227 return this.__focusOutlineColor.get(); 2228 } 2229 set focusOutlineColor(r1) { 2230 this.__focusOutlineColor.set(r1); 2231 } 2232 get fontSizeScale() { 2233 return this.__fontSizeScale.get(); 2234 } 2235 set fontSizeScale(q1) { 2236 this.__fontSizeScale.set(q1); 2237 } 2238 get containerDirection() { 2239 return this.__containerDirection.get(); 2240 } 2241 set containerDirection(p1) { 2242 this.__containerDirection.set(p1); 2243 } 2244 get contentItemDirection() { 2245 return this.__contentItemDirection.get(); 2246 } 2247 set contentItemDirection(o1) { 2248 this.__contentItemDirection.set(o1); 2249 } 2250 get containerPadding() { 2251 return this.__containerPadding.get(); 2252 } 2253 set containerPadding(n1) { 2254 this.__containerPadding.set(n1); 2255 } 2256 get textArrowLeftSafeOffset() { 2257 return this.__textArrowLeftSafeOffset.get(); 2258 } 2259 set textArrowLeftSafeOffset(m1) { 2260 this.__textArrowLeftSafeOffset.set(m1); 2261 } 2262 get accessibilityTextBuilder() { 2263 return this.__accessibilityTextBuilder.get(); 2264 } 2265 set accessibilityTextBuilder(l1) { 2266 this.__accessibilityTextBuilder.set(l1); 2267 } 2268 get isFocus() { 2269 return this.__isFocus.get(); 2270 } 2271 set isFocus(k1) { 2272 this.__isFocus.set(k1); 2273 } 2274 get isChecked() { 2275 return this.__isChecked.get(); 2276 } 2277 set isChecked(j1) { 2278 this.__isChecked.set(j1); 2279 } 2280 get isWrapText() { 2281 return this.__isWrapText.get(); 2282 } 2283 set isWrapText(i1) { 2284 this.__isWrapText.set(i1); 2285 } 2286 onWillApplyTheme(h1) { 2287 this.hoveringColor = h1.colors.interactiveHover; 2288 this.touchDownColor = h1.colors.interactivePressed; 2289 this.activedColor = h1.colors.interactiveActive; 2290 this.focusOutlineColor = h1.colors.interactiveFocus; 2291 } 2292 onWrapChange() { 2293 this.containerPadding = this.getPadding(); 2294 } 2295 onPropChange() { 2296 this.containerDirection = this.decideContainerDirection(); 2297 this.contentItemDirection = this.decideContentItemDirection(); 2298 if (this.contentItem === undefined) { 2299 if (this.operateItem?.image !== undefined || 2300 this.operateItem?.symbolStyle !== undefined || 2301 this.operateItem?.icon !== undefined || 2302 this.operateItem?.subIcon !== undefined) { 2303 this.itemHeight = OPERATEITEM_IMAGE_SIZE + SAFE_LIST_PADDING; 2304 } 2305 return; 2306 } 2307 if (this.contentItem?.secondaryText === undefined && this.contentItem?.description === undefined) { 2308 if (this.contentItem?.icon === undefined) { 2309 this.itemHeight = ItemHeight.FIRST_HEIGHT; 2310 } 2311 else { 2312 this.itemHeight = this.contentItem.iconStyle <= IconType.HEAD_SCULPTURE ? 2313 ItemHeight.SECOND_HEIGHT : 2314 (LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_system_icon_line_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }).value); 2315 } 2316 } 2317 else if (this.contentItem.description === undefined) { 2318 let g1 = this.contentItem.iconStyle; 2319 if (this.contentItem.icon === undefined || 2320 (this.contentItem.icon !== undefined && g1 <= IconType.SYSTEM_ICON)) { 2321 this.itemHeight = ItemHeight.THIRD_HEIGHT; 2322 } 2323 else { 2324 this.itemHeight = g1 === IconType.HEAD_SCULPTURE ? ItemHeight.FOURTH_HEIGHT : APPICON_ITEMLENGTH; 2325 } 2326 } 2327 else { 2328 this.itemHeight = ItemHeight.FIFTH_HEIGHT; 2329 } 2330 if (ICON_SIZE_MAP.get(this.contentItem?.iconStyle) >= this.itemHeight) { 2331 this.itemHeight = ICON_SIZE_MAP.get(this.contentItem?.iconStyle) + SAFE_LIST_PADDING; 2332 } 2333 if (this.operateItem?.arrow && this.operateItem?.text && this.operateItem?.arrow?.action) { 2334 this.accessibilityTextBuilder = ` 2335 ${getAccessibilityText(this.contentItem?.primaryText ?? '')} 2336 ${getAccessibilityText(this.contentItem?.secondaryText ?? '')} 2337 ${getAccessibilityText(this.contentItem?.description ?? '')} 2338 `; 2339 } 2340 else { 2341 this.accessibilityTextBuilder = ` 2342 ${getAccessibilityText(this.contentItem?.primaryText ?? '')} 2343 ${getAccessibilityText(this.contentItem?.secondaryText ?? '')} 2344 ${getAccessibilityText(this.contentItem?.description ?? '')} 2345 ${getAccessibilityText(this.operateItem?.text ?? '')} 2346 `; 2347 } 2348 } 2349 aboutToAppear() { 2350 this.fontSizeScale = this.decideFontSizeScale(); 2351 this.onPropChange(); 2352 try { 2353 this.callbackId = getContext()?.getApplicationContext()?.on('environment', this.envCallback); 2354 } 2355 catch (d1) { 2356 let e1 = d1.code; 2357 let f1 = d1.message; 2358 hilog.error(0x3900, 'Ace', `ComposeListItem Faild to get environment param error: ${e1}, ${f1}`); 2359 } 2360 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 2361 this.onFontSizeScaleChange(); 2362 } 2363 } 2364 aboutToDisappear() { 2365 if (this.callbackId) { 2366 this.getUIContext() 2367 ?.getHostContext() 2368 ?.getApplicationContext() 2369 ?.off('environment', this.callbackId); 2370 this.callbackId = void (0); 2371 } 2372 } 2373 calculatedRightWidth() { 2374 if (this.operateItem?.text || this.operateItem?.button) { 2375 return RIGHT_PART_WIDTH; 2376 } 2377 if (this.operateItem?.switch) { 2378 return RIGHT_ONLY_SWITCH_WIDTH; 2379 } 2380 else if (this.operateItem?.checkbox) { 2381 return RIGHT_ONLY_CHECKBOX_WIDTH; 2382 } 2383 else if (this.operateItem?.radio) { 2384 return RIGHT_ONLY_RADIO_WIDTH; 2385 } 2386 else if (this.operateItem?.icon) { 2387 if (this.operateItem?.subIcon) { 2388 return RIGHT_ICON_SUB_ICON_WIDTH; 2389 } 2390 return RIGHT_ONLY_ICON_WIDTH; 2391 } 2392 else if (this.operateItem?.symbolStyle) { 2393 return RIGHT_ONLY_IMAGE_WIDTH; 2394 } 2395 else if (this.operateItem?.image) { 2396 return RIGHT_ONLY_IMAGE_WIDTH; 2397 } 2398 else if (this.operateItem?.arrow) { 2399 return RIGHT_ONLY_ARROW_WIDTH; 2400 } 2401 return RIGHT_CONTENT_NULL_RIGHTWIDTH; 2402 } 2403 decideContentItemDirection() { 2404 if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1 && 2405 this.contentItem?.iconStyle && this.contentItem?.iconStyle > IconType.HEAD_SCULPTURE) { 2406 return FlexDirection.Column; 2407 } 2408 return FlexDirection.Row; 2409 } 2410 decideContainerDirection() { 2411 if (this.fontSizeScale < FontSizeScaleLevel.LEVEL1 || !this.contentItem) { 2412 return FlexDirection.Row; 2413 } 2414 if (this.operateItem?.button) { 2415 return FlexDirection.Column; 2416 } 2417 else if (this.operateItem?.symbolStyle) { 2418 return FlexDirection.Row; 2419 } 2420 else if (this.operateItem?.image) { 2421 return FlexDirection.Row; 2422 } 2423 else if (this.operateItem?.icon && this.operateItem?.text) { 2424 return FlexDirection.Column; 2425 } 2426 else if (this.operateItem?.arrow) { 2427 if (!this.operateItem?.text) { 2428 return FlexDirection.Row; 2429 } 2430 this.textArrowLeftSafeOffset = TEXT_SAFE_MARGIN; 2431 return FlexDirection.Column; 2432 } 2433 else if (this.operateItem?.text) { 2434 return FlexDirection.Column; 2435 } 2436 else { 2437 return FlexDirection.Row; 2438 } 2439 } 2440 onFontSizeScaleChange() { 2441 this.containerDirection = this.decideContainerDirection(); 2442 this.contentItemDirection = this.decideContentItemDirection(); 2443 if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL3) { 2444 this.containerPadding = { 2445 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2446 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2447 }; 2448 } 2449 else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL2) { 2450 this.containerPadding = { 2451 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2452 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2453 }; 2454 } 2455 else if (this.fontSizeScale >= FontSizeScaleLevel.LEVEL1) { 2456 this.containerPadding = { 2457 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2458 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2459 }; 2460 } 2461 else { 2462 this.containerPadding = this.getPadding(); 2463 } 2464 } 2465 isSingleLine() { 2466 return !this.contentItem?.secondaryText && !this.contentItem?.description; 2467 } 2468 getOperateOffset() { 2469 if (this.containerDirection === FlexDirection.Row) { 2470 return LengthMetrics.vp(0); 2471 } 2472 let c1 = ICON_SIZE_MAP.get(this.contentItem?.iconStyle); 2473 if (this.contentItem?.icon && c1 && c1 <= HEADSCULPTURE_SIZE) { 2474 return LengthMetrics.vp(c1 + NORMAL_ITEM_ROW_SPACE + LISTITEM_PADDING - this.textArrowLeftSafeOffset); 2475 } 2476 return LengthMetrics.vp(LISTITEM_PADDING - this.textArrowLeftSafeOffset); 2477 } 2478 getMainSpace() { 2479 if (this.containerDirection === FlexDirection.Column) { 2480 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__' }); 2481 } 2482 return LengthMetrics.vp(0); 2483 } 2484 getFlexOptions() { 2485 if (this.containerDirection === FlexDirection.Column) { 2486 return { 2487 space: { main: this.getMainSpace() }, 2488 justifyContent: FlexAlign.Center, 2489 alignItems: ItemAlign.Start, 2490 direction: this.containerDirection, 2491 }; 2492 } 2493 return { 2494 justifyContent: FlexAlign.SpaceBetween, 2495 alignItems: ItemAlign.Center, 2496 direction: this.containerDirection, 2497 }; 2498 } 2499 decideFontSizeScale() { 2500 if (!this.isFollowingSystemFontScale) { 2501 return 1; 2502 } 2503 return Math.min(this.maxFontScale, this.getUIContext().getHostContext()?.config.fontSizeScale ?? 1); 2504 } 2505 getPadding() { 2506 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 2507 let z = LengthMetrics.resource(ITEM_PADDING).value; 2508 let a1 = z > LISTITEM_PADDING; 2509 let b1 = a1 ? z - LISTITEM_PADDING : 0; 2510 return { 2511 top: this.isWrapText ? z : 0, 2512 bottom: this.isWrapText ? z : 0, 2513 left: b1, 2514 right: b1 2515 }; 2516 } 2517 else { 2518 return undefined; 2519 } 2520 } 2521 initialRender() { 2522 this.observeComponentCreation2((x, y) => { 2523 Stack.create(); 2524 Stack.width('100%'); 2525 Stack.accessibilityGroup(true); 2526 Stack.accessibilityText(this.accessibilityTextBuilder); 2527 Stack.onFocus(() => { 2528 this.isFocus = true; 2529 this.frontColor = FOCUSED_BG_COLOR; 2530 }); 2531 Stack.onBlur(() => { 2532 this.isFocus = false; 2533 this.frontColor = NORMAL_BG_COLOR; 2534 }); 2535 Stack.borderRadius(IS_SUPPORT_SUBCOMPONENT_EVENT ? undefined : { 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 2536 Stack.onClick(IS_SUPPORT_SUBCOMPONENT_EVENT ? undefined : () => { 2537 this.isChecked = this.operateItem?.radio ? true : !this.isChecked; 2538 if (this.operateItem?.icon && this.operateItem.icon?.action) { 2539 this.operateItem.icon.action(); 2540 } 2541 if (this.operateItem?.subIcon && this.operateItem.subIcon?.action) { 2542 this.operateItem.subIcon.action(); 2543 } 2544 if (this.operateItem?.arrow && this.operateItem.arrow?.action) { 2545 this.operateItem.arrow.action(); 2546 } 2547 }); 2548 Stack.scale({ 2549 x: IS_SUPPORT_SUBCOMPONENT_EVENT ? undefined : (this.isFocus ? FOCUSED_ITEM_SCALE : RECOVER_ITEM_SCALE), 2550 y: IS_SUPPORT_SUBCOMPONENT_EVENT ? undefined : (this.isFocus ? FOCUSED_ITEM_SCALE : RECOVER_ITEM_SCALE) 2551 }); 2552 Stack.shadow(IS_SUPPORT_SUBCOMPONENT_EVENT ? undefined : (this.isFocus ? FOCUSED_SHADOW : NORMAL_SHADOW)); 2553 Stack.margin({ 2554 left: !IS_SUPPORT_SUBCOMPONENT_EVENT ? STACK_PADDING : undefined, 2555 right: !IS_SUPPORT_SUBCOMPONENT_EVENT ? STACK_PADDING : undefined 2556 }); 2557 Stack.padding({ 2558 left: IS_SUPPORT_SUBCOMPONENT_EVENT ? STACK_PADDING : 0, 2559 right: IS_SUPPORT_SUBCOMPONENT_EVENT ? STACK_PADDING : 0 2560 }); 2561 }, Stack); 2562 this.observeComponentCreation2((u, v) => { 2563 Flex.create(this.getFlexOptions()); 2564 Flex.height(this.containerDirection === FlexDirection.Column ? 'auto' : undefined); 2565 Flex.constraintSize({ 2566 minHeight: this.itemHeight 2567 }); 2568 Flex.focusable(IS_SUPPORT_SUBCOMPONENT_EVENT); 2569 Flex.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 2570 Flex.backgroundColor(ObservedObject.GetRawObject(this.frontColor)); 2571 Flex.onFocus(() => { 2572 this.canFocus = true; 2573 }); 2574 Flex.onBlur(() => { 2575 this.canFocus = false; 2576 }); 2577 Flex.onHover((w) => { 2578 if (this.isFocus && !IS_SUPPORT_SUBCOMPONENT_EVENT) { 2579 this.isHover = false; 2580 return; 2581 } 2582 this.isHover = w; 2583 if (this.canHover) { 2584 this.frontColor = w ? this.hoveringColor : 2585 (this.isActive ? this.activedColor : Color.Transparent.toString()); 2586 } 2587 if (!IS_SUPPORT_SUBCOMPONENT_EVENT) { 2588 this.frontColor = w ? this.hoveringColor : NORMAL_BG_COLOR; 2589 } 2590 }); 2591 ViewStackProcessor.visualState('focused'); 2592 Flex.border({ 2593 radius: { 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2594 width: ITEM_BORDER_SHOWN, 2595 color: this.focusOutlineColor, 2596 style: BorderStyle.Solid 2597 }); 2598 ViewStackProcessor.visualState('normal'); 2599 Flex.border({ 2600 radius: { 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_radius'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2601 color: { 'id': -1, 'type': 10001, params: ['sys.color.composeListItem_stroke_normal_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2602 width: { 'id': -1, 'type': 10002, params: ['sys.float.composeListItem_stroke_normal_thickness'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 2603 }); 2604 ViewStackProcessor.visualState('pressed'); 2605 Flex.backgroundColor(ObservedObject.GetRawObject(this.touchDownColor)); 2606 ViewStackProcessor.visualState(); 2607 Flex.padding(ObservedObject.GetRawObject(this.containerPadding)); 2608 }, Flex); 2609 this.observeComponentCreation2((o, p) => { 2610 If.create(); 2611 if (this.contentItem === null) { 2612 this.ifElseBranchUpdateFunction(0, () => { 2613 { 2614 this.observeComponentCreation2((q, r) => { 2615 if (r) { 2616 let s = new ContentItemStruct(this, { 2617 isWrapText: this.__isWrapText 2618 }, undefined, q, () => { }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1404, col: 11 }); 2619 ViewPU.create(s); 2620 let t = () => { 2621 return { 2622 isWrapText: this.isWrapText 2623 }; 2624 }; 2625 s.paramsGenerator_ = t; 2626 } 2627 else { 2628 this.updateStateVarsOfChildByElmtId(q, {}); 2629 } 2630 }, { name: 'ContentItemStruct' }); 2631 } 2632 }); 2633 } 2634 else { 2635 this.ifElseBranchUpdateFunction(1, () => { 2636 }); 2637 } 2638 }, If); 2639 If.pop(); 2640 this.observeComponentCreation2((i, j) => { 2641 If.create(); 2642 if (this.contentItem !== null) { 2643 this.ifElseBranchUpdateFunction(0, () => { 2644 { 2645 this.observeComponentCreation2((k, l) => { 2646 if (l) { 2647 let m = new ContentItemStruct(this, { 2648 icon: this.contentItem?.icon, 2649 symbolStyle: this.contentItem?.symbolStyle, 2650 iconStyle: this.contentItem?.iconStyle, 2651 primaryText: this.contentItem?.primaryText, 2652 secondaryText: this.contentItem?.secondaryText, 2653 description: this.contentItem?.description, 2654 fontSizeScale: this.fontSizeScale, 2655 parentDirection: this.containerDirection, 2656 itemDirection: this.contentItemDirection, 2657 isFocus: this.isFocus, 2658 itemHeight: this.itemHeight, 2659 isWrapText: this.__isWrapText 2660 }, undefined, k, () => { }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1409, col: 11 }); 2661 ViewPU.create(m); 2662 let n = () => { 2663 return { 2664 icon: this.contentItem?.icon, 2665 symbolStyle: this.contentItem?.symbolStyle, 2666 iconStyle: this.contentItem?.iconStyle, 2667 primaryText: this.contentItem?.primaryText, 2668 secondaryText: this.contentItem?.secondaryText, 2669 description: this.contentItem?.description, 2670 fontSizeScale: this.fontSizeScale, 2671 parentDirection: this.containerDirection, 2672 itemDirection: this.contentItemDirection, 2673 isFocus: this.isFocus, 2674 itemHeight: this.itemHeight, 2675 isWrapText: this.isWrapText 2676 }; 2677 }; 2678 m.paramsGenerator_ = n; 2679 } 2680 else { 2681 this.updateStateVarsOfChildByElmtId(k, { 2682 icon: this.contentItem?.icon, 2683 symbolStyle: this.contentItem?.symbolStyle, 2684 iconStyle: this.contentItem?.iconStyle, 2685 primaryText: this.contentItem?.primaryText, 2686 secondaryText: this.contentItem?.secondaryText, 2687 description: this.contentItem?.description, 2688 fontSizeScale: this.fontSizeScale, 2689 parentDirection: this.containerDirection, 2690 itemDirection: this.contentItemDirection, 2691 isFocus: this.isFocus, 2692 itemHeight: this.itemHeight 2693 }); 2694 } 2695 }, { name: 'ContentItemStruct' }); 2696 } 2697 }); 2698 } 2699 else { 2700 this.ifElseBranchUpdateFunction(1, () => { 2701 }); 2702 } 2703 }, If); 2704 If.pop(); 2705 this.observeComponentCreation2((a, b) => { 2706 If.create(); 2707 if (this.operateItem !== null) { 2708 this.ifElseBranchUpdateFunction(0, () => { 2709 this.observeComponentCreation2((g, h) => { 2710 __Common__.create(); 2711 __Common__.flexShrink(0); 2712 __Common__.onFocus(() => { 2713 this.canFocus = false; 2714 }); 2715 __Common__.onBlur(() => { 2716 this.canFocus = true; 2717 }); 2718 __Common__.padding({ start: this.getOperateOffset() }); 2719 }, __Common__); 2720 { 2721 this.observeComponentCreation2((c, d) => { 2722 if (d) { 2723 let e = new OperateItemStruct(this, { 2724 icon: this.operateItem?.icon, 2725 subIcon: this.operateItem?.subIcon, 2726 button: this.operateItem?.button, 2727 switch: this.operateItem?.switch, 2728 checkBox: this.operateItem?.checkbox, 2729 radio: this.operateItem?.radio, 2730 image: this.operateItem?.image, 2731 symbolStyle: this.operateItem?.symbolStyle, 2732 text: this.operateItem?.text, 2733 arrow: this.operateItem?.arrow, 2734 parentCanFocus: this.__canFocus, 2735 parentCanTouch: this.__canTouch, 2736 parentIsHover: this.__isHover, 2737 parentFrontColor: this.__frontColor, 2738 parentIsActive: this.__isActive, 2739 parentCanHover: this.__canHover, 2740 rightWidth: this.calculatedRightWidth(), 2741 parentDirection: this.__containerDirection, 2742 isFocus: this.__isFocus, 2743 isChecked: this.__isChecked, 2744 }, undefined, c, () => { }, { page: 'library/src/main/ets/components/composelistitem.ets', line: 1425, col: 11 }); 2745 ViewPU.create(e); 2746 let f = () => { 2747 return { 2748 icon: this.operateItem?.icon, 2749 subIcon: this.operateItem?.subIcon, 2750 button: this.operateItem?.button, 2751 switch: this.operateItem?.switch, 2752 checkBox: this.operateItem?.checkbox, 2753 radio: this.operateItem?.radio, 2754 image: this.operateItem?.image, 2755 symbolStyle: this.operateItem?.symbolStyle, 2756 text: this.operateItem?.text, 2757 arrow: this.operateItem?.arrow, 2758 parentCanFocus: this.canFocus, 2759 parentCanTouch: this.canTouch, 2760 parentIsHover: this.isHover, 2761 parentFrontColor: this.frontColor, 2762 parentIsActive: this.isActive, 2763 parentCanHover: this.canHover, 2764 rightWidth: this.calculatedRightWidth(), 2765 parentDirection: this.containerDirection, 2766 isFocus: this.isFocus, 2767 isChecked: this.isChecked 2768 }; 2769 }; 2770 e.paramsGenerator_ = f; 2771 } 2772 else { 2773 this.updateStateVarsOfChildByElmtId(c, { 2774 icon: this.operateItem?.icon, 2775 subIcon: this.operateItem?.subIcon, 2776 button: this.operateItem?.button, 2777 switch: this.operateItem?.switch, 2778 checkBox: this.operateItem?.checkbox, 2779 radio: this.operateItem?.radio, 2780 image: this.operateItem?.image, 2781 symbolStyle: this.operateItem?.symbolStyle, 2782 text: this.operateItem?.text, 2783 arrow: this.operateItem?.arrow, 2784 rightWidth: this.calculatedRightWidth() 2785 }); 2786 } 2787 }, { name: 'OperateItemStruct' }); 2788 } 2789 __Common__.pop(); 2790 }); 2791 } 2792 else { 2793 this.ifElseBranchUpdateFunction(1, () => { 2794 }); 2795 } 2796 }, If); 2797 If.pop(); 2798 Flex.pop(); 2799 Stack.pop(); 2800 } 2801 rerender() { 2802 this.updateDirtyElements(); 2803 } 2804} 2805 2806export default { 2807 IconType, ComposeListItem 2808};