1/* 2 * Copyright (c) 2023-2023 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 16export var IconType; 17!function(e){ 18 e[e.BADGE=1] = "BADGE"; 19 e[e.NORMAL_ICON=2] = "NORMAL_ICON"; 20 e[e.SYSTEM_ICON=3] = "SYSTEM_ICON"; 21 e[e.HEAD_SCULPTURE=4] = "HEAD_SCULPTURE"; 22 e[e.APP_ICON=5] = "APP_ICON"; 23 e[e.PREVIEW=6] = "PREVIEW"; 24 e[e.LONGITUDINAL=7] = "LONGITUDINAL"; 25 e[e.VERTICAL=8] = "VERTICAL" 26}(IconType || (IconType = {})); 27var ItemHeight; 28!function(e){ 29 e[e.FIRST_HEIGHT=48] = "FIRST_HEIGHT"; 30 e[e.SECOND_HEIGHT=56] = "SECOND_HEIGHT"; 31 e[e.THIRD_HEIGHT=64] = "THIRD_HEIGHT"; 32 e[e.FOURTH_HEIGHT=72] = "FOURTH_HEIGHT"; 33 e[e.FIFTH_HEIGHT=96] = "FIFTH_HEIGHT" 34}(ItemHeight || (ItemHeight = {})); 35const LISTITEMCARD_BORDER_HIDDEN = 0; 36const TEXT_MAX_LINE = 1; 37const LISTITEMCARD_BORDER_SHOWN = 2; 38const TEXT_COLUMN_SPACE = 2; 39const TEXT_SAFE_MARGIN = 8; 40const BADGE_SIZE = 8; 41const SMALL_ICON_SIZE = 16; 42const SYSTEM_ICON_SIZE = 24; 43const SAFE_LIST_PADDING = 32; 44const HEADSCULPTURE_SIZE = 40; 45const BUTTON_SIZE = 28; 46const APP_ICON_SIZE = 64; 47const PREVIEW_SIZE = 96; 48const LONGITUDINAL_SIZE = 96; 49const VERTICAL_SIZE = 96; 50const NORMAL_ITEM_ROW_SPACE = 16; 51const SPECIAL_ITEM_ROW_SPACE = 0; 52const SPECIAL_ICON_SIZE = 0; 53const DEFAULT_ROW_SPACE = 0; 54const SPECICAL_ROW_SPACE = 4; 55const OPERATEITEM_ICONLIKE_SIZE = 24; 56const OPERATEITEM_ARROW_WIDTH = 12; 57const OPERATEITEM_ICON_CLICKABLE_SIZE = 48; 58const OPERATEITEM_IMAGE_SIZE = 48; 59const HOVERING_COLOR = "#0d000000"; 60const TOUCH_DOWN_COLOR = "#1a000000"; 61const ACTIVED_COLOR = "#1a0a59f7"; 62 63class ContentItemStruct extends ViewPU { 64 constructor(e, t, o, i = -1) { 65 super(e, o, i); 66 this.iconStyle = null; 67 this.icon = null; 68 this.title = null; 69 this.subtitle = null; 70 this.description = null; 71 this.iconSizeMap = new Map([[IconType.BADGE, 8], [IconType.NORMAL_ICON, 16], [IconType.SYSTEM_ICON, 24], [IconType.HEAD_SCULPTURE, 40], [IconType.APP_ICON, 64], [IconType.PREVIEW, 96], [IconType.LONGITUDINAL, 96], [IconType.VERTICAL, 96]]); 72 this.itemHeight = ItemHeight.FIRST_HEIGHT; 73 this.itemRowSpace = 16; 74 this.setInitiallyProvidedValue(t) 75 } 76 77 setInitiallyProvidedValue(e) { 78 void 0 !== e.iconStyle && (this.iconStyle = e.iconStyle); 79 void 0 !== e.icon && (this.icon = e.icon); 80 void 0 !== e.title && (this.title = e.title); 81 void 0 !== e.subtitle && (this.subtitle = e.subtitle); 82 void 0 !== e.description && (this.description = e.description); 83 void 0 !== e.iconSizeMap && (this.iconSizeMap = e.iconSizeMap); 84 void 0 !== e.itemHeight && (this.itemHeight = e.itemHeight); 85 void 0 !== e.itemRowSpace && (this.itemRowSpace = e.itemRowSpace) 86 } 87 88 updateStateVars(e) { 89 } 90 91 purgeVariableDependenciesOnElmtId(e) { 92 } 93 94 aboutToBeDeleted() { 95 SubscriberManager.Get().delete(this.id__()); 96 this.aboutToBeDeletedInternal() 97 } 98 99 aboutToAppear() { 100 null == this.subtitle && null == this.description ? null == this.icon ? this.itemHeight = ItemHeight.FIRST_HEIGHT : this.itemHeight = this.iconStyle <= IconType.HEAD_SCULPTURE ? ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT : null == this.description ? null == this.icon || null != this.icon && this.iconStyle <= IconType.SYSTEM_ICON ? this.itemHeight = ItemHeight.THIRD_HEIGHT : this.itemHeight = ItemHeight.FOURTH_HEIGHT : this.itemHeight = ItemHeight.FIFTH_HEIGHT; 101 null == this.icon && null == this.iconStyle && (this.itemRowSpace = 0); 102 this.iconSizeMap.get(this.iconStyle) >= this.itemHeight && (this.itemHeight = this.iconSizeMap.get(this.iconStyle) + 32) 103 } 104 105 createIcon(e = null) { 106 this.observeComponentCreation(((e, t) => { 107 ViewStackProcessor.StartGetAccessRecordingFor(e); 108 If.create(); 109 null != this.icon && null != this.iconStyle ? this.ifElseBranchUpdateFunction(0, (() => { 110 this.observeComponentCreation(((e, t) => { 111 ViewStackProcessor.StartGetAccessRecordingFor(e); 112 If.create(); 113 this.iconStyle <= IconType.PREVIEW ? this.ifElseBranchUpdateFunction(0, (() => { 114 this.observeComponentCreation(((e, t) => { 115 ViewStackProcessor.StartGetAccessRecordingFor(e); 116 Image.create(this.icon); 117 Image.objectFit(ImageFit.Contain); 118 Image.width(this.iconSizeMap.get(this.iconStyle)); 119 Image.height(this.iconSizeMap.get(this.iconStyle)); 120 Image.borderRadius({ 121 id: -1, 122 type: 10002, 123 params: ["sys.float.ohos_id_corner_radius_default_m"], 124 bundleName: "", 125 moduleName: "" 126 }); 127 Image.focusable(!0); 128 t || Image.pop(); 129 ViewStackProcessor.StopGetAccessRecording() 130 })) 131 })) : this.ifElseBranchUpdateFunction(1, (() => { 132 this.observeComponentCreation(((e, t) => { 133 ViewStackProcessor.StartGetAccessRecordingFor(e); 134 Image.create(this.icon); 135 Image.objectFit(ImageFit.Contain); 136 Image.constraintSize({ 137 minWidth: 0, 138 maxWidth: this.iconSizeMap.get(this.iconStyle), 139 minHeight: 0, 140 maxHeight: this.iconSizeMap.get(this.iconStyle) 141 }); 142 Image.borderRadius({ 143 id: -1, 144 type: 10002, 145 params: ["sys.float.ohos_id_corner_radius_default_m"], 146 bundleName: "", 147 moduleName: "" 148 }); 149 Image.focusable(!0); 150 t || Image.pop(); 151 ViewStackProcessor.StopGetAccessRecording() 152 })) 153 })); 154 t || If.pop(); 155 ViewStackProcessor.StopGetAccessRecording() 156 })); 157 If.pop() 158 })) : If.branchId(1); 159 t || If.pop(); 160 ViewStackProcessor.StopGetAccessRecording() 161 })); 162 If.pop() 163 } 164 165 createText(e = null) { 166 this.observeComponentCreation(((e, t) => { 167 ViewStackProcessor.StartGetAccessRecordingFor(e); 168 Column.create({ space: 2 }); 169 Column.margin({ top: 8, bottom: 8 }); 170 Column.alignItems(HorizontalAlign.Start); 171 t || Column.pop(); 172 ViewStackProcessor.StopGetAccessRecording() 173 })); 174 this.observeComponentCreation(((e, t) => { 175 ViewStackProcessor.StartGetAccessRecordingFor(e); 176 Text.create(this.title); 177 Text.fontSize({ 178 id: -1, 179 type: 10002, 180 params: ["sys.float.ohos_id_text_size_body1"], 181 bundleName: "", 182 moduleName: "" 183 }); 184 Text.fontColor({ 185 id: -1, 186 type: 10001, 187 params: ["sys.color.ohos_id_color_text_primary"], 188 bundleName: "", 189 moduleName: "" 190 }); 191 Text.maxLines(1); 192 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 193 Text.focusable(!0); 194 t || Text.pop(); 195 ViewStackProcessor.StopGetAccessRecording() 196 })); 197 Text.pop(); 198 this.observeComponentCreation(((e, t) => { 199 ViewStackProcessor.StartGetAccessRecordingFor(e); 200 If.create(); 201 null != this.subtitle ? this.ifElseBranchUpdateFunction(0, (() => { 202 this.observeComponentCreation(((e, t) => { 203 ViewStackProcessor.StartGetAccessRecordingFor(e); 204 Text.create(this.subtitle); 205 Text.fontSize({ 206 id: -1, 207 type: 10002, 208 params: ["sys.float.ohos_id_text_size_body2"], 209 bundleName: "", 210 moduleName: "" 211 }); 212 Text.fontColor({ 213 id: -1, 214 type: 10001, 215 params: ["sys.color.ohos_id_color_text_secondary"], 216 bundleName: "", 217 moduleName: "" 218 }); 219 Text.maxLines(1); 220 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 221 Text.focusable(!0); 222 t || Text.pop(); 223 ViewStackProcessor.StopGetAccessRecording() 224 })); 225 Text.pop() 226 })) : If.branchId(1); 227 t || If.pop(); 228 ViewStackProcessor.StopGetAccessRecording() 229 })); 230 If.pop(); 231 this.observeComponentCreation(((e, t) => { 232 ViewStackProcessor.StartGetAccessRecordingFor(e); 233 If.create(); 234 null != this.description ? this.ifElseBranchUpdateFunction(0, (() => { 235 this.observeComponentCreation(((e, t) => { 236 ViewStackProcessor.StartGetAccessRecordingFor(e); 237 Text.create(this.description); 238 Text.fontSize({ 239 id: -1, 240 type: 10002, 241 params: ["sys.float.ohos_id_text_size_body2"], 242 bundleName: "", 243 moduleName: "" 244 }); 245 Text.fontColor({ 246 id: -1, 247 type: 10001, 248 params: ["sys.color.ohos_id_color_text_secondary"], 249 bundleName: "", 250 moduleName: "" 251 }); 252 Text.maxLines(1); 253 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 254 Text.focusable(!0); 255 t || Text.pop(); 256 ViewStackProcessor.StopGetAccessRecording() 257 })); 258 Text.pop() 259 })) : If.branchId(1); 260 t || If.pop(); 261 ViewStackProcessor.StopGetAccessRecording() 262 })); 263 If.pop(); 264 Column.pop() 265 } 266 267 initialRender() { 268 this.observeComponentCreation(((e, t) => { 269 ViewStackProcessor.StartGetAccessRecordingFor(e); 270 Row.create({ space: this.itemRowSpace }); 271 Row.height(this.itemHeight); 272 t || Row.pop(); 273 ViewStackProcessor.StopGetAccessRecording() 274 })); 275 this.createIcon.bind(this)(); 276 this.createText.bind(this)(); 277 Row.pop() 278 } 279 280 rerender() { 281 this.updateDirtyElements() 282 } 283} 284 285class OperateItemStruct extends ViewPU { 286 constructor(e, t, o, i = -1) { 287 super(e, o, i); 288 this.arrow = null; 289 this.icon = null; 290 this.subIcon = null; 291 this.button = null; 292 this.switch = null; 293 this.checkBox = null; 294 this.radio = null; 295 this.image = null; 296 this.text = null; 297 this.__switchState = new ObservedPropertySimplePU(!1, this, "switchState"); 298 this.__radioState = new ObservedPropertySimplePU(!1, this, "radioState"); 299 this.__checkBoxState = new ObservedPropertySimplePU(!1, this, "checkBoxState"); 300 this.rowSpace = 0; 301 this.setInitiallyProvidedValue(t) 302 } 303 304 setInitiallyProvidedValue(e) { 305 void 0 !== e.arrow && (this.arrow = e.arrow); 306 void 0 !== e.icon && (this.icon = e.icon); 307 void 0 !== e.subIcon && (this.subIcon = e.subIcon); 308 void 0 !== e.button && (this.button = e.button); 309 void 0 !== e.switch && (this.switch = e.switch); 310 void 0 !== e.checkBox && (this.checkBox = e.checkBox); 311 void 0 !== e.radio && (this.radio = e.radio); 312 void 0 !== e.image && (this.image = e.image); 313 void 0 !== e.text && (this.text = e.text); 314 void 0 !== e.switchState && (this.switchState = e.switchState); 315 void 0 !== e.radioState && (this.radioState = e.radioState); 316 void 0 !== e.checkBoxState && (this.checkBoxState = e.checkBoxState); 317 void 0 !== e.rowSpace && (this.rowSpace = e.rowSpace) 318 } 319 320 updateStateVars(e) { 321 } 322 323 purgeVariableDependenciesOnElmtId(e) { 324 this.__switchState.purgeDependencyOnElmtId(e); 325 this.__radioState.purgeDependencyOnElmtId(e); 326 this.__checkBoxState.purgeDependencyOnElmtId(e) 327 } 328 329 aboutToBeDeleted() { 330 this.__switchState.aboutToBeDeleted(); 331 this.__radioState.aboutToBeDeleted(); 332 this.__checkBoxState.aboutToBeDeleted(); 333 SubscriberManager.Get().delete(this.id__()); 334 this.aboutToBeDeletedInternal() 335 } 336 337 get switchState() { 338 return this.__switchState.get() 339 } 340 341 set switchState(e) { 342 this.__switchState.set(e) 343 } 344 345 get radioState() { 346 return this.__radioState.get() 347 } 348 349 set radioState(e) { 350 this.__radioState.set(e) 351 } 352 353 get checkBoxState() { 354 return this.__checkBoxState.get() 355 } 356 357 set checkBoxState(e) { 358 this.__checkBoxState.set(e) 359 } 360 361 aboutToAppear() { 362 null != this.switch && (this.switchState = this.switch.isCheck); 363 null != this.radio && (this.radioState = this.radio.isCheck); 364 null != this.checkBox && (this.checkBoxState = this.checkBox.isCheck); 365 (null == this.button && null == this.image && null != this.icon && null != this.text || null == this.button && null == this.image && null == this.icon && null != this.arrow && null != this.text) && (this.rowSpace = 4) 366 } 367 368 createButton(e, t = null) { 369 this.observeComponentCreation(((t, o) => { 370 ViewStackProcessor.StartGetAccessRecordingFor(t); 371 Button.createWithLabel(e); 372 Button.fontSize({ 373 id: -1, 374 type: 10002, 375 params: ["sys.float.ohos_id_text_size_button3"], 376 bundleName: "", 377 moduleName: "" 378 }); 379 Button.fontColor({ 380 id: -1, 381 type: 10001, 382 params: ["sys.color.ohos_id_color_text_primary_activated_transparent"], 383 bundleName: "", 384 moduleName: "" 385 }); 386 Button.height(28); 387 Button.backgroundColor({ 388 id: -1, 389 type: 10001, 390 params: ["sys.color.ohos_id_color_button_normal"], 391 bundleName: "", 392 moduleName: "" 393 }); 394 Button.labelStyle({ maxLines: 1 }); 395 o || Button.pop(); 396 ViewStackProcessor.StopGetAccessRecording() 397 })); 398 Button.pop() 399 } 400 401 createIcon(e, t = null) { 402 this.observeComponentCreation(((t, o) => { 403 ViewStackProcessor.StartGetAccessRecordingFor(t); 404 Row.create(); 405 Row.height(48); 406 Row.width(48); 407 Row.justifyContent(FlexAlign.Center); 408 Row.onClick(e.action); 409 o || Row.pop(); 410 ViewStackProcessor.StopGetAccessRecording() 411 })); 412 this.observeComponentCreation(((t, o) => { 413 ViewStackProcessor.StartGetAccessRecordingFor(t); 414 Image.create(e.value); 415 Image.height(24); 416 Image.width(24); 417 Image.focusable(!0); 418 Image.fillColor({ 419 id: -1, 420 type: 10001, 421 params: ["sys.color.ohos_id_color_primary"], 422 bundleName: "", 423 moduleName: "" 424 }); 425 o || Image.pop(); 426 ViewStackProcessor.StopGetAccessRecording() 427 })); 428 Row.pop() 429 } 430 431 createImage(e, t = null) { 432 this.observeComponentCreation(((t, o) => { 433 ViewStackProcessor.StartGetAccessRecordingFor(t); 434 Image.create(e); 435 Image.height(48); 436 Image.width(48); 437 o || Image.pop(); 438 ViewStackProcessor.StopGetAccessRecording() 439 })) 440 } 441 442 createText(e, t = null) { 443 this.observeComponentCreation(((t, o) => { 444 ViewStackProcessor.StartGetAccessRecordingFor(t); 445 Text.create(e); 446 Text.fontSize({ 447 id: -1, 448 type: 10002, 449 params: ["sys.float.ohos_id_text_size_body2"], 450 bundleName: "", 451 moduleName: "" 452 }); 453 Text.fontColor({ 454 id: -1, 455 type: 10001, 456 params: ["sys.color.ohos_id_color_text_secondary"], 457 bundleName: "", 458 moduleName: "" 459 }); 460 Text.focusable(!0); 461 o || Text.pop(); 462 ViewStackProcessor.StopGetAccessRecording() 463 })); 464 Text.pop() 465 } 466 467 createArrow(e, t = null) { 468 this.observeComponentCreation(((t, o) => { 469 ViewStackProcessor.StartGetAccessRecordingFor(t); 470 Image.create(e.value); 471 Image.height(24); 472 Image.width(12); 473 Image.focusable(!0); 474 Image.fillColor({ 475 id: -1, 476 type: 10001, 477 params: ["sys.color.ohos_id_color_fourth"], 478 bundleName: "", 479 moduleName: "" 480 }); 481 Image.onClick(e.action); 482 o || Image.pop(); 483 ViewStackProcessor.StopGetAccessRecording() 484 })) 485 } 486 487 createRadio(e, t = null) { 488 this.observeComponentCreation(((t, o) => { 489 ViewStackProcessor.StartGetAccessRecordingFor(t); 490 Radio.create({ value: null, group: null }); 491 Radio.checked(this.radioState); 492 Radio.onChange(e.onChange); 493 Radio.height(24); 494 Radio.width(24); 495 o || Radio.pop(); 496 ViewStackProcessor.StopGetAccessRecording() 497 })) 498 } 499 500 createCheckBox(e, t = null) { 501 this.observeComponentCreation(((t, o) => { 502 ViewStackProcessor.StartGetAccessRecordingFor(t); 503 Checkbox.create(); 504 Checkbox.select(this.checkBoxState); 505 Checkbox.onChange(e.onChange); 506 Checkbox.height(24); 507 Checkbox.height(24); 508 o || Checkbox.pop(); 509 ViewStackProcessor.StopGetAccessRecording() 510 })); 511 Checkbox.pop() 512 } 513 514 createSwitch(e, t = null) { 515 this.observeComponentCreation(((e, t) => { 516 ViewStackProcessor.StartGetAccessRecordingFor(e); 517 Row.create(); 518 Row.height(48); 519 Row.width(48); 520 Row.justifyContent(FlexAlign.Center); 521 t || Row.pop(); 522 ViewStackProcessor.StopGetAccessRecording() 523 })); 524 this.observeComponentCreation(((t, o) => { 525 ViewStackProcessor.StartGetAccessRecordingFor(t); 526 Toggle.create({ type: ToggleType.Switch, isOn: this.switchState }); 527 Toggle.onChange(e.onChange); 528 Toggle.onClick((() => { 529 this.switchState = !this.switchState 530 })); 531 o || Toggle.pop(); 532 ViewStackProcessor.StopGetAccessRecording() 533 })); 534 Toggle.pop(); 535 Row.pop() 536 } 537 538 initialRender() { 539 this.observeComponentCreation(((e, t) => { 540 ViewStackProcessor.StartGetAccessRecordingFor(e); 541 Row.create({ space: this.rowSpace }); 542 t || Row.pop(); 543 ViewStackProcessor.StopGetAccessRecording() 544 })); 545 this.observeComponentCreation(((e, t) => { 546 ViewStackProcessor.StartGetAccessRecordingFor(e); 547 If.create(); 548 null != this.button ? this.ifElseBranchUpdateFunction(0, (() => { 549 this.createButton.bind(this)(this.button.text) 550 })) : null != this.image ? this.ifElseBranchUpdateFunction(1, (() => { 551 this.createImage.bind(this)(this.image) 552 })) : null != this.icon && null != this.text ? this.ifElseBranchUpdateFunction(2, (() => { 553 this.createText.bind(this)(this.text); 554 this.createIcon.bind(this)(this.icon) 555 })) : null != this.arrow && null == this.text ? this.ifElseBranchUpdateFunction(3, (() => { 556 this.createArrow.bind(this)(this.arrow) 557 })) : null != this.arrow && null != this.text ? this.ifElseBranchUpdateFunction(4, (() => { 558 this.createText.bind(this)(this.text); 559 this.createArrow.bind(this)(this.arrow) 560 })) : null != this.text ? this.ifElseBranchUpdateFunction(5, (() => { 561 this.createText.bind(this)(this.text) 562 })) : null != this.radio ? this.ifElseBranchUpdateFunction(6, (() => { 563 this.createRadio.bind(this)(this.radio) 564 })) : null != this.checkBox ? this.ifElseBranchUpdateFunction(7, (() => { 565 this.createCheckBox.bind(this)(this.checkBox) 566 })) : null != this.switch ? this.ifElseBranchUpdateFunction(8, (() => { 567 this.createSwitch.bind(this)(this.switch) 568 })) : null != this.icon && this.ifElseBranchUpdateFunction(9, (() => { 569 this.createIcon.bind(this)(this.icon); 570 this.observeComponentCreation(((e, t) => { 571 ViewStackProcessor.StartGetAccessRecordingFor(e); 572 If.create(); 573 null != this.subIcon ? this.ifElseBranchUpdateFunction(0, (() => { 574 this.createIcon.bind(this)(this.subIcon) 575 })) : If.branchId(1); 576 t || If.pop(); 577 ViewStackProcessor.StopGetAccessRecording() 578 })); 579 If.pop() 580 })); 581 t || If.pop(); 582 ViewStackProcessor.StopGetAccessRecording() 583 })); 584 If.pop(); 585 Row.pop() 586 } 587 588 rerender() { 589 this.updateDirtyElements() 590 } 591} 592 593export class ComposeListItem extends ViewPU { 594 constructor(e, t, o, i = -1) { 595 super(e, o, i); 596 this.__contentItem = new SynchedPropertyObjectOneWayPU(t.contentItem, this, "contentItem"); 597 this.__operateItem = new SynchedPropertyObjectOneWayPU(t.operateItem, this, "operateItem"); 598 this.__frontColor = new ObservedPropertySimplePU(Color.Transparent.toString(), this, "frontColor"); 599 this.__borderSize = new ObservedPropertySimplePU(0, this, "borderSize"); 600 this.isActive = !1; 601 this.setInitiallyProvidedValue(t) 602 } 603 604 setInitiallyProvidedValue(e) { 605 void 0 !== e.contentItem ? this.__contentItem.set(e.contentItem) : this.__contentItem.set(null); 606 void 0 !== e.operateItem ? this.__operateItem.set(e.operateItem) : this.__operateItem.set(null); 607 void 0 !== e.frontColor && (this.frontColor = e.frontColor); 608 void 0 !== e.borderSize && (this.borderSize = e.borderSize); 609 void 0 !== e.isActive && (this.isActive = e.isActive) 610 } 611 612 updateStateVars(e) { 613 this.__contentItem.reset(e.contentItem); 614 this.__operateItem.reset(e.operateItem) 615 } 616 617 purgeVariableDependenciesOnElmtId(e) { 618 this.__contentItem.purgeDependencyOnElmtId(e); 619 this.__operateItem.purgeDependencyOnElmtId(e); 620 this.__frontColor.purgeDependencyOnElmtId(e); 621 this.__borderSize.purgeDependencyOnElmtId(e) 622 } 623 624 aboutToBeDeleted() { 625 this.__contentItem.aboutToBeDeleted(); 626 this.__operateItem.aboutToBeDeleted(); 627 this.__frontColor.aboutToBeDeleted(); 628 this.__borderSize.aboutToBeDeleted(); 629 SubscriberManager.Get().delete(this.id__()); 630 this.aboutToBeDeletedInternal() 631 } 632 633 get contentItem() { 634 return this.__contentItem.get() 635 } 636 637 set contentItem(e) { 638 this.__contentItem.set(e) 639 } 640 641 get operateItem() { 642 return this.__operateItem.get() 643 } 644 645 set operateItem(e) { 646 this.__operateItem.set(e) 647 } 648 649 get frontColor() { 650 return this.__frontColor.get() 651 } 652 653 set frontColor(e) { 654 this.__frontColor.set(e) 655 } 656 657 get borderSize() { 658 return this.__borderSize.get() 659 } 660 661 set borderSize(e) { 662 this.__borderSize.set(e) 663 } 664 665 initialRender() { 666 this.observeComponentCreation(((e, t) => { 667 ViewStackProcessor.StartGetAccessRecordingFor(e); 668 Column.create(); 669 Column.padding({ 670 left: { 671 id: -1, 672 type: 10002, 673 params: ["sys.float.ohos_id_default_padding_start"], 674 bundleName: "", 675 moduleName: "" 676 }, 677 right: { 678 id: -1, 679 type: 10002, 680 params: ["sys.float.ohos_id_default_padding_end"], 681 bundleName: "", 682 moduleName: "" 683 } 684 }); 685 t || Column.pop(); 686 ViewStackProcessor.StopGetAccessRecording() 687 })); 688 this.observeComponentCreation(((e, t) => { 689 ViewStackProcessor.StartGetAccessRecordingFor(e); 690 Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }); 691 Flex.focusable(!0); 692 Flex.border({ 693 width: this.borderSize, 694 color: { 695 id: -1, 696 type: 10001, 697 params: ["sys.color.ohos_id_color_focused_outline"], 698 bundleName: "", 699 moduleName: "" 700 } 701 }); 702 Flex.borderRadius({ 703 id: -1, 704 type: 10002, 705 params: ["sys.float.ohos_id_corner_radius_default_m"], 706 bundleName: "", 707 moduleName: "" 708 }); 709 Flex.backgroundColor(this.frontColor); 710 Flex.onFocus((() => { 711 this.borderSize = 2 712 })); 713 Flex.onBlur((() => { 714 this.borderSize = 0 715 })); 716 Flex.onHover((e => { 717 this.frontColor = e ? "#0d000000" : this.isActive ? "#1a0a59f7" : Color.Transparent.toString() 718 })); 719 Flex.onTouch((e => { 720 e.type == TouchType.Down && (this.frontColor = "#1a000000"); 721 e.type == TouchType.Up && (this.frontColor = this.isActive ? "#1a0a59f7" : Color.Transparent.toString()) 722 })); 723 Flex.onClick((() => { 724 this.isActive = !this.isActive; 725 this.frontColor = this.isActive ? "#1a0a59f7" : Color.Transparent.toString() 726 })); 727 t || Flex.pop(); 728 ViewStackProcessor.StopGetAccessRecording() 729 })); 730 this.observeComponentCreation(((e, t) => { 731 ViewStackProcessor.StartGetAccessRecordingFor(e); 732 If.create(); 733 null == this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => { 734 this.observeComponentCreation(((e, t) => { 735 ViewStackProcessor.StartGetAccessRecordingFor(e); 736 t ? ViewPU.create(new ContentItemStruct(this, { 737 title: null 738 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 739 ViewStackProcessor.StopGetAccessRecording() 740 })) 741 })) : If.branchId(1); 742 t || If.pop(); 743 ViewStackProcessor.StopGetAccessRecording() 744 })); 745 If.pop(); 746 this.observeComponentCreation(((e, t) => { 747 ViewStackProcessor.StartGetAccessRecordingFor(e); 748 If.create(); 749 null != this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => { 750 this.observeComponentCreation(((e, t) => { 751 ViewStackProcessor.StartGetAccessRecordingFor(e); 752 t ? ViewPU.create(new ContentItemStruct(this, { 753 icon: "string" == typeof this.contentItem.icon ? null : this.contentItem.icon, 754 iconStyle: this.contentItem.iconStyle, 755 title: "string" == typeof this.contentItem.primaryText ? this.contentItem.primaryText : null, 756 subtitle: "string" == typeof this.contentItem.secondaryText ? this.contentItem.secondaryText : null, 757 description: "string" == typeof this.contentItem.description ? this.contentItem.description : null 758 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 759 ViewStackProcessor.StopGetAccessRecording() 760 })) 761 })) : If.branchId(1); 762 t || If.pop(); 763 ViewStackProcessor.StopGetAccessRecording() 764 })); 765 If.pop(); 766 this.observeComponentCreation(((e, t) => { 767 ViewStackProcessor.StartGetAccessRecordingFor(e); 768 If.create(); 769 null != this.operateItem ? this.ifElseBranchUpdateFunction(0, (() => { 770 this.observeComponentCreation(((e, t) => { 771 ViewStackProcessor.StartGetAccessRecordingFor(e); 772 t ? ViewPU.create(new OperateItemStruct(this, { 773 icon: this.operateItem.icon, 774 subIcon: this.operateItem.subIcon, 775 button: this.operateItem.button, 776 switch: this.operateItem.switch, 777 checkBox: this.operateItem.checkbox, 778 radio: this.operateItem.radio, 779 image: "string" == typeof this.operateItem.image ? null : this.operateItem.image, 780 text: "string" == typeof this.operateItem.text ? this.operateItem.text : null, 781 arrow: "string" == typeof this.operateItem.arrow ? null : this.operateItem.arrow 782 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 783 ViewStackProcessor.StopGetAccessRecording() 784 })) 785 })) : If.branchId(1); 786 t || If.pop(); 787 ViewStackProcessor.StopGetAccessRecording() 788 })); 789 If.pop(); 790 Flex.pop(); 791 Column.pop() 792 } 793 794 rerender() { 795 this.updateDirtyElements() 796 } 797} 798 799export default { IconType, ComposeListItem };