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 TEXT_MAX_LINE = 1; 36const ITEM_BORDER_SHOWN = 2; 37const TEXT_COLUMN_SPACE = 4; 38const TEXT_SAFE_MARGIN = 8; 39const BADGE_SIZE = 8; 40const SMALL_ICON_SIZE = 16; 41const SYSTEM_ICON_SIZE = 24; 42const TEXT_ARROW_HEIGHT = 32; 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"; 62const ICON_SIZE_MAP = 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]]); 63 64class ContentItemStruct extends ViewPU { 65 constructor(e, t, o, r = -1) { 66 super(e, o, r); 67 this.iconStyle = null; 68 this.icon = null; 69 this.primaryText = null; 70 this.secondaryText = null; 71 this.description = null; 72 this.itemRowSpace = 16; 73 this.setInitiallyProvidedValue(t) 74 } 75 76 setInitiallyProvidedValue(e) { 77 void 0 !== e.iconStyle && (this.iconStyle = e.iconStyle); 78 void 0 !== e.icon && (this.icon = e.icon); 79 void 0 !== e.primaryText && (this.primaryText = e.primaryText); 80 void 0 !== e.secondaryText && (this.secondaryText = e.secondaryText); 81 void 0 !== e.description && (this.description = e.description); 82 void 0 !== e.itemRowSpace && (this.itemRowSpace = e.itemRowSpace) 83 } 84 85 updateStateVars(e) { 86 } 87 88 purgeVariableDependenciesOnElmtId(e) { 89 } 90 91 aboutToBeDeleted() { 92 SubscriberManager.Get().delete(this.id__()); 93 this.aboutToBeDeletedInternal() 94 } 95 96 aboutToAppear() { 97 null == this.icon && null == this.iconStyle && (this.itemRowSpace = 0) 98 } 99 100 createIcon(e = null) { 101 this.observeComponentCreation(((e, t) => { 102 ViewStackProcessor.StartGetAccessRecordingFor(e); 103 If.create(); 104 null != this.icon && null != this.iconStyle ? this.ifElseBranchUpdateFunction(0, (() => { 105 this.observeComponentCreation(((e, t) => { 106 ViewStackProcessor.StartGetAccessRecordingFor(e); 107 If.create(); 108 this.iconStyle <= IconType.PREVIEW ? this.ifElseBranchUpdateFunction(0, (() => { 109 this.observeComponentCreation(((e, t) => { 110 ViewStackProcessor.StartGetAccessRecordingFor(e); 111 Image.create(this.icon); 112 Image.objectFit(ImageFit.Contain); 113 Image.width(ICON_SIZE_MAP.get(this.iconStyle)); 114 Image.height(ICON_SIZE_MAP.get(this.iconStyle)); 115 Image.borderRadius({ 116 id: -1, 117 type: 10002, 118 params: ["sys.float.ohos_id_corner_radius_default_m"], 119 bundleName: "", 120 moduleName: "" 121 }); 122 Image.focusable(!0); 123 Image.draggable(!1); 124 t || Image.pop(); 125 ViewStackProcessor.StopGetAccessRecording() 126 })) 127 })) : this.ifElseBranchUpdateFunction(1, (() => { 128 this.observeComponentCreation(((e, t) => { 129 ViewStackProcessor.StartGetAccessRecordingFor(e); 130 Image.create(this.icon); 131 Image.objectFit(ImageFit.Contain); 132 Image.constraintSize({ 133 minWidth: 0, 134 maxWidth: ICON_SIZE_MAP.get(this.iconStyle), 135 minHeight: 0, 136 maxHeight: ICON_SIZE_MAP.get(this.iconStyle) 137 }); 138 Image.borderRadius({ 139 id: -1, 140 type: 10002, 141 params: ["sys.float.ohos_id_corner_radius_default_m"], 142 bundleName: "", 143 moduleName: "" 144 }); 145 Image.focusable(!0); 146 Image.draggable(!1); 147 t || Image.pop(); 148 ViewStackProcessor.StopGetAccessRecording() 149 })) 150 })); 151 t || If.pop(); 152 ViewStackProcessor.StopGetAccessRecording() 153 })); 154 If.pop() 155 })) : If.branchId(1); 156 t || If.pop(); 157 ViewStackProcessor.StopGetAccessRecording() 158 })); 159 If.pop() 160 } 161 162 createText(e = null) { 163 this.observeComponentCreation(((e, t) => { 164 ViewStackProcessor.StartGetAccessRecordingFor(e); 165 Column.create({ space: 4 }); 166 Column.margin({ top: 8, bottom: 8 }); 167 Column.alignItems(HorizontalAlign.Start); 168 t || Column.pop(); 169 ViewStackProcessor.StopGetAccessRecording() 170 })); 171 this.observeComponentCreation(((e, t) => { 172 ViewStackProcessor.StartGetAccessRecordingFor(e); 173 Text.create(this.primaryText); 174 Text.fontSize({ 175 id: -1, 176 type: 10002, 177 params: ["sys.float.ohos_id_text_size_body1"], 178 bundleName: "", 179 moduleName: "" 180 }); 181 Text.fontColor({ 182 id: -1, 183 type: 10001, 184 params: ["sys.color.ohos_id_color_text_primary"], 185 bundleName: "", 186 moduleName: "" 187 }); 188 Text.maxLines(1); 189 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 190 Text.fontWeight(FontWeight.Medium); 191 Text.focusable(!0); 192 Text.draggable(!1); 193 t || Text.pop(); 194 ViewStackProcessor.StopGetAccessRecording() 195 })); 196 Text.pop(); 197 this.observeComponentCreation(((e, t) => { 198 ViewStackProcessor.StartGetAccessRecordingFor(e); 199 If.create(); 200 null != this.secondaryText ? this.ifElseBranchUpdateFunction(0, (() => { 201 this.observeComponentCreation(((e, t) => { 202 ViewStackProcessor.StartGetAccessRecordingFor(e); 203 Text.create(this.secondaryText); 204 Text.fontSize({ 205 id: -1, 206 type: 10002, 207 params: ["sys.float.ohos_id_text_size_body2"], 208 bundleName: "", 209 moduleName: "" 210 }); 211 Text.fontColor({ 212 id: -1, 213 type: 10001, 214 params: ["sys.color.ohos_id_color_text_secondary"], 215 bundleName: "", 216 moduleName: "" 217 }); 218 Text.maxLines(1); 219 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 220 Text.focusable(!0); 221 Text.draggable(!1); 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 Text.draggable(!1); 256 t || Text.pop(); 257 ViewStackProcessor.StopGetAccessRecording() 258 })); 259 Text.pop() 260 })) : If.branchId(1); 261 t || If.pop(); 262 ViewStackProcessor.StopGetAccessRecording() 263 })); 264 If.pop(); 265 Column.pop() 266 } 267 268 initialRender() { 269 this.observeComponentCreation(((e, t) => { 270 ViewStackProcessor.StartGetAccessRecordingFor(e); 271 Row.create({ space: this.itemRowSpace }); 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, r = -1) { 287 super(e, o, r); 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.__parentCanFocus = new SynchedPropertySimpleTwoWayPU(t.parentCanFocus, this, "parentCanFocus"); 301 this.__parentCanTouch = new SynchedPropertySimpleTwoWayPU(t.parentCanTouch, this, "parentCanTouch"); 302 this.__parentIsHover = new SynchedPropertySimpleTwoWayPU(t.parentIsHover, this, "parentIsHover"); 303 this.__parentCanHover = new SynchedPropertySimpleTwoWayPU(t.parentCanHover, this, "parentCanHover"); 304 this.__parentIsActive = new SynchedPropertySimpleTwoWayPU(t.parentIsActive, this, "parentIsActive"); 305 this.__parentFrontColor = new SynchedPropertySimpleTwoWayPU(t.parentFrontColor, this, "parentFrontColor"); 306 this.rowSpace = 0; 307 this.setInitiallyProvidedValue(t) 308 } 309 310 setInitiallyProvidedValue(e) { 311 void 0 !== e.arrow && (this.arrow = e.arrow); 312 void 0 !== e.icon && (this.icon = e.icon); 313 void 0 !== e.subIcon && (this.subIcon = e.subIcon); 314 void 0 !== e.button && (this.button = e.button); 315 void 0 !== e.switch && (this.switch = e.switch); 316 void 0 !== e.checkBox && (this.checkBox = e.checkBox); 317 void 0 !== e.radio && (this.radio = e.radio); 318 void 0 !== e.image && (this.image = e.image); 319 void 0 !== e.text && (this.text = e.text); 320 void 0 !== e.switchState && (this.switchState = e.switchState); 321 void 0 !== e.radioState && (this.radioState = e.radioState); 322 void 0 !== e.checkBoxState && (this.checkBoxState = e.checkBoxState); 323 void 0 !== e.rowSpace && (this.rowSpace = e.rowSpace) 324 } 325 326 updateStateVars(e) { 327 } 328 329 purgeVariableDependenciesOnElmtId(e) { 330 this.__switchState.purgeDependencyOnElmtId(e); 331 this.__radioState.purgeDependencyOnElmtId(e); 332 this.__checkBoxState.purgeDependencyOnElmtId(e); 333 this.__parentCanFocus.purgeDependencyOnElmtId(e); 334 this.__parentCanTouch.purgeDependencyOnElmtId(e); 335 this.__parentIsHover.purgeDependencyOnElmtId(e); 336 this.__parentCanHover.purgeDependencyOnElmtId(e); 337 this.__parentIsActive.purgeDependencyOnElmtId(e); 338 this.__parentFrontColor.purgeDependencyOnElmtId(e) 339 } 340 341 aboutToBeDeleted() { 342 this.__switchState.aboutToBeDeleted(); 343 this.__radioState.aboutToBeDeleted(); 344 this.__checkBoxState.aboutToBeDeleted(); 345 this.__parentCanFocus.aboutToBeDeleted(); 346 this.__parentCanTouch.aboutToBeDeleted(); 347 this.__parentIsHover.aboutToBeDeleted(); 348 this.__parentCanHover.aboutToBeDeleted(); 349 this.__parentIsActive.aboutToBeDeleted(); 350 this.__parentFrontColor.aboutToBeDeleted(); 351 SubscriberManager.Get().delete(this.id__()); 352 this.aboutToBeDeletedInternal() 353 } 354 355 get switchState() { 356 return this.__switchState.get() 357 } 358 359 set switchState(e) { 360 this.__switchState.set(e) 361 } 362 363 get radioState() { 364 return this.__radioState.get() 365 } 366 367 set radioState(e) { 368 this.__radioState.set(e) 369 } 370 371 get checkBoxState() { 372 return this.__checkBoxState.get() 373 } 374 375 set checkBoxState(e) { 376 this.__checkBoxState.set(e) 377 } 378 379 get parentCanFocus() { 380 return this.__parentCanFocus.get() 381 } 382 383 set parentCanFocus(e) { 384 this.__parentCanFocus.set(e) 385 } 386 387 get parentCanTouch() { 388 return this.__parentCanTouch.get() 389 } 390 391 set parentCanTouch(e) { 392 this.__parentCanTouch.set(e) 393 } 394 395 get parentIsHover() { 396 return this.__parentIsHover.get() 397 } 398 399 set parentIsHover(e) { 400 this.__parentIsHover.set(e) 401 } 402 403 get parentCanHover() { 404 return this.__parentCanHover.get() 405 } 406 407 set parentCanHover(e) { 408 this.__parentCanHover.set(e) 409 } 410 411 get parentIsActive() { 412 return this.__parentIsActive.get() 413 } 414 415 set parentIsActive(e) { 416 this.__parentIsActive.set(e) 417 } 418 419 get parentFrontColor() { 420 return this.__parentFrontColor.get() 421 } 422 423 set parentFrontColor(e) { 424 this.__parentFrontColor.set(e) 425 } 426 427 aboutToAppear() { 428 null != this.switch && (this.switchState = this.switch.isCheck); 429 null != this.radio && (this.radioState = this.radio.isCheck); 430 null != this.checkBox && (this.checkBoxState = this.checkBox.isCheck); 431 (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) 432 } 433 434 createButton(e, t = null) { 435 this.observeComponentCreation(((e, t) => { 436 ViewStackProcessor.StartGetAccessRecordingFor(e); 437 Button.createWithChild(); 438 Button.hitTestBehavior(HitTestMode.Block); 439 Button.fontSize({ 440 id: -1, 441 type: 10002, 442 params: ["sys.float.ohos_id_text_size_button3"], 443 bundleName: "", 444 moduleName: "" 445 }); 446 Button.fontColor({ 447 id: -1, 448 type: 10001, 449 params: ["sys.color.ohos_id_color_text_primary_activated_transparent"], 450 bundleName: "", 451 moduleName: "" 452 }); 453 Button.height(28); 454 Button.backgroundColor({ 455 id: -1, 456 type: 10001, 457 params: ["sys.color.ohos_id_color_button_normal"], 458 bundleName: "", 459 moduleName: "" 460 }); 461 Button.labelStyle({ maxLines: 1 }); 462 Button.onFocus((() => { 463 this.parentCanFocus = !1 464 })); 465 Button.onTouch((e => { 466 e.type == TouchType.Down && (this.parentCanTouch = !1); 467 e.type == TouchType.Up && (this.parentCanTouch = !0) 468 })); 469 Button.onHover((e => { 470 this.parentCanHover = !1; 471 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 472 if (!e) { 473 this.parentCanHover = !0; 474 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 475 } 476 })); 477 t || Button.pop(); 478 ViewStackProcessor.StopGetAccessRecording() 479 })); 480 this.observeComponentCreation(((e, t) => { 481 ViewStackProcessor.StartGetAccessRecordingFor(e); 482 Row.create(); 483 Row.padding({ left: 8, right: 8 }); 484 t || Row.pop(); 485 ViewStackProcessor.StopGetAccessRecording() 486 })); 487 this.observeComponentCreation(((t, o) => { 488 ViewStackProcessor.StartGetAccessRecordingFor(t); 489 Text.create(e); 490 Text.focusable(!0); 491 o || Text.pop(); 492 ViewStackProcessor.StopGetAccessRecording() 493 })); 494 Text.pop(); 495 Row.pop(); 496 Button.pop() 497 } 498 499 createIcon(e, t = null) { 500 this.observeComponentCreation(((t, o) => { 501 ViewStackProcessor.StartGetAccessRecordingFor(t); 502 Button.createWithChild({ type: ButtonType.Normal }); 503 Button.hitTestBehavior(HitTestMode.Block); 504 Button.backgroundColor(Color.Transparent); 505 Button.height(48); 506 Button.width(48); 507 Button.borderRadius({ 508 id: -1, 509 type: 10002, 510 params: ["sys.float.ohos_id_corner_radius_clicked"], 511 bundleName: "", 512 moduleName: "" 513 }); 514 Button.onFocus((() => { 515 this.parentCanFocus = !1 516 })); 517 Button.onTouch((e => { 518 e.type == TouchType.Down && (this.parentCanTouch = !1); 519 e.type == TouchType.Up && (this.parentCanTouch = !0) 520 })); 521 Button.onHover((e => { 522 this.parentCanHover = !1; 523 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 524 if (!e) { 525 this.parentCanHover = !0; 526 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 527 } 528 })); 529 Button.onClick(e.action); 530 o || Button.pop(); 531 ViewStackProcessor.StopGetAccessRecording() 532 })); 533 this.observeComponentCreation(((t, o) => { 534 ViewStackProcessor.StartGetAccessRecordingFor(t); 535 Image.create(e.value); 536 Image.height(24); 537 Image.width(24); 538 Image.focusable(!0); 539 Image.fillColor({ 540 id: -1, 541 type: 10001, 542 params: ["sys.color.ohos_id_color_primary"], 543 bundleName: "", 544 moduleName: "" 545 }); 546 Image.draggable(!1); 547 o || Image.pop(); 548 ViewStackProcessor.StopGetAccessRecording() 549 })); 550 Button.pop() 551 } 552 553 createImage(e, t = null) { 554 this.observeComponentCreation(((t, o) => { 555 ViewStackProcessor.StartGetAccessRecordingFor(t); 556 Image.create(e); 557 Image.height(48); 558 Image.width(48); 559 Image.draggable(!1); 560 o || Image.pop(); 561 ViewStackProcessor.StopGetAccessRecording() 562 })) 563 } 564 565 createText(e, t = null) { 566 this.observeComponentCreation(((t, o) => { 567 ViewStackProcessor.StartGetAccessRecordingFor(t); 568 Text.create(e); 569 Text.fontSize({ 570 id: -1, 571 type: 10002, 572 params: ["sys.float.ohos_id_text_size_body2"], 573 bundleName: "", 574 moduleName: "" 575 }); 576 Text.fontColor({ 577 id: -1, 578 type: 10001, 579 params: ["sys.color.ohos_id_color_text_secondary"], 580 bundleName: "", 581 moduleName: "" 582 }); 583 Text.focusable(!0); 584 Text.draggable(!1); 585 o || Text.pop(); 586 ViewStackProcessor.StopGetAccessRecording() 587 })); 588 Text.pop() 589 } 590 591 createArrow(e, t = null) { 592 this.observeComponentCreation(((t, o) => { 593 ViewStackProcessor.StartGetAccessRecordingFor(t); 594 Button.createWithChild({ type: ButtonType.Normal }); 595 Button.hitTestBehavior(HitTestMode.Block); 596 Button.backgroundColor(Color.Transparent); 597 Button.height(24); 598 Button.width(12); 599 Button.onFocus((() => { 600 this.parentCanFocus = !1 601 })); 602 Button.onTouch((e => { 603 e.type == TouchType.Down && (this.parentCanTouch = !1); 604 e.type == TouchType.Up && (this.parentCanTouch = !0) 605 })); 606 Button.onHover((e => { 607 this.parentCanHover = !1; 608 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 609 if (!e) { 610 this.parentCanHover = !0; 611 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 612 } 613 })); 614 Button.onClick(e.action); 615 o || Button.pop(); 616 ViewStackProcessor.StopGetAccessRecording() 617 })); 618 this.observeComponentCreation(((t, o) => { 619 ViewStackProcessor.StartGetAccessRecordingFor(t); 620 Image.create(e.value); 621 Image.height(24); 622 Image.width(12); 623 Image.focusable(!0); 624 Image.fillColor({ 625 id: -1, 626 type: 10001, 627 params: ["sys.color.ohos_id_color_fourth"], 628 bundleName: "", 629 moduleName: "" 630 }); 631 Image.draggable(!1); 632 o || Image.pop(); 633 ViewStackProcessor.StopGetAccessRecording() 634 })); 635 Button.pop() 636 } 637 638 createRadio(e, t = null) { 639 this.observeComponentCreation(((t, o) => { 640 ViewStackProcessor.StartGetAccessRecordingFor(t); 641 Radio.create({ value: null, group: null }); 642 Radio.checked(this.radioState); 643 Radio.onChange(e.onChange); 644 Radio.height(24); 645 Radio.width(24); 646 Radio.onFocus((() => { 647 this.parentCanFocus = !1 648 })); 649 Radio.hitTestBehavior(HitTestMode.Block); 650 Radio.onTouch((e => { 651 e.type == TouchType.Down && (this.parentCanTouch = !1); 652 e.type == TouchType.Up && (this.parentCanTouch = !0) 653 })); 654 Radio.onHover((e => { 655 this.parentCanHover = !1; 656 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 657 if (!e) { 658 this.parentCanHover = !0; 659 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 660 } 661 })); 662 o || Radio.pop(); 663 ViewStackProcessor.StopGetAccessRecording() 664 })) 665 } 666 667 createCheckBox(e, t = null) { 668 this.observeComponentCreation(((t, o) => { 669 ViewStackProcessor.StartGetAccessRecordingFor(t); 670 Checkbox.create(); 671 Checkbox.select(this.checkBoxState); 672 Checkbox.onChange(e.onChange); 673 Checkbox.height(24); 674 Checkbox.height(24); 675 Checkbox.onFocus((() => { 676 this.parentCanFocus = !1 677 })); 678 Checkbox.hitTestBehavior(HitTestMode.Block); 679 Checkbox.onTouch((e => { 680 e.type == TouchType.Down && (this.parentCanTouch = !1); 681 e.type == TouchType.Up && (this.parentCanTouch = !0) 682 })); 683 Checkbox.onHover((e => { 684 this.parentCanHover = !1; 685 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 686 if (!e) { 687 this.parentCanHover = !0; 688 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 689 } 690 })); 691 o || Checkbox.pop(); 692 ViewStackProcessor.StopGetAccessRecording() 693 })); 694 Checkbox.pop() 695 } 696 697 createSwitch(e, t = null) { 698 this.observeComponentCreation(((e, t) => { 699 ViewStackProcessor.StartGetAccessRecordingFor(e); 700 Row.create(); 701 Row.height(48); 702 Row.width(48); 703 Row.justifyContent(FlexAlign.Center); 704 Row.onFocus((() => { 705 this.parentCanFocus = !1 706 })); 707 Row.onTouch((e => { 708 e.type == TouchType.Down && (this.parentCanTouch = !1); 709 e.type == TouchType.Up && (this.parentCanTouch = !0) 710 })); 711 Row.onHover((e => { 712 this.parentCanHover = !1; 713 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 714 if (!e) { 715 this.parentCanHover = !0; 716 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 717 } 718 })); 719 t || Row.pop(); 720 ViewStackProcessor.StopGetAccessRecording() 721 })); 722 this.observeComponentCreation(((t, o) => { 723 ViewStackProcessor.StartGetAccessRecordingFor(t); 724 Toggle.create({ type: ToggleType.Switch, isOn: this.switchState }); 725 Toggle.onChange(e.onChange); 726 Toggle.onClick((() => { 727 this.switchState = !this.switchState 728 })); 729 Toggle.hitTestBehavior(HitTestMode.Block); 730 o || Toggle.pop(); 731 ViewStackProcessor.StopGetAccessRecording() 732 })); 733 Toggle.pop(); 734 Row.pop() 735 } 736 737 createTextArrow(e, t, o = null) { 738 this.observeComponentCreation(((e, o) => { 739 ViewStackProcessor.StartGetAccessRecordingFor(e); 740 Button.createWithChild({ type: ButtonType.Normal }); 741 Button.hitTestBehavior(HitTestMode.Block); 742 Button.labelStyle({ maxLines: 1 }); 743 Button.backgroundColor(Color.Transparent); 744 Button.height(32); 745 Button.borderRadius({ 746 id: -1, 747 type: 10002, 748 params: ["sys.float.ohos_id_corner_radius_clicked"], 749 bundleName: "", 750 moduleName: "" 751 }); 752 Button.onFocus((() => { 753 this.parentCanFocus = !1 754 })); 755 Button.onTouch((e => { 756 e.type == TouchType.Down && (this.parentCanTouch = !1); 757 e.type == TouchType.Up && (this.parentCanTouch = !0) 758 })); 759 Button.onHover((e => { 760 this.parentCanHover = !1; 761 e && "#0d000000" == this.parentFrontColor && (this.parentFrontColor = this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()); 762 if (!e) { 763 this.parentCanHover = !0; 764 this.parentIsHover && (this.parentFrontColor = this.parentIsHover ? "#0d000000" : this.parentIsActive ? "#1a0a59f7" : Color.Transparent.toString()) 765 } 766 })); 767 Button.onClick(t.action); 768 o || Button.pop(); 769 ViewStackProcessor.StopGetAccessRecording() 770 })); 771 this.observeComponentCreation(((e, t) => { 772 ViewStackProcessor.StartGetAccessRecordingFor(e); 773 Row.create({ space: 4 }); 774 Row.padding({ left: 8, right: 8 }); 775 t || Row.pop(); 776 ViewStackProcessor.StopGetAccessRecording() 777 })); 778 this.observeComponentCreation(((t, o) => { 779 ViewStackProcessor.StartGetAccessRecordingFor(t); 780 Text.create(e); 781 Text.fontSize({ 782 id: -1, 783 type: 10002, 784 params: ["sys.float.ohos_id_text_size_body2"], 785 bundleName: "", 786 moduleName: "" 787 }); 788 Text.fontColor({ 789 id: -1, 790 type: 10001, 791 params: ["sys.color.ohos_id_color_text_secondary"], 792 bundleName: "", 793 moduleName: "" 794 }); 795 Text.focusable(!0); 796 Text.draggable(!1); 797 o || Text.pop(); 798 ViewStackProcessor.StopGetAccessRecording() 799 })); 800 Text.pop(); 801 this.observeComponentCreation(((e, o) => { 802 ViewStackProcessor.StartGetAccessRecordingFor(e); 803 Image.create(t.value); 804 Image.height(24); 805 Image.width(12); 806 Image.fillColor({ 807 id: -1, 808 type: 10001, 809 params: ["sys.color.ohos_id_color_fourth"], 810 bundleName: "", 811 moduleName: "" 812 }); 813 Image.focusable(!0); 814 Image.draggable(!1); 815 o || Image.pop(); 816 ViewStackProcessor.StopGetAccessRecording() 817 })); 818 Row.pop(); 819 Button.pop() 820 } 821 822 initialRender() { 823 this.observeComponentCreation(((e, t) => { 824 ViewStackProcessor.StartGetAccessRecordingFor(e); 825 Row.create({ space: this.rowSpace }); 826 t || Row.pop(); 827 ViewStackProcessor.StopGetAccessRecording() 828 })); 829 this.observeComponentCreation(((e, t) => { 830 ViewStackProcessor.StartGetAccessRecordingFor(e); 831 If.create(); 832 null != this.button ? this.ifElseBranchUpdateFunction(0, (() => { 833 this.createButton.bind(this)(this.button.text) 834 })) : null != this.image ? this.ifElseBranchUpdateFunction(1, (() => { 835 this.createImage.bind(this)(this.image) 836 })) : null != this.icon && null != this.text ? this.ifElseBranchUpdateFunction(2, (() => { 837 this.createText.bind(this)(this.text); 838 this.createIcon.bind(this)(this.icon) 839 })) : null != this.arrow && null == this.text ? this.ifElseBranchUpdateFunction(3, (() => { 840 this.createArrow.bind(this)(this.arrow) 841 })) : null != this.arrow && null != this.text ? this.ifElseBranchUpdateFunction(4, (() => { 842 this.createTextArrow.bind(this)(this.text, this.arrow) 843 })) : null != this.text ? this.ifElseBranchUpdateFunction(5, (() => { 844 this.createText.bind(this)(this.text) 845 })) : null != this.radio ? this.ifElseBranchUpdateFunction(6, (() => { 846 this.createRadio.bind(this)(this.radio) 847 })) : null != this.checkBox ? this.ifElseBranchUpdateFunction(7, (() => { 848 this.createCheckBox.bind(this)(this.checkBox) 849 })) : null != this.switch ? this.ifElseBranchUpdateFunction(8, (() => { 850 this.createSwitch.bind(this)(this.switch) 851 })) : null != this.icon && this.ifElseBranchUpdateFunction(9, (() => { 852 this.createIcon.bind(this)(this.icon); 853 this.observeComponentCreation(((e, t) => { 854 ViewStackProcessor.StartGetAccessRecordingFor(e); 855 If.create(); 856 null != this.subIcon ? this.ifElseBranchUpdateFunction(0, (() => { 857 this.createIcon.bind(this)(this.subIcon) 858 })) : If.branchId(1); 859 t || If.pop(); 860 ViewStackProcessor.StopGetAccessRecording() 861 })); 862 If.pop() 863 })); 864 t || If.pop(); 865 ViewStackProcessor.StopGetAccessRecording() 866 })); 867 If.pop(); 868 Row.pop() 869 } 870 871 rerender() { 872 this.updateDirtyElements() 873 } 874} 875 876export class ComposeListItem extends ViewPU { 877 constructor(e, t, o, r = -1) { 878 super(e, o, r); 879 this.__contentItem = new SynchedPropertyObjectOneWayPU(t.contentItem, this, "contentItem"); 880 this.__operateItem = new SynchedPropertyObjectOneWayPU(t.operateItem, this, "operateItem"); 881 this.__frontColor = new ObservedPropertySimplePU(Color.Transparent.toString(), this, "frontColor"); 882 this.__borderSize = new ObservedPropertySimplePU(0, this, "borderSize"); 883 this.__canFocus = new ObservedPropertySimplePU(!1, this, "canFocus"); 884 this.__canTouch = new ObservedPropertySimplePU(!0, this, "canTouch"); 885 this.__canHover = new ObservedPropertySimplePU(!0, this, "canHover"); 886 this.__isHover = new ObservedPropertySimplePU(!0, this, "isHover"); 887 this.__itemHeight = new ObservedPropertySimplePU(ItemHeight.FIRST_HEIGHT, this, "itemHeight"); 888 this.__isActive = new ObservedPropertySimplePU(!1, this, "isActive"); 889 this.setInitiallyProvidedValue(t) 890 } 891 892 setInitiallyProvidedValue(e) { 893 void 0 !== e.contentItem ? this.__contentItem.set(e.contentItem) : this.__contentItem.set(null); 894 void 0 !== e.operateItem ? this.__operateItem.set(e.operateItem) : this.__operateItem.set(null); 895 void 0 !== e.frontColor && (this.frontColor = e.frontColor); 896 void 0 !== e.borderSize && (this.borderSize = e.borderSize); 897 void 0 !== e.canFocus && (this.canFocus = e.canFocus); 898 void 0 !== e.canTouch && (this.canTouch = e.canTouch); 899 void 0 !== e.canHover && (this.canHover = e.canHover); 900 void 0 !== e.isHover && (this.isHover = e.isHover); 901 void 0 !== e.itemHeight && (this.itemHeight = e.itemHeight); 902 void 0 !== e.isActive && (this.isActive = e.isActive) 903 } 904 905 updateStateVars(e) { 906 this.__contentItem.reset(e.contentItem); 907 this.__operateItem.reset(e.operateItem) 908 } 909 910 purgeVariableDependenciesOnElmtId(e) { 911 this.__contentItem.purgeDependencyOnElmtId(e); 912 this.__operateItem.purgeDependencyOnElmtId(e); 913 this.__frontColor.purgeDependencyOnElmtId(e); 914 this.__borderSize.purgeDependencyOnElmtId(e); 915 this.__canFocus.purgeDependencyOnElmtId(e); 916 this.__canTouch.purgeDependencyOnElmtId(e); 917 this.__canHover.purgeDependencyOnElmtId(e); 918 this.__isHover.purgeDependencyOnElmtId(e); 919 this.__itemHeight.purgeDependencyOnElmtId(e); 920 this.__isActive.purgeDependencyOnElmtId(e) 921 } 922 923 aboutToBeDeleted() { 924 this.__contentItem.aboutToBeDeleted(); 925 this.__operateItem.aboutToBeDeleted(); 926 this.__frontColor.aboutToBeDeleted(); 927 this.__borderSize.aboutToBeDeleted(); 928 this.__canFocus.aboutToBeDeleted(); 929 this.__canTouch.aboutToBeDeleted(); 930 this.__canHover.aboutToBeDeleted(); 931 this.__isHover.aboutToBeDeleted(); 932 this.__itemHeight.aboutToBeDeleted(); 933 this.__isActive.aboutToBeDeleted(); 934 SubscriberManager.Get().delete(this.id__()); 935 this.aboutToBeDeletedInternal() 936 } 937 938 get contentItem() { 939 return this.__contentItem.get() 940 } 941 942 set contentItem(e) { 943 this.__contentItem.set(e) 944 } 945 946 get operateItem() { 947 return this.__operateItem.get() 948 } 949 950 set operateItem(e) { 951 this.__operateItem.set(e) 952 } 953 954 get frontColor() { 955 return this.__frontColor.get() 956 } 957 958 set frontColor(e) { 959 this.__frontColor.set(e) 960 } 961 962 get borderSize() { 963 return this.__borderSize.get() 964 } 965 966 set borderSize(e) { 967 this.__borderSize.set(e) 968 } 969 970 get canFocus() { 971 return this.__canFocus.get() 972 } 973 974 set canFocus(e) { 975 this.__canFocus.set(e) 976 } 977 978 get canTouch() { 979 return this.__canTouch.get() 980 } 981 982 set canTouch(e) { 983 this.__canTouch.set(e) 984 } 985 986 get canHover() { 987 return this.__canHover.get() 988 } 989 990 set canHover(e) { 991 this.__canHover.set(e) 992 } 993 994 get isHover() { 995 return this.__isHover.get() 996 } 997 998 set isHover(e) { 999 this.__isHover.set(e) 1000 } 1001 1002 get itemHeight() { 1003 return this.__itemHeight.get() 1004 } 1005 1006 set itemHeight(e) { 1007 this.__itemHeight.set(e) 1008 } 1009 1010 get isActive() { 1011 return this.__isActive.get() 1012 } 1013 1014 set isActive(e) { 1015 this.__isActive.set(e) 1016 } 1017 1018 aboutToAppear() { 1019 if (null !== this.contentItem) { 1020 null === this.contentItem.secondaryText && null === this.contentItem.description ? null === this.contentItem.icon ? this.itemHeight = ItemHeight.FIRST_HEIGHT : this.itemHeight = this.contentItem.iconStyle <= IconType.HEAD_SCULPTURE ? ItemHeight.SECOND_HEIGHT : ItemHeight.THIRD_HEIGHT : null === this.contentItem.description ? null === this.contentItem.icon || null !== this.contentItem.icon && this.contentItem.iconStyle <= IconType.SYSTEM_ICON ? this.itemHeight = ItemHeight.THIRD_HEIGHT : this.itemHeight = ItemHeight.FOURTH_HEIGHT : this.itemHeight = ItemHeight.FIFTH_HEIGHT; 1021 ICON_SIZE_MAP.get(this.contentItem.iconStyle) >= this.itemHeight && (this.itemHeight = ICON_SIZE_MAP.get(this.contentItem.iconStyle) + 32) 1022 } else null === this.operateItem.image && null === this.operateItem.icon && null === this.operateItem.subIcon || (this.itemHeight = 80) 1023 } 1024 1025 initialRender() { 1026 this.observeComponentCreation(((e, t) => { 1027 ViewStackProcessor.StartGetAccessRecordingFor(e); 1028 Stack.create(); 1029 Stack.padding({ 1030 left: { 1031 id: -1, 1032 type: 10002, 1033 params: ["sys.float.ohos_id_default_padding_start"], 1034 bundleName: "", 1035 moduleName: "" 1036 }, 1037 right: { 1038 id: -1, 1039 type: 10002, 1040 params: ["sys.float.ohos_id_default_padding_end"], 1041 bundleName: "", 1042 moduleName: "" 1043 } 1044 }); 1045 t || Stack.pop(); 1046 ViewStackProcessor.StopGetAccessRecording() 1047 })); 1048 this.observeComponentCreation(((e, t) => { 1049 ViewStackProcessor.StartGetAccessRecordingFor(e); 1050 Flex.create({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }); 1051 Flex.height(this.itemHeight); 1052 Flex.focusable(!0); 1053 Flex.borderRadius({ 1054 id: -1, 1055 type: 10002, 1056 params: ["sys.float.ohos_id_corner_radius_default_m"], 1057 bundleName: "", 1058 moduleName: "" 1059 }); 1060 Flex.backgroundColor(this.frontColor); 1061 Flex.onFocus((() => { 1062 this.canFocus = !0 1063 })); 1064 Flex.onBlur((() => { 1065 this.canFocus = !1 1066 })); 1067 Flex.onHover((e => { 1068 this.isHover = e; 1069 this.canHover && (this.frontColor = e ? "#0d000000" : this.isActive ? "#1a0a59f7" : Color.Transparent.toString()) 1070 })); 1071 Flex.onTouch((e => { 1072 e.type == TouchType.Down && this.canTouch && (this.frontColor = "#1a000000"); 1073 e.type == TouchType.Up && (this.frontColor = this.isActive ? "#1a0a59f7" : Color.Transparent.toString()) 1074 })); 1075 t || Flex.pop(); 1076 ViewStackProcessor.StopGetAccessRecording() 1077 })); 1078 this.observeComponentCreation(((e, t) => { 1079 ViewStackProcessor.StartGetAccessRecordingFor(e); 1080 If.create(); 1081 null === this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => { 1082 this.observeComponentCreation(((e, t) => { 1083 ViewStackProcessor.StartGetAccessRecordingFor(e); 1084 t ? ViewPU.create(new ContentItemStruct(this, {}, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 1085 ViewStackProcessor.StopGetAccessRecording() 1086 })) 1087 })) : If.branchId(1); 1088 t || If.pop(); 1089 ViewStackProcessor.StopGetAccessRecording() 1090 })); 1091 If.pop(); 1092 this.observeComponentCreation(((e, t) => { 1093 ViewStackProcessor.StartGetAccessRecordingFor(e); 1094 If.create(); 1095 null !== this.contentItem ? this.ifElseBranchUpdateFunction(0, (() => { 1096 this.observeComponentCreation(((e, t) => { 1097 ViewStackProcessor.StartGetAccessRecordingFor(e); 1098 t ? ViewPU.create(new ContentItemStruct(this, { 1099 icon: "string" == typeof this.contentItem.icon ? null : this.contentItem.icon, 1100 iconStyle: this.contentItem.iconStyle, 1101 primaryText: "string" == typeof this.contentItem.primaryText ? this.contentItem.primaryText : null, 1102 secondaryText: "string" == typeof this.contentItem.secondaryText ? this.contentItem.secondaryText : null, 1103 description: "string" == typeof this.contentItem.description ? this.contentItem.description : null 1104 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 1105 ViewStackProcessor.StopGetAccessRecording() 1106 })) 1107 })) : If.branchId(1); 1108 t || If.pop(); 1109 ViewStackProcessor.StopGetAccessRecording() 1110 })); 1111 If.pop(); 1112 this.observeComponentCreation(((e, t) => { 1113 ViewStackProcessor.StartGetAccessRecordingFor(e); 1114 If.create(); 1115 null !== this.operateItem ? this.ifElseBranchUpdateFunction(0, (() => { 1116 this.observeComponentCreation(((e, t) => { 1117 ViewStackProcessor.StartGetAccessRecordingFor(e); 1118 __Common__.create(); 1119 __Common__.onFocus((() => { 1120 this.canFocus = !1 1121 })); 1122 __Common__.onBlur((() => { 1123 this.canFocus = !0 1124 })); 1125 t || __Common__.pop(); 1126 ViewStackProcessor.StopGetAccessRecording() 1127 })); 1128 this.observeComponentCreation(((e, t) => { 1129 ViewStackProcessor.StartGetAccessRecordingFor(e); 1130 t ? ViewPU.create(new OperateItemStruct(this, { 1131 icon: this.operateItem.icon, 1132 subIcon: this.operateItem.subIcon, 1133 button: this.operateItem.button, 1134 switch: this.operateItem.switch, 1135 checkBox: this.operateItem.checkbox, 1136 radio: this.operateItem.radio, 1137 image: "string" == typeof this.operateItem.image ? null : this.operateItem.image, 1138 text: "string" == typeof this.operateItem.text ? this.operateItem.text : null, 1139 arrow: "string" == typeof this.operateItem.arrow ? null : this.operateItem.arrow, 1140 parentCanFocus: this.__canFocus, 1141 parentCanTouch: this.__canTouch, 1142 parentIsHover: this.__isHover, 1143 parentFrontColor: this.__frontColor, 1144 parentIsActive: this.__isActive, 1145 parentCanHover: this.__canHover 1146 }, void 0, e)) : this.updateStateVarsOfChildByElmtId(e, {}); 1147 ViewStackProcessor.StopGetAccessRecording() 1148 })); 1149 __Common__.pop() 1150 })) : If.branchId(1); 1151 t || If.pop(); 1152 ViewStackProcessor.StopGetAccessRecording() 1153 })); 1154 If.pop(); 1155 Flex.pop(); 1156 this.observeComponentCreation(((e, t) => { 1157 ViewStackProcessor.StartGetAccessRecordingFor(e); 1158 If.create(); 1159 this.canFocus ? this.ifElseBranchUpdateFunction(0, (() => { 1160 this.observeComponentCreation(((e, t) => { 1161 ViewStackProcessor.StartGetAccessRecordingFor(e); 1162 Row.create(); 1163 Row.height(this.itemHeight); 1164 Row.width("100%"); 1165 Row.hitTestBehavior(HitTestMode.None); 1166 Row.border({ 1167 width: 2, 1168 color: { 1169 id: -1, 1170 type: 10001, 1171 params: ["sys.color.ohos_id_color_focused_outline"], 1172 bundleName: "", 1173 moduleName: "" 1174 } 1175 }); 1176 Row.borderRadius({ 1177 id: -1, 1178 type: 10002, 1179 params: ["sys.float.ohos_id_corner_radius_default_m"], 1180 bundleName: "", 1181 moduleName: "" 1182 }); 1183 t || Row.pop(); 1184 ViewStackProcessor.StopGetAccessRecording() 1185 })); 1186 Row.pop() 1187 })) : If.branchId(1); 1188 t || If.pop(); 1189 ViewStackProcessor.StopGetAccessRecording() 1190 })); 1191 If.pop(); 1192 Stack.pop() 1193 } 1194 1195 rerender() { 1196 this.updateDirtyElements() 1197 } 1198} 1199 1200export default { IconType, ComposeListItem };