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 16const display = requireNapi('display'); 17const hilog = requireNapi('hilog'); 18const measure = requireNapi('measure'); 19const resourceManager = requireNapi('resourceManager'); 20const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 21const LengthUnit = requireNapi('arkui.node').LengthUnit; 22 23if (!('finalizeConstruction' in ViewPU.prototype)) { 24 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { 25 }); 26} 27 28class CustomThemeImpl { 29 constructor(p34) { 30 this.colors = p34; 31 } 32} 33 34const TITLE_MAX_LINES = 2; 35const HORIZON_BUTTON_MAX_COUNT = 2; 36const VERTICAL_BUTTON_MAX_COUNT = 4; 37const BUTTON_LAYOUT_WEIGHT = 1; 38const CHECKBOX_CONTAINER_HEIGHT = 48; 39const CONTENT_MAX_LINES = 2; 40const LOADING_PROGRESS_WIDTH = 40; 41const LOADING_PROGRESS_HEIGHT = 40; 42const LOADING_MAX_LINES = 10; 43const LOADING_MAX_LINES_BIG_FONT = 4; 44const LOADING_TEXT_LAYOUT_WEIGHT = 1; 45const LOADING_TEXT_MARGIN_LEFT = 12; 46const LOADING_MIN_HEIGHT = 48; 47const LIST_MIN_HEIGHT = 48; 48const CHECKBOX_CONTAINER_LENGTH = 20; 49const TEXT_MIN_HEIGHT = 48; 50const DEFAULT_IMAGE_SIZE = 64; 51const MIN_CONTENT_HEIGHT = 100; 52const MAX_CONTENT_HEIGHT = 30000; 53const KEYCODE_UP = 2012; 54const KEYCODE_DOWN = 2013; 55const IGNORE_KEY_EVENT_TYPE = 1; 56const FIRST_ITEM_INDEX = 0; 57const VERSION_TWELVE = 50000012; 58const BUTTON_MIN_FONT_SIZE = 9; 59const MAX_FONT_SCALE = 2; 60const MAX_DIALOG_WIDTH = getNumberByResourceId(125831042, 400); 61const BUTTON_HORIZONTAL_MARGIN = getNumberByResourceId(125831054, 16); 62const BUTTON_HORIZONTAL_PADDING = getNumberByResourceId(125830927, 16); 63const CHECK_BOX_MARGIN_END = getNumberByResourceId(125830923, 8); 64const BUTTON_HORIZONTAL_SPACE = getNumberByResourceId(125831051, 8); 65const BODY_L = getNumberByResourceId(125830970, 16); 66const BODY_M = getNumberByResourceId(125830971, 14); 67const BODY_S = getNumberByResourceId(125830972, 12); 68const TITLE_S = getNumberByResourceId(125830966, 20); 69const SUBTITLE_S = getNumberByResourceId(125830969, 14); 70const PADDING_LEVEL_8 = getNumberByResourceId(125830927, 16); 71const DIALOG_DIVIDER_SHOW = getNumberByResourceId(125831202, 1, true); 72const ALERT_BUTTON_STYLE = getNumberByResourceId(125831085, 2, true); 73const ALERT_TITLE_ALIGNMENT = getEnumNumberByResourceId(125831126, 1); 74export class TipsDialog extends ViewPU { 75 constructor(i34, j34, k34, l34 = -1, m34 = undefined, n34) { 76 super(i34, k34, l34, n34); 77 if (typeof m34 === 'function') { 78 this.paramsGenerator_ = m34; 79 } 80 this.controller = undefined; 81 this.imageRes = null; 82 this.__imageSize = 83 new ObservedPropertyObjectPU({ width: DEFAULT_IMAGE_SIZE, height: DEFAULT_IMAGE_SIZE }, this, 'imageSize'); 84 this.title = null; 85 this.content = null; 86 this.checkAction = undefined; 87 this.onCheckedChange = undefined; 88 this.checkTips = null; 89 this.__isChecked = new ObservedPropertySimplePU(false, this, 'isChecked'); 90 this.primaryButton = null; 91 this.secondaryButton = null; 92 this.buttons = undefined; 93 this.__textAlignment = new ObservedPropertySimplePU(TextAlign.Start, this, 'textAlignment'); 94 this.marginOffset = 0; 95 this.contentScroller = new Scroller(); 96 this.__fontColorWithTheme = new ObservedPropertyObjectPU({ 97 'id': -1, 98 'type': 10001, 99 params: ['sys.color.font_primary'], 100 'bundleName': '__harDefaultBundleName__', 101 'moduleName': '__harDefaultModuleName__' 102 }, this, 'fontColorWithTheme'); 103 this.theme = new CustomThemeImpl({}); 104 this.themeColorMode = ThemeColorMode.SYSTEM; 105 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 106 this.__minContentHeight = new ObservedPropertySimplePU(160, this, 'minContentHeight'); 107 this.updateTextAlign = (o34) => { 108 if (this.content) { 109 this.textAlignment = getTextAlign(o34, this.content, `${BODY_L * this.fontSizeScale}vp`); 110 } 111 }; 112 this.imageIndex = 0; 113 this.textIndex = 1; 114 this.checkBoxIndex = 2; 115 this.setInitiallyProvidedValue(j34); 116 this.finalizeConstruction(); 117 } 118 119 setInitiallyProvidedValue(h34) { 120 if (h34.controller !== undefined) { 121 this.controller = h34.controller; 122 } 123 if (h34.imageRes !== undefined) { 124 this.imageRes = h34.imageRes; 125 } 126 if (h34.imageSize !== undefined) { 127 this.imageSize = h34.imageSize; 128 } 129 if (h34.title !== undefined) { 130 this.title = h34.title; 131 } 132 if (h34.content !== undefined) { 133 this.content = h34.content; 134 } 135 if (h34.checkAction !== undefined) { 136 this.checkAction = h34.checkAction; 137 } 138 if (h34.onCheckedChange !== undefined) { 139 this.onCheckedChange = h34.onCheckedChange; 140 } 141 if (h34.checkTips !== undefined) { 142 this.checkTips = h34.checkTips; 143 } 144 if (h34.isChecked !== undefined) { 145 this.isChecked = h34.isChecked; 146 } 147 if (h34.primaryButton !== undefined) { 148 this.primaryButton = h34.primaryButton; 149 } 150 if (h34.secondaryButton !== undefined) { 151 this.secondaryButton = h34.secondaryButton; 152 } 153 if (h34.buttons !== undefined) { 154 this.buttons = h34.buttons; 155 } 156 if (h34.textAlignment !== undefined) { 157 this.textAlignment = h34.textAlignment; 158 } 159 if (h34.marginOffset !== undefined) { 160 this.marginOffset = h34.marginOffset; 161 } 162 if (h34.contentScroller !== undefined) { 163 this.contentScroller = h34.contentScroller; 164 } 165 if (h34.fontColorWithTheme !== undefined) { 166 this.fontColorWithTheme = h34.fontColorWithTheme; 167 } 168 if (h34.theme !== undefined) { 169 this.theme = h34.theme; 170 } 171 if (h34.themeColorMode !== undefined) { 172 this.themeColorMode = h34.themeColorMode; 173 } 174 if (h34.fontSizeScale !== undefined) { 175 this.fontSizeScale = h34.fontSizeScale; 176 } 177 if (h34.minContentHeight !== undefined) { 178 this.minContentHeight = h34.minContentHeight; 179 } 180 if (h34.updateTextAlign !== undefined) { 181 this.updateTextAlign = h34.updateTextAlign; 182 } 183 if (h34.imageIndex !== undefined) { 184 this.imageIndex = h34.imageIndex; 185 } 186 if (h34.textIndex !== undefined) { 187 this.textIndex = h34.textIndex; 188 } 189 if (h34.checkBoxIndex !== undefined) { 190 this.checkBoxIndex = h34.checkBoxIndex; 191 } 192 } 193 194 updateStateVars(g34) { 195 } 196 197 purgeVariableDependenciesOnElmtId(f34) { 198 this.__imageSize.purgeDependencyOnElmtId(f34); 199 this.__isChecked.purgeDependencyOnElmtId(f34); 200 this.__textAlignment.purgeDependencyOnElmtId(f34); 201 this.__fontColorWithTheme.purgeDependencyOnElmtId(f34); 202 this.__fontSizeScale.purgeDependencyOnElmtId(f34); 203 this.__minContentHeight.purgeDependencyOnElmtId(f34); 204 } 205 206 aboutToBeDeleted() { 207 this.__imageSize.aboutToBeDeleted(); 208 this.__isChecked.aboutToBeDeleted(); 209 this.__textAlignment.aboutToBeDeleted(); 210 this.__fontColorWithTheme.aboutToBeDeleted(); 211 this.__fontSizeScale.aboutToBeDeleted(); 212 this.__minContentHeight.aboutToBeDeleted(); 213 SubscriberManager.Get().delete(this.id__()); 214 this.aboutToBeDeletedInternal(); 215 } 216 217 setController(e34) { 218 this.controller = e34; 219 } 220 221 get imageSize() { 222 return this.__imageSize.get(); 223 } 224 225 set imageSize(d34) { 226 this.__imageSize.set(d34); 227 } 228 229 get isChecked() { 230 return this.__isChecked.get(); 231 } 232 233 set isChecked(c34) { 234 this.__isChecked.set(c34); 235 } 236 237 get textAlignment() { 238 return this.__textAlignment.get(); 239 } 240 241 set textAlignment(b34) { 242 this.__textAlignment.set(b34); 243 } 244 245 get fontColorWithTheme() { 246 return this.__fontColorWithTheme.get(); 247 } 248 249 set fontColorWithTheme(a34) { 250 this.__fontColorWithTheme.set(a34); 251 } 252 253 get fontSizeScale() { 254 return this.__fontSizeScale.get(); 255 } 256 257 set fontSizeScale(z33) { 258 this.__fontSizeScale.set(z33); 259 } 260 261 get minContentHeight() { 262 return this.__minContentHeight.get(); 263 } 264 265 set minContentHeight(y33) { 266 this.__minContentHeight.set(y33); 267 } 268 269 initialRender() { 270 this.observeComponentCreation2((w33, x33) => { 271 __Common__.create(); 272 __Common__.constraintSize({ maxHeight: '100%' }); 273 }, __Common__); 274 { 275 this.observeComponentCreation2((s33, t33) => { 276 if (t33) { 277 let u33 = new CustomDialogContentComponent(this, { 278 controller: this.controller, 279 contentBuilder: () => { 280 this.contentBuilder(); 281 }, 282 buttons: this.buttons, 283 theme: this.theme, 284 themeColorMode: this.themeColorMode, 285 fontSizeScale: this.__fontSizeScale, 286 minContentHeight: this.__minContentHeight, 287 }, undefined, s33, () => { 288 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 131, col: 5 }); 289 ViewPU.create(u33); 290 let t = () => { 291 return { 292 controller: this.controller, 293 contentBuilder: () => { 294 this.contentBuilder(); 295 }, 296 buttons: this.buttons, 297 theme: this.theme, 298 themeColorMode: this.themeColorMode, 299 fontSizeScale: this.fontSizeScale, 300 minContentHeight: this.minContentHeight 301 }; 302 }; 303 u33.paramsGenerator_ = t; 304 } else { 305 this.updateStateVarsOfChildByElmtId(s33, {}); 306 } 307 }, { name: 'CustomDialogContentComponent' }); 308 } 309 __Common__.pop(); 310 } 311 312 contentBuilder(n32 = null) { 313 { 314 this.observeComponentCreation2((o32, p32) => { 315 if (p32) { 316 let q32 = new TipsDialogContentLayout(this, { 317 title: this.title, 318 content: this.content, 319 checkTips: this.checkTips, 320 minContentHeight: this.__minContentHeight, 321 updateTextAlign: this.updateTextAlign, 322 dialogBuilder: () => { 323 this.observeComponentCreation2((f33, g33) => { 324 ForEach.create(); 325 const s = i33 => { 326 const j33 = i33; 327 this.observeComponentCreation2((k33, l33) => { 328 If.create(); 329 if (j33 === this.imageIndex) { 330 this.ifElseBranchUpdateFunction(0, () => { 331 this.imagePart.bind(this)(); 332 }); 333 } else if (j33 === this.textIndex) { 334 this.ifElseBranchUpdateFunction(1, () => { 335 this.observeComponentCreation2((q33, r33) => { 336 Column.create(); 337 Column.padding({ 338 top: { 339 'id': -1, 340 'type': 10002, 341 params: ['sys.float.padding_level8'], 342 'bundleName': '__harDefaultBundleName__', 343 'moduleName': '__harDefaultModuleName__' 344 } 345 }); 346 }, Column); 347 this.observeComponentCreation2((o33, p33) => { 348 WithTheme.create({ 349 theme: this.theme, 350 colorMode: this.themeColorMode 351 }); 352 }, WithTheme); 353 this.textPart.bind(this)(); 354 WithTheme.pop(); 355 Column.pop(); 356 }); 357 } else { 358 this.ifElseBranchUpdateFunction(2, () => { 359 this.observeComponentCreation2((m33, n33) => { 360 WithTheme.create({ 361 theme: this.theme, 362 colorMode: this.themeColorMode 363 }); 364 }, WithTheme); 365 this.checkBoxPart.bind(this)(); 366 WithTheme.pop(); 367 }); 368 } 369 }, If); 370 If.pop(); 371 }; 372 this.forEachUpdateFunction(f33, [this.imageIndex, this.textIndex, 373 this.checkBoxIndex], s); 374 }, ForEach); 375 ForEach.pop(); 376 } 377 }, undefined, o32, () => { 378 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 146, col: 5 }); 379 ViewPU.create(q32); 380 let q = () => { 381 return { 382 title: this.title, 383 content: this.content, 384 checkTips: this.checkTips, 385 minContentHeight: this.minContentHeight, 386 updateTextAlign: this.updateTextAlign, 387 dialogBuilder: () => { 388 this.observeComponentCreation2((s32, t32) => { 389 ForEach.create(); 390 const r = v32 => { 391 const w32 = v32; 392 this.observeComponentCreation2((x32, y32) => { 393 If.create(); 394 if (w32 === this.imageIndex) { 395 this.ifElseBranchUpdateFunction(0, () => { 396 this.imagePart.bind(this)(); 397 }); 398 } else if (w32 === this.textIndex) { 399 this.ifElseBranchUpdateFunction(1, () => { 400 this.observeComponentCreation2((d33, e33) => { 401 Column.create(); 402 Column.padding({ 403 top: { 404 'id': -1, 405 'type': 10002, 406 params: ['sys.float.padding_level8'], 407 'bundleName': '__harDefaultBundleName__', 408 'moduleName': '__harDefaultModuleName__' 409 } 410 }); 411 }, Column); 412 this.observeComponentCreation2((b33, c33) => { 413 WithTheme.create({ 414 theme: this.theme, 415 colorMode: this.themeColorMode 416 }); 417 }, WithTheme); 418 this.textPart.bind(this)(); 419 WithTheme.pop(); 420 Column.pop(); 421 }); 422 } else { 423 this.ifElseBranchUpdateFunction(2, () => { 424 this.observeComponentCreation2((z32, a33) => { 425 WithTheme.create({ 426 theme: this.theme, 427 colorMode: this.themeColorMode 428 }); 429 }, WithTheme); 430 this.checkBoxPart.bind(this)(); 431 WithTheme.pop(); 432 }); 433 } 434 }, If); 435 If.pop(); 436 }; 437 this.forEachUpdateFunction(s32, 438 [this.imageIndex, this.textIndex, this.checkBoxIndex], r); 439 }, ForEach); 440 ForEach.pop(); 441 } 442 }; 443 }; 444 q32.paramsGenerator_ = q; 445 } else { 446 this.updateStateVarsOfChildByElmtId(o32, {}); 447 } 448 }, { name: 'TipsDialogContentLayout' }); 449 } 450 } 451 452 checkBoxPart(d32 = null) { 453 this.observeComponentCreation2((l32, m32) => { 454 Row.create(); 455 Row.accessibilityGroup(true); 456 Row.onClick(() => { 457 this.isChecked = !this.isChecked; 458 if (this.checkAction) { 459 this.checkAction(this.isChecked); 460 } 461 }); 462 Row.padding({ top: 8, bottom: 8 }); 463 Row.constraintSize({ minHeight: CHECKBOX_CONTAINER_HEIGHT }); 464 Row.width('100%'); 465 }, Row); 466 this.observeComponentCreation2((e32, f32) => { 467 If.create(); 468 if (this.checkTips !== null) { 469 this.ifElseBranchUpdateFunction(0, () => { 470 this.observeComponentCreation2((i32, j32) => { 471 Checkbox.create({ name: '', group: 'checkboxGroup' }); 472 Checkbox.select(this.isChecked); 473 Checkbox.onChange((k32) => { 474 this.isChecked = k32; 475 if (this.checkAction) { 476 this.checkAction(k32); 477 } 478 if (this.onCheckedChange) { 479 this.onCheckedChange(k32); 480 } 481 }); 482 Checkbox.accessibilityLevel('yes'); 483 Checkbox.margin({ 484 start: LengthMetrics.vp(0), 485 end: LengthMetrics.vp(CHECK_BOX_MARGIN_END) 486 }); 487 }, Checkbox); 488 Checkbox.pop(); 489 this.observeComponentCreation2((g32, h32) => { 490 Text.create(this.checkTips); 491 Text.fontSize(`${BODY_L}fp`); 492 Text.fontWeight(FontWeight.Regular); 493 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 494 Text.maxLines(CONTENT_MAX_LINES); 495 Text.layoutWeight(1); 496 Text.focusable(false); 497 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 498 }, Text); 499 Text.pop(); 500 }); 501 } else { 502 this.ifElseBranchUpdateFunction(1, () => { 503 }); 504 } 505 }, If); 506 If.pop(); 507 Row.pop(); 508 } 509 510 imagePart(y31 = null) { 511 this.observeComponentCreation2((b32, c32) => { 512 Column.create(); 513 Column.width('100%'); 514 }, Column); 515 this.observeComponentCreation2((z31, a32) => { 516 Image.create(this.imageRes); 517 Image.objectFit(ImageFit.Contain); 518 Image.borderRadius({ 519 'id': -1, 520 'type': 10002, 521 params: ['sys.float.corner_radius_level6'], 522 'bundleName': '__harDefaultBundleName__', 523 'moduleName': '__harDefaultModuleName__' 524 }); 525 Image.constraintSize({ 526 maxWidth: this.imageSize?.width ?? DEFAULT_IMAGE_SIZE, 527 maxHeight: this.imageSize?.height ?? DEFAULT_IMAGE_SIZE 528 }); 529 }, Image); 530 Column.pop(); 531 } 532 533 textPart(g31 = null) { 534 this.observeComponentCreation2((w31, x31) => { 535 Scroll.create(this.contentScroller); 536 Scroll.nestedScroll({ 537 scrollForward: NestedScrollMode.PARALLEL, 538 scrollBackward: NestedScrollMode.PARALLEL 539 }); 540 Scroll.margin({ end: LengthMetrics.vp(this.marginOffset) }); 541 }, Scroll); 542 this.observeComponentCreation2((u31, v31) => { 543 Column.create(); 544 Column.margin({ 545 end: LengthMetrics.resource({ 546 'id': -1, 547 'type': 10002, 548 params: ['sys.float.padding_level8'], 549 'bundleName': '__harDefaultBundleName__', 550 'moduleName': '__harDefaultModuleName__' 551 }) 552 }); 553 }, Column); 554 this.observeComponentCreation2((o31, p31) => { 555 If.create(); 556 if (this.title !== null) { 557 this.ifElseBranchUpdateFunction(0, () => { 558 this.observeComponentCreation2((s31, t31) => { 559 Row.create(); 560 Row.padding({ 561 bottom: { 562 'id': -1, 563 'type': 10002, 564 params: ['sys.float.padding_level8'], 565 'bundleName': '__harDefaultBundleName__', 566 'moduleName': '__harDefaultModuleName__' 567 } 568 }); 569 }, Row); 570 this.observeComponentCreation2((q31, r31) => { 571 Text.create(this.title); 572 Text.fontSize(`${TITLE_S}fp`); 573 Text.fontWeight(FontWeight.Bold); 574 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 575 Text.textAlign(TextAlign.Center); 576 Text.maxLines(CONTENT_MAX_LINES); 577 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 578 Text.width('100%'); 579 }, Text); 580 Text.pop(); 581 Row.pop(); 582 }); 583 } else { 584 this.ifElseBranchUpdateFunction(1, () => { 585 }); 586 } 587 }, If); 588 If.pop(); 589 this.observeComponentCreation2((h31, i31) => { 590 If.create(); 591 if (this.content !== null) { 592 this.ifElseBranchUpdateFunction(0, () => { 593 this.observeComponentCreation2((m31, n31) => { 594 Row.create(); 595 }, Row); 596 this.observeComponentCreation2((j31, k31) => { 597 Text.create(this.content); 598 Text.focusable(true); 599 Text.defaultFocus(!(this.primaryButton || this.secondaryButton)); 600 Text.focusBox({ 601 strokeWidth: LengthMetrics.px(0) 602 }); 603 Text.fontSize(this.getContentFontSize()); 604 Text.fontWeight(FontWeight.Medium); 605 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 606 Text.textAlign(this.textAlignment); 607 Text.width('100%'); 608 Text.onKeyEvent((l31) => { 609 if (l31) { 610 resolveKeyEvent(l31, this.contentScroller); 611 } 612 }); 613 }, Text); 614 Text.pop(); 615 Row.pop(); 616 }); 617 } else { 618 this.ifElseBranchUpdateFunction(1, () => { 619 }); 620 } 621 }, If); 622 If.pop(); 623 Column.pop(); 624 Scroll.pop(); 625 } 626 627 aboutToAppear() { 628 this.fontColorWithTheme = this.theme?.colors?.fontPrimary ? 629 this.theme.colors.fontPrimary : { 630 'id': -1, 631 'type': 10001, 632 params: ['sys.color.font_primary'], 633 'bundleName': '__harDefaultBundleName__', 634 'moduleName': '__harDefaultModuleName__' 635 }; 636 this.initButtons(); 637 this.initMargin(); 638 } 639 640 getContentFontSize() { 641 return BODY_L + 'fp'; 642 } 643 644 initButtons() { 645 if (!this.primaryButton && !this.secondaryButton) { 646 return; 647 } 648 this.buttons = []; 649 if (this.primaryButton) { 650 this.buttons.push(this.primaryButton); 651 } 652 if (this.secondaryButton) { 653 this.buttons.push(this.secondaryButton); 654 } 655 } 656 657 initMargin() { 658 this.marginOffset = 0 - PADDING_LEVEL_8; 659 } 660 661 rerender() { 662 this.updateDirtyElements(); 663 } 664} 665 666class TipsDialogContentLayout extends ViewPU { 667 constructor(z30, a31, b31, c31 = -1, d31 = undefined, e31) { 668 super(z30, b31, c31, e31); 669 if (typeof d31 === "function") { 670 this.paramsGenerator_ = d31; 671 } 672 this.title = null; 673 this.content = null; 674 this.checkTips = null; 675 this.updateTextAlign = (f31) => { 676 }; 677 this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(a31.minContentHeight, this, 'minContentHeight'); 678 this.dialogBuilder = this.doNothingBuilder; 679 this.imageIndex = 0; 680 this.textIndex = 1; 681 this.checkBoxIndex = 2; 682 this.childrenSize = 3; 683 this.setInitiallyProvidedValue(a31); 684 this.finalizeConstruction(); 685 } 686 687 setInitiallyProvidedValue(y30) { 688 if (y30.title !== undefined) { 689 this.title = y30.title; 690 } 691 if (y30.content !== undefined) { 692 this.content = y30.content; 693 } 694 if (y30.checkTips !== undefined) { 695 this.checkTips = y30.checkTips; 696 } 697 if (y30.updateTextAlign !== undefined) { 698 this.updateTextAlign = y30.updateTextAlign; 699 } 700 if (y30.dialogBuilder !== undefined) { 701 this.dialogBuilder = y30.dialogBuilder; 702 } 703 if (y30.imageIndex !== undefined) { 704 this.imageIndex = y30.imageIndex; 705 } 706 if (y30.textIndex !== undefined) { 707 this.textIndex = y30.textIndex; 708 } 709 if (y30.checkBoxIndex !== undefined) { 710 this.checkBoxIndex = y30.checkBoxIndex; 711 } 712 if (y30.childrenSize !== undefined) { 713 this.childrenSize = y30.childrenSize; 714 } 715 } 716 717 updateStateVars(x30) { 718 } 719 720 purgeVariableDependenciesOnElmtId(w30) { 721 this.__minContentHeight.purgeDependencyOnElmtId(w30); 722 } 723 724 aboutToBeDeleted() { 725 this.__minContentHeight.aboutToBeDeleted(); 726 SubscriberManager.Get().delete(this.id__()); 727 this.aboutToBeDeletedInternal(); 728 } 729 730 doNothingBuilder(v30 = null) { 731 } 732 733 get minContentHeight() { 734 return this.__minContentHeight.get(); 735 } 736 737 set minContentHeight(u30) { 738 this.__minContentHeight.set(u30); 739 } 740 741 onPlaceChildren(n30, o30, p30) { 742 let q30 = 0; 743 let r30 = 0; 744 for (let s30 = 0; s30 < o30.length; s30++) { 745 let t30 = o30[s30]; 746 t30.layout({ x: q30, y: r30 }); 747 r30 += t30.measureResult.height; 748 } 749 } 750 751 onMeasureSize(v29, w29, x29) { 752 let y29 = { width: Number(x29.maxWidth), height: 0 }; 753 if (w29.length < this.childrenSize) { 754 return y29; 755 } 756 let z29 = 0; 757 let a30 = 0; 758 if (this.checkTips !== null) { 759 let k30 = w29[this.checkBoxIndex]; 760 let l30 = { 761 maxWidth: x29.maxWidth, 762 minHeight: CHECKBOX_CONTAINER_HEIGHT, 763 maxHeight: x29.maxHeight 764 }; 765 let m30 = k30.measure(l30); 766 a30 = m30.height; 767 z29 += a30; 768 } 769 let b30 = w29[this.imageIndex]; 770 let c30 = 0; 771 if (this.title !== null || this.content !== null) { 772 c30 = TEXT_MIN_HEIGHT + PADDING_LEVEL_8; 773 } 774 let d30 = Number(x29.maxHeight) - a30 - c30; 775 let e30 = { 776 maxWidth: x29.maxWidth, 777 maxHeight: d30 778 }; 779 let f30 = b30.measure(e30); 780 z29 += f30.height; 781 if (this.title !== null || this.content !== null) { 782 let g30 = w29[this.textIndex]; 783 this.updateTextAlign(y29.width); 784 let h30 = Number(x29.maxHeight) - f30.height - a30; 785 let i30 = { 786 maxWidth: x29.maxWidth, 787 maxHeight: Math.max(h30, TEXT_MIN_HEIGHT) 788 }; 789 let j30 = g30.measure(i30); 790 z29 += j30.height; 791 } 792 y29.height = z29; 793 this.minContentHeight = Math.max(a30 + f30.height + c30, MIN_CONTENT_HEIGHT); 794 return y29; 795 } 796 797 initialRender() { 798 this.dialogBuilder.bind(this)(); 799 } 800 801 rerender() { 802 this.updateDirtyElements(); 803 } 804} 805 806export class SelectDialog extends ViewPU { 807 constructor(p29, q29, r29, s29 = -1, t29 = undefined, u29) { 808 super(p29, r29, s29, u29); 809 if (typeof t29 === 'function') { 810 this.paramsGenerator_ = t29; 811 } 812 this.controller = undefined; 813 this.title = ''; 814 this.content = ''; 815 this.confirm = null; 816 this.radioContent = []; 817 this.buttons = []; 818 this.contentPadding = undefined; 819 this.isFocus = false; 820 this.currentFocusIndex = -1; 821 this.radioHeight = 0; 822 this.itemHeight = 0; 823 this.__selectedIndex = new ObservedPropertySimplePU(-1, this, 'selectedIndex'); 824 this.contentBuilder = this.buildContent; 825 this.__fontColorWithTheme = new ObservedPropertyObjectPU({ 826 'id': -1, 827 'type': 10001, 828 params: ['sys.color.font_primary'], 829 'bundleName': '__harDefaultBundleName__', 830 'moduleName': '__harDefaultModuleName__' 831 }, this, 'fontColorWithTheme'); 832 this.__dividerColorWithTheme = new ObservedPropertyObjectPU({ 833 'id': -1, 834 'type': 10001, 835 params: ['sys.color.comp_divider'], 836 'bundleName': '__harDefaultBundleName__', 837 'moduleName': '__harDefaultModuleName__' 838 }, this, 'dividerColorWithTheme'); 839 this.theme = new CustomThemeImpl({}); 840 this.themeColorMode = ThemeColorMode.SYSTEM; 841 this.contentScroller = new Scroller(); 842 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 843 this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight'); 844 this.setInitiallyProvidedValue(q29); 845 this.finalizeConstruction(); 846 } 847 848 setInitiallyProvidedValue(o29) { 849 if (o29.controller !== undefined) { 850 this.controller = o29.controller; 851 } 852 if (o29.title !== undefined) { 853 this.title = o29.title; 854 } 855 if (o29.content !== undefined) { 856 this.content = o29.content; 857 } 858 if (o29.confirm !== undefined) { 859 this.confirm = o29.confirm; 860 } 861 if (o29.radioContent !== undefined) { 862 this.radioContent = o29.radioContent; 863 } 864 if (o29.buttons !== undefined) { 865 this.buttons = o29.buttons; 866 } 867 if (o29.contentPadding !== undefined) { 868 this.contentPadding = o29.contentPadding; 869 } 870 if (o29.isFocus !== undefined) { 871 this.isFocus = o29.isFocus; 872 } 873 if (o29.currentFocusIndex !== undefined) { 874 this.currentFocusIndex = o29.currentFocusIndex; 875 } 876 if (o29.radioHeight !== undefined) { 877 this.radioHeight = o29.radioHeight; 878 } 879 if (o29.itemHeight !== undefined) { 880 this.itemHeight = o29.itemHeight; 881 } 882 if (o29.selectedIndex !== undefined) { 883 this.selectedIndex = o29.selectedIndex; 884 } 885 if (o29.contentBuilder !== undefined) { 886 this.contentBuilder = o29.contentBuilder; 887 } 888 if (o29.fontColorWithTheme !== undefined) { 889 this.fontColorWithTheme = o29.fontColorWithTheme; 890 } 891 if (o29.dividerColorWithTheme !== undefined) { 892 this.dividerColorWithTheme = o29.dividerColorWithTheme; 893 } 894 if (o29.theme !== undefined) { 895 this.theme = o29.theme; 896 } 897 if (o29.themeColorMode !== undefined) { 898 this.themeColorMode = o29.themeColorMode; 899 } 900 if (o29.contentScroller !== undefined) { 901 this.contentScroller = o29.contentScroller; 902 } 903 if (o29.fontSizeScale !== undefined) { 904 this.fontSizeScale = o29.fontSizeScale; 905 } 906 if (o29.minContentHeight !== undefined) { 907 this.minContentHeight = o29.minContentHeight; 908 } 909 } 910 911 updateStateVars(n29) { 912 } 913 914 purgeVariableDependenciesOnElmtId(m29) { 915 this.__selectedIndex.purgeDependencyOnElmtId(m29); 916 this.__fontColorWithTheme.purgeDependencyOnElmtId(m29); 917 this.__dividerColorWithTheme.purgeDependencyOnElmtId(m29); 918 this.__fontSizeScale.purgeDependencyOnElmtId(m29); 919 this.__minContentHeight.purgeDependencyOnElmtId(m29); 920 } 921 aboutToBeDeleted() { 922 this.__selectedIndex.aboutToBeDeleted(); 923 this.__fontColorWithTheme.aboutToBeDeleted(); 924 this.__dividerColorWithTheme.aboutToBeDeleted(); 925 this.__fontSizeScale.aboutToBeDeleted(); 926 this.__minContentHeight.aboutToBeDeleted(); 927 SubscriberManager.Get().delete(this.id__()); 928 this.aboutToBeDeletedInternal(); 929 } 930 931 setController(l29) { 932 this.controller = l29; 933 } 934 935 get selectedIndex() { 936 return this.__selectedIndex.get(); 937 } 938 939 set selectedIndex(k29) { 940 this.__selectedIndex.set(k29); 941 } 942 943 get fontColorWithTheme() { 944 return this.__fontColorWithTheme.get(); 945 } 946 947 set fontColorWithTheme(j29) { 948 this.__fontColorWithTheme.set(j29); 949 } 950 951 get dividerColorWithTheme() { 952 return this.__dividerColorWithTheme.get(); 953 } 954 955 set dividerColorWithTheme(i29) { 956 this.__dividerColorWithTheme.set(i29); 957 } 958 959 get fontSizeScale() { 960 return this.__fontSizeScale.get(); 961 } 962 963 set fontSizeScale(h29) { 964 this.__fontSizeScale.set(h29); 965 } 966 967 get minContentHeight() { 968 return this.__minContentHeight.get(); 969 } 970 971 set minContentHeight(g29) { 972 this.__minContentHeight.set(g29); 973 } 974 buildContent(j27 = null) { 975 this.observeComponentCreation2((b29, c29) => { 976 Scroll.create(this.contentScroller); 977 Scroll.scrollBar(BarState.Auto); 978 Scroll.nestedScroll({ 979 scrollForward: NestedScrollMode.PARALLEL, 980 scrollBackward: NestedScrollMode.PARALLEL 981 }); 982 Scroll.onDidScroll((d29, e29) => { 983 let f29 = (this.itemHeight - this.radioHeight) / 2; 984 if (this.isFocus) { 985 if (this.currentFocusIndex === this.radioContent.length - 1) { 986 this.contentScroller.scrollEdge(Edge.Bottom); 987 this.currentFocusIndex = -1; 988 } else if (this.currentFocusIndex === FIRST_ITEM_INDEX) { 989 this.contentScroller.scrollEdge(Edge.Top); 990 this.currentFocusIndex = -1; 991 } else { 992 if (e29 > 0) { 993 this.contentScroller.scrollBy(0, f29); 994 } else if (e29 < 0) { 995 this.contentScroller.scrollBy(0, 0 - f29); 996 } 997 } 998 this.isFocus = false; 999 } 1000 }); 1001 }, Scroll); 1002 this.observeComponentCreation2((z28, a29) => { 1003 Column.create(); 1004 }, Column); 1005 this.observeComponentCreation2((t28, u28) => { 1006 If.create(); 1007 if (this.content) { 1008 this.ifElseBranchUpdateFunction(0, () => { 1009 this.observeComponentCreation2((x28, y28) => { 1010 Row.create(); 1011 Row.padding({ 1012 left: { 1013 'id': -1, 1014 'type': 10002, 1015 params: ['sys.float.padding_level12'], 1016 'bundleName': '__harDefaultBundleName__', 1017 'moduleName': '__harDefaultModuleName__' 1018 }, 1019 right: { 1020 'id': -1, 1021 'type': 10002, 1022 params: ['sys.float.padding_level12'], 1023 'bundleName': '__harDefaultBundleName__', 1024 'moduleName': '__harDefaultModuleName__' 1025 }, 1026 bottom: { 1027 'id': -1, 1028 'type': 10002, 1029 params: ['sys.float.padding_level4'], 1030 'bundleName': '__harDefaultBundleName__', 1031 'moduleName': '__harDefaultModuleName__' 1032 } 1033 }); 1034 Row.width('100%'); 1035 }, Row); 1036 this.observeComponentCreation2((v28, w28) => { 1037 Text.create(this.content); 1038 Text.fontSize(`${BODY_M}fp`); 1039 Text.fontWeight(FontWeight.Regular); 1040 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 1041 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1042 }, Text); 1043 Text.pop(); 1044 Row.pop(); 1045 }); 1046 } else { 1047 this.ifElseBranchUpdateFunction(1, () => { 1048 }); 1049 } 1050 }, If); 1051 If.pop(); 1052 this.observeComponentCreation2((r28, s28) => { 1053 List.create(); 1054 List.width('100%'); 1055 List.clip(false); 1056 List.onFocus(() => { 1057 if (!this.contentScroller.isAtEnd()) { 1058 this.contentScroller.scrollEdge(Edge.Top); 1059 focusControl.requestFocus(String(FIRST_ITEM_INDEX)); 1060 } 1061 }); 1062 List.defaultFocus(this.buttons?.length === 0 ? true : false); 1063 }, List); 1064 this.observeComponentCreation2((k27, l27) => { 1065 ForEach.create(); 1066 const m = (n27, o27) => { 1067 const p27 = n27; 1068 { 1069 const n = (p28, q28) => { 1070 ViewStackProcessor.StartGetAccessRecordingFor(p28); 1071 o(p28, q28); 1072 if (!q28) { 1073 ListItem.pop(); 1074 } 1075 ViewStackProcessor.StopGetAccessRecording(); 1076 }; 1077 const o = (l28, m28) => { 1078 ListItem.create(p, true); 1079 ListItem.padding({ 1080 left: { 1081 'id': -1, 1082 'type': 10002, 1083 params: ['sys.float.padding_level6'], 1084 'bundleName': '__harDefaultBundleName__', 1085 'moduleName': '__harDefaultModuleName__' 1086 }, 1087 right: { 1088 'id': -1, 1089 'type': 10002, 1090 params: ['sys.float.padding_level6'], 1091 'bundleName': '__harDefaultBundleName__', 1092 'moduleName': '__harDefaultModuleName__' 1093 } 1094 }); 1095 ListItem.onSizeChange((n28, o28) => { 1096 this.itemHeight = Number(o28.height); 1097 }); 1098 }; 1099 const p = (t27, u27) => { 1100 n(t27, u27); 1101 this.observeComponentCreation2((j28, k28) => { 1102 Column.create(); 1103 Column.borderRadius({ 1104 'id': -1, 1105 'type': 10002, 1106 params: ['sys.float.corner_radius_level8'], 1107 'bundleName': '__harDefaultBundleName__', 1108 'moduleName': '__harDefaultModuleName__' 1109 }); 1110 Column.focusBox({ 1111 margin: { value: -2, unit: LengthUnit.VP } 1112 }); 1113 Column.accessibilityText(getAccessibilityText(p27.title, this.selectedIndex === o27)); 1114 Column.onClick(() => { 1115 this.selectedIndex = o27; 1116 p27.action && p27.action(); 1117 this.controller?.close(); 1118 }); 1119 }, Column); 1120 this.observeComponentCreation2((h28, i28) => { 1121 Button.createWithChild(); 1122 Button.type(ButtonType.Normal); 1123 Button.borderRadius({ 1124 'id': -1, 1125 'type': 10002, 1126 params: ['sys.float.corner_radius_level8'], 1127 'bundleName': '__harDefaultBundleName__', 1128 'moduleName': '__harDefaultModuleName__' 1129 }); 1130 Button.buttonStyle(ButtonStyleMode.TEXTUAL); 1131 Button.padding({ 1132 left: { 1133 'id': -1, 1134 'type': 10002, 1135 params: ['sys.float.padding_level6'], 1136 'bundleName': '__harDefaultBundleName__', 1137 'moduleName': '__harDefaultModuleName__' 1138 }, 1139 right: { 1140 'id': -1, 1141 'type': 10002, 1142 params: ['sys.float.padding_level6'], 1143 'bundleName': '__harDefaultBundleName__', 1144 'moduleName': '__harDefaultModuleName__' 1145 } 1146 }); 1147 }, Button); 1148 this.observeComponentCreation2((f28, g28) => { 1149 Row.create(); 1150 Row.constraintSize({ minHeight: LIST_MIN_HEIGHT }); 1151 Row.clip(false); 1152 Row.padding({ 1153 top: { 1154 'id': -1, 1155 'type': 10002, 1156 params: ['sys.float.padding_level4'], 1157 'bundleName': '__harDefaultBundleName__', 1158 'moduleName': '__harDefaultModuleName__' 1159 }, 1160 bottom: { 1161 'id': -1, 1162 'type': 10002, 1163 params: ['sys.float.padding_level4'], 1164 'bundleName': '__harDefaultBundleName__', 1165 'moduleName': '__harDefaultModuleName__' 1166 } 1167 }); 1168 }, Row); 1169 this.observeComponentCreation2((d28, e28) => { 1170 Text.create(p27.title); 1171 Text.fontSize(`${BODY_L}fp`); 1172 Text.fontWeight(FontWeight.Medium); 1173 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 1174 Text.layoutWeight(1); 1175 }, Text); 1176 Text.pop(); 1177 this.observeComponentCreation2((z27, a28) => { 1178 Radio.create({ value: 'item.title', group: 'radioGroup' }); 1179 Radio.size({ width: CHECKBOX_CONTAINER_LENGTH, height: CHECKBOX_CONTAINER_LENGTH }); 1180 Radio.checked(this.selectedIndex === o27); 1181 Radio.hitTestBehavior(HitTestMode.None); 1182 Radio.id(String(o27)); 1183 Radio.focusable(false); 1184 Radio.accessibilityLevel('no'); 1185 Radio.onFocus(() => { 1186 this.isFocus = true; 1187 this.currentFocusIndex = o27; 1188 if (o27 === FIRST_ITEM_INDEX) { 1189 this.contentScroller.scrollEdge(Edge.Top); 1190 } else if (o27 === this.radioContent.length - 1) { 1191 this.contentScroller.scrollEdge(Edge.Bottom); 1192 } 1193 }); 1194 Radio.onSizeChange((b28, c28) => { 1195 this.radioHeight = Number(c28.height); 1196 }); 1197 }, Radio); 1198 Row.pop(); 1199 Button.pop(); 1200 this.observeComponentCreation2((v27, w27) => { 1201 If.create(); 1202 if (o27 < this.radioContent.length - 1) { 1203 this.ifElseBranchUpdateFunction(0, () => { 1204 this.observeComponentCreation2((x27, y27) => { 1205 Divider.create(); 1206 Divider.color(ObservedObject.GetRawObject(this.dividerColorWithTheme)); 1207 Divider.padding({ 1208 left: { 1209 'id': -1, 1210 'type': 10002, 1211 params: ['sys.float.padding_level6'], 1212 'bundleName': '__harDefaultBundleName__', 1213 'moduleName': '__harDefaultModuleName__' 1214 }, 1215 right: { 1216 'id': -1, 1217 'type': 10002, 1218 params: ['sys.float.padding_level6'], 1219 'bundleName': '__harDefaultBundleName__', 1220 'moduleName': '__harDefaultModuleName__' 1221 } 1222 }); 1223 }, Divider); 1224 }); 1225 } else { 1226 this.ifElseBranchUpdateFunction(1, () => { 1227 }); 1228 } 1229 }, If); 1230 If.pop(); 1231 Column.pop(); 1232 ListItem.pop(); 1233 }; 1234 this.observeComponentCreation2(o, ListItem); 1235 ListItem.pop(); 1236 } 1237 }; 1238 this.forEachUpdateFunction(k27, this.radioContent, m, undefined, true, false); 1239 }, ForEach); 1240 ForEach.pop(); 1241 List.pop(); 1242 Column.pop(); 1243 Scroll.pop(); 1244 } 1245 1246 initialRender() { 1247 this.observeComponentCreation2((h27, i27) => { 1248 __Common__.create(); 1249 __Common__.constraintSize({ maxHeight: '100%' }); 1250 }, __Common__); 1251 { 1252 this.observeComponentCreation2((d27, e27) => { 1253 if (e27) { 1254 let f27 = new CustomDialogContentComponent(this, { 1255 controller: this.controller, 1256 primaryTitle: this.title, 1257 contentBuilder: () => { 1258 this.contentBuilder(); 1259 }, 1260 buttons: this.buttons, 1261 contentAreaPadding: this.contentPadding, 1262 theme: this.theme, 1263 themeColorMode: this.themeColorMode, 1264 fontSizeScale: this.__fontSizeScale, 1265 minContentHeight: this.__minContentHeight, 1266 }, undefined, d27, () => { 1267 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 526, col: 5 }); 1268 ViewPU.create(f27); 1269 let l = () => { 1270 return { 1271 controller: this.controller, 1272 primaryTitle: this.title, 1273 contentBuilder: () => { 1274 this.contentBuilder(); 1275 }, 1276 buttons: this.buttons, 1277 contentAreaPadding: this.contentPadding, 1278 theme: this.theme, 1279 themeColorMode: this.themeColorMode, 1280 fontSizeScale: this.fontSizeScale, 1281 minContentHeight: this.minContentHeight 1282 }; 1283 }; 1284 f27.paramsGenerator_ = l; 1285 } else { 1286 this.updateStateVarsOfChildByElmtId(d27, {}); 1287 } 1288 }, { name: 'CustomDialogContentComponent' }); 1289 } 1290 __Common__.pop(); 1291 } 1292 1293 aboutToAppear() { 1294 this.fontColorWithTheme = this.theme?.colors?.fontPrimary ? 1295 this.theme.colors.fontPrimary : { 1296 'id': -1, 1297 'type': 10001, 1298 params: ['sys.color.font_primary'], 1299 'bundleName': '__harDefaultBundleName__', 1300 'moduleName': '__harDefaultModuleName__' 1301 }; 1302 this.dividerColorWithTheme = this.theme?.colors?.compDivider ? 1303 this.theme.colors.compDivider : { 1304 'id': -1, 1305 'type': 10001, 1306 params: ['sys.color.comp_divider'], 1307 'bundleName': '__harDefaultBundleName__', 1308 'moduleName': '__harDefaultModuleName__' 1309 }; 1310 this.initContentPadding(); 1311 this.initButtons(); 1312 } 1313 1314 initContentPadding() { 1315 this.contentPadding = { 1316 left: { 1317 'id': -1, 1318 'type': 10002, 1319 params: ['sys.float.padding_level0'], 1320 'bundleName': '__harDefaultBundleName__', 1321 'moduleName': '__harDefaultModuleName__' 1322 }, 1323 right: { 1324 'id': -1, 1325 'type': 10002, 1326 params: ['sys.float.padding_level0'], 1327 'bundleName': '__harDefaultBundleName__', 1328 'moduleName': '__harDefaultModuleName__' 1329 } 1330 }; 1331 if (!this.title && !this.confirm) { 1332 this.contentPadding = { 1333 top: { 1334 'id': -1, 1335 'type': 10002, 1336 params: ['sys.float.padding_level12'], 1337 'bundleName': '__harDefaultBundleName__', 1338 'moduleName': '__harDefaultModuleName__' 1339 }, 1340 bottom: { 1341 'id': -1, 1342 'type': 10002, 1343 params: ['sys.float.padding_level12'], 1344 'bundleName': '__harDefaultBundleName__', 1345 'moduleName': '__harDefaultModuleName__' 1346 } 1347 }; 1348 return; 1349 } 1350 if (!this.title) { 1351 this.contentPadding = { 1352 top: { 1353 'id': -1, 1354 'type': 10002, 1355 params: ['sys.float.padding_level12'], 1356 'bundleName': '__harDefaultBundleName__', 1357 'moduleName': '__harDefaultModuleName__' 1358 } 1359 }; 1360 } else if (!this.confirm) { 1361 this.contentPadding = { 1362 bottom: { 1363 'id': -1, 1364 'type': 10002, 1365 params: ['sys.float.padding_level12'], 1366 'bundleName': '__harDefaultBundleName__', 1367 'moduleName': '__harDefaultModuleName__' 1368 } 1369 }; 1370 } 1371 } 1372 1373 initButtons() { 1374 this.buttons = []; 1375 if (this.confirm) { 1376 this.buttons.push(this.confirm); 1377 } 1378 } 1379 1380 rerender() { 1381 this.updateDirtyElements(); 1382 } 1383} 1384 1385class ConfirmDialogContentLayout extends ViewPU { 1386 constructor(w26, x26, y26, z26 = -1, a27 = undefined, b27) { 1387 super(w26, y26, z26, b27); 1388 if (typeof a27 === 'function') { 1389 this.paramsGenerator_ = a27; 1390 } 1391 this.textIndex = 0; 1392 this.checkboxIndex = 1; 1393 this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(x26.minContentHeight, this, 'minContentHeight'); 1394 this.updateTextAlign = (c27) => { 1395 }; 1396 this.dialogBuilder = this.doNothingBuilder; 1397 this.setInitiallyProvidedValue(x26); 1398 this.finalizeConstruction(); 1399 } 1400 1401 setInitiallyProvidedValue(v26) { 1402 if (v26.textIndex !== undefined) { 1403 this.textIndex = v26.textIndex; 1404 } 1405 if (v26.checkboxIndex !== undefined) { 1406 this.checkboxIndex = v26.checkboxIndex; 1407 } 1408 if (v26.updateTextAlign !== undefined) { 1409 this.updateTextAlign = v26.updateTextAlign; 1410 } 1411 if (v26.dialogBuilder !== undefined) { 1412 this.dialogBuilder = v26.dialogBuilder; 1413 } 1414 } 1415 1416 updateStateVars(u26) { 1417 } 1418 1419 purgeVariableDependenciesOnElmtId(t26) { 1420 this.__minContentHeight.purgeDependencyOnElmtId(t26); 1421 } 1422 1423 aboutToBeDeleted() { 1424 this.__minContentHeight.aboutToBeDeleted(); 1425 SubscriberManager.Get().delete(this.id__()); 1426 this.aboutToBeDeletedInternal(); 1427 } 1428 1429 get minContentHeight() { 1430 return this.__minContentHeight.get(); 1431 } 1432 1433 set minContentHeight(s26) { 1434 this.__minContentHeight.set(s26); 1435 } 1436 1437 doNothingBuilder(r26 = null) { 1438 } 1439 1440 onPlaceChildren(k26, l26, m26) { 1441 let n26 = 0; 1442 let o26 = 0; 1443 for (let p26 = 0; p26 < l26.length; p26++) { 1444 let q26 = l26[p26]; 1445 q26.layout({ x: n26, y: o26 }); 1446 o26 += q26.measureResult.height; 1447 } 1448 } 1449 1450 onMeasureSize(y25, z25, a26) { 1451 let b26 = { width: Number(a26.maxWidth), height: 0 }; 1452 let c26 = 2; 1453 if (z25.length < c26) { 1454 return b26; 1455 } 1456 this.updateTextAlign(b26.width); 1457 let d26 = 0; 1458 let e26 = z25[this.checkboxIndex]; 1459 let f26 = { 1460 maxWidth: a26.maxWidth, 1461 minHeight: CHECKBOX_CONTAINER_HEIGHT, 1462 maxHeight: a26.maxHeight 1463 }; 1464 let g26 = e26.measure(f26); 1465 d26 += g26.height; 1466 let h26 = z25[this.textIndex]; 1467 let i26 = { 1468 maxWidth: a26.maxWidth, 1469 maxHeight: Number(a26.maxHeight) - d26 1470 }; 1471 let j26 = h26.measure(i26); 1472 d26 += j26.height; 1473 b26.height = d26; 1474 this.minContentHeight = Math.max(g26.height + TEXT_MIN_HEIGHT, MIN_CONTENT_HEIGHT); 1475 return b26; 1476 } 1477 1478 initialRender() { 1479 this.dialogBuilder.bind(this)(); 1480 } 1481 1482 rerender() { 1483 this.updateDirtyElements(); 1484 } 1485} 1486 1487export class ConfirmDialog extends ViewPU { 1488 constructor(r25, s25, t25, u25 = -1, v25 = undefined, w25) { 1489 super(r25, t25, u25, w25); 1490 if (typeof v25 === 'function') { 1491 this.paramsGenerator_ = v25; 1492 } 1493 this.controller = undefined; 1494 this.title = ''; 1495 this.content = ''; 1496 this.checkTips = ''; 1497 this.__isChecked = new ObservedPropertySimplePU(false, this, 'isChecked'); 1498 this.primaryButton = { value: "" }; 1499 this.secondaryButton = { value: "" }; 1500 this.__fontColorWithTheme = new ObservedPropertyObjectPU({ 1501 'id': -1, 1502 'type': 10001, 1503 params: ['sys.color.font_primary'], 1504 'bundleName': '__harDefaultBundleName__', 1505 'moduleName': '__harDefaultModuleName__' 1506 }, this, 'fontColorWithTheme'); 1507 this.theme = new CustomThemeImpl({}); 1508 this.themeColorMode = ThemeColorMode.SYSTEM; 1509 this.onCheckedChange = undefined; 1510 this.contentScroller = new Scroller(); 1511 this.buttons = undefined; 1512 this.__textAlign = new ObservedPropertySimplePU(TextAlign.Start, this, 'textAlign'); 1513 this.marginOffset = 0; 1514 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 1515 this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight'); 1516 this.textIndex = 0; 1517 this.checkboxIndex = 1; 1518 this.updateTextAlign = (x25) => { 1519 if (this.content) { 1520 this.textAlign = getTextAlign(x25, this.content, `${BODY_L * this.fontSizeScale}vp`); 1521 } 1522 }; 1523 this.setInitiallyProvidedValue(s25); 1524 this.finalizeConstruction(); 1525 } 1526 1527 setInitiallyProvidedValue(q25) { 1528 if (q25.controller !== undefined) { 1529 this.controller = q25.controller; 1530 } 1531 if (q25.title !== undefined) { 1532 this.title = q25.title; 1533 } 1534 if (q25.content !== undefined) { 1535 this.content = q25.content; 1536 } 1537 if (q25.checkTips !== undefined) { 1538 this.checkTips = q25.checkTips; 1539 } 1540 if (q25.isChecked !== undefined) { 1541 this.isChecked = q25.isChecked; 1542 } 1543 if (q25.primaryButton !== undefined) { 1544 this.primaryButton = q25.primaryButton; 1545 } 1546 if (q25.secondaryButton !== undefined) { 1547 this.secondaryButton = q25.secondaryButton; 1548 } 1549 if (q25.fontColorWithTheme !== undefined) { 1550 this.fontColorWithTheme = q25.fontColorWithTheme; 1551 } 1552 if (q25.theme !== undefined) { 1553 this.theme = q25.theme; 1554 } 1555 if (q25.themeColorMode !== undefined) { 1556 this.themeColorMode = q25.themeColorMode; 1557 } 1558 if (q25.onCheckedChange !== undefined) { 1559 this.onCheckedChange = q25.onCheckedChange; 1560 } 1561 if (q25.contentScroller !== undefined) { 1562 this.contentScroller = q25.contentScroller; 1563 } 1564 if (q25.buttons !== undefined) { 1565 this.buttons = q25.buttons; 1566 } 1567 if (q25.textAlign !== undefined) { 1568 this.textAlign = q25.textAlign; 1569 } 1570 if (q25.marginOffset !== undefined) { 1571 this.marginOffset = q25.marginOffset; 1572 } 1573 if (q25.fontSizeScale !== undefined) { 1574 this.fontSizeScale = q25.fontSizeScale; 1575 } 1576 if (q25.minContentHeight !== undefined) { 1577 this.minContentHeight = q25.minContentHeight; 1578 } 1579 if (q25.textIndex !== undefined) { 1580 this.textIndex = q25.textIndex; 1581 } 1582 if (q25.checkboxIndex !== undefined) { 1583 this.checkboxIndex = q25.checkboxIndex; 1584 } 1585 if (q25.updateTextAlign !== undefined) { 1586 this.updateTextAlign = q25.updateTextAlign; 1587 } 1588 } 1589 1590 updateStateVars(p25) { 1591 } 1592 1593 purgeVariableDependenciesOnElmtId(o25) { 1594 this.__isChecked.purgeDependencyOnElmtId(o25); 1595 this.__fontColorWithTheme.purgeDependencyOnElmtId(o25); 1596 this.__textAlign.purgeDependencyOnElmtId(o25); 1597 this.__fontSizeScale.purgeDependencyOnElmtId(o25); 1598 this.__minContentHeight.purgeDependencyOnElmtId(o25); 1599 } 1600 1601 aboutToBeDeleted() { 1602 this.__isChecked.aboutToBeDeleted(); 1603 this.__fontColorWithTheme.aboutToBeDeleted(); 1604 this.__textAlign.aboutToBeDeleted(); 1605 this.__fontSizeScale.aboutToBeDeleted(); 1606 this.__minContentHeight.aboutToBeDeleted(); 1607 SubscriberManager.Get().delete(this.id__()); 1608 this.aboutToBeDeletedInternal(); 1609 } 1610 1611 setController(n25) { 1612 this.controller = n25; 1613 } 1614 1615 get isChecked() { 1616 return this.__isChecked.get(); 1617 } 1618 1619 set isChecked(m25) { 1620 this.__isChecked.set(m25); 1621 } 1622 1623 get fontColorWithTheme() { 1624 return this.__fontColorWithTheme.get(); 1625 } 1626 1627 set fontColorWithTheme(l25) { 1628 this.__fontColorWithTheme.set(l25); 1629 } 1630 1631 get textAlign() { 1632 return this.__textAlign.get(); 1633 } 1634 1635 set textAlign(k25) { 1636 this.__textAlign.set(k25); 1637 } 1638 1639 get fontSizeScale() { 1640 return this.__fontSizeScale.get(); 1641 } 1642 1643 set fontSizeScale(j25) { 1644 this.__fontSizeScale.set(j25); 1645 } 1646 1647 get minContentHeight() { 1648 return this.__minContentHeight.get(); 1649 } 1650 1651 set minContentHeight(i25) { 1652 this.__minContentHeight.set(i25); 1653 } 1654 1655 textBuilder(y24 = null) { 1656 this.observeComponentCreation2((g25, h25) => { 1657 Column.create(); 1658 }, Column); 1659 this.observeComponentCreation2((e25, f25) => { 1660 Scroll.create(this.contentScroller); 1661 Scroll.nestedScroll({ 1662 scrollForward: NestedScrollMode.PARALLEL, 1663 scrollBackward: NestedScrollMode.PARALLEL 1664 }); 1665 Scroll.margin({ end: LengthMetrics.vp(this.marginOffset) }); 1666 }, Scroll); 1667 this.observeComponentCreation2((c25, d25) => { 1668 Column.create(); 1669 Column.margin({ end: LengthMetrics.resource({ 1670 'id': -1, 1671 'type': 10002, 1672 params: ['sys.float.padding_level8'], 1673 'bundleName': '__harDefaultBundleName__', 1674 'moduleName': '__harDefaultModuleName__' 1675 }) 1676 }); 1677 }, Column); 1678 this.observeComponentCreation2((z24, a25) => { 1679 Text.create(this.content); 1680 Text.focusable(true); 1681 Text.defaultFocus(!(this.primaryButton?.value || this.secondaryButton?.value)); 1682 Text.focusBox({ 1683 strokeWidth: LengthMetrics.px(0) 1684 }); 1685 Text.fontSize(`${BODY_L}fp`); 1686 Text.fontWeight(FontWeight.Medium); 1687 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 1688 Text.textAlign(this.textAlign); 1689 Text.onKeyEvent((b25) => { 1690 if (b25) { 1691 resolveKeyEvent(b25, this.contentScroller); 1692 } 1693 }); 1694 Text.width('100%'); 1695 }, Text); 1696 Text.pop(); 1697 Column.pop(); 1698 Scroll.pop(); 1699 Column.pop(); 1700 } 1701 1702 checkBoxBuilder(q24 = null) { 1703 this.observeComponentCreation2((w24, x24) => { 1704 Row.create(); 1705 Row.accessibilityGroup(true); 1706 Row.onClick(() => { 1707 this.isChecked = !this.isChecked; 1708 }); 1709 Row.width('100%'); 1710 Row.padding({ top: 8, bottom: 8 }); 1711 }, Row); 1712 this.observeComponentCreation2((t24, u24) => { 1713 Checkbox.create({ name: '', group: 'checkboxGroup' }); 1714 Checkbox.select(this.isChecked); 1715 Checkbox.onChange((v24) => { 1716 this.isChecked = v24; 1717 if (this.onCheckedChange) { 1718 this.onCheckedChange(this.isChecked); 1719 } 1720 }); 1721 Checkbox.hitTestBehavior(HitTestMode.Block); 1722 Checkbox.accessibilityLevel('yes'); 1723 Checkbox.margin({ start: LengthMetrics.vp(0), end: LengthMetrics.vp(CHECK_BOX_MARGIN_END) }); 1724 }, Checkbox); 1725 Checkbox.pop(); 1726 this.observeComponentCreation2((r24, s24) => { 1727 Text.create(this.checkTips); 1728 Text.fontSize(`${BODY_M}fp`); 1729 Text.fontWeight(FontWeight.Medium); 1730 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 1731 Text.maxLines(CONTENT_MAX_LINES); 1732 Text.focusable(false); 1733 Text.layoutWeight(1); 1734 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1735 }, Text); 1736 Text.pop(); 1737 Row.pop(); 1738 } 1739 1740 buildContent(p23 = null) { 1741 { 1742 this.observeComponentCreation2((q23, r23) => { 1743 if (r23) { 1744 let s23 = new ConfirmDialogContentLayout(this, { 1745 minContentHeight: this.__minContentHeight, updateTextAlign: this.updateTextAlign, 1746 dialogBuilder: () => { 1747 this.observeComponentCreation2((f24, g24) => { 1748 ForEach.create(); 1749 const k = i24 => { 1750 const j24 = i24; 1751 this.observeComponentCreation2((k24, l24) => { 1752 If.create(); 1753 if (j24 === this.textIndex) { 1754 this.ifElseBranchUpdateFunction(0, () => { 1755 this.observeComponentCreation2((o24, p24) => { 1756 WithTheme.create({ 1757 theme: this.theme, 1758 colorMode: this.themeColorMode 1759 }); 1760 }, WithTheme); 1761 this.textBuilder.bind(this)(); 1762 WithTheme.pop(); 1763 }); 1764 } else if (j24 === this.checkboxIndex) { 1765 this.ifElseBranchUpdateFunction(1, () => { 1766 this.observeComponentCreation2((m24, n24) => { 1767 WithTheme.create({ 1768 theme: this.theme, 1769 colorMode: this.themeColorMode 1770 }); 1771 }, WithTheme); 1772 this.checkBoxBuilder.bind(this)(); 1773 WithTheme.pop(); 1774 }); 1775 } else { 1776 this.ifElseBranchUpdateFunction(2, () => { 1777 }); 1778 } 1779 }, If); 1780 If.pop(); 1781 }; 1782 this.forEachUpdateFunction(f24, [this.textIndex, this.checkboxIndex], k); 1783 }, ForEach); 1784 ForEach.pop(); 1785 } 1786 }, undefined, q23, () => { 1787 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 733, col: 5 }); 1788 ViewPU.create(s23); 1789 let i = () => { 1790 return { 1791 minContentHeight: this.minContentHeight, 1792 updateTextAlign: this.updateTextAlign, 1793 dialogBuilder: () => { 1794 this.observeComponentCreation2((u23, v23) => { 1795 ForEach.create(); 1796 const j = x23 => { 1797 const y23 = x23; 1798 this.observeComponentCreation2((z23, a24) => { 1799 If.create(); 1800 if (y23 === this.textIndex) { 1801 this.ifElseBranchUpdateFunction(0, () => { 1802 this.observeComponentCreation2((d24, e24) => { 1803 WithTheme.create({ 1804 theme: this.theme, 1805 colorMode: this.themeColorMode 1806 }); 1807 }, WithTheme); 1808 this.textBuilder.bind(this)(); 1809 WithTheme.pop(); 1810 }); 1811 } else if (y23 === this.checkboxIndex) { 1812 this.ifElseBranchUpdateFunction(1, () => { 1813 this.observeComponentCreation2((b24, c24) => { 1814 WithTheme.create({ 1815 theme: this.theme, 1816 colorMode: this.themeColorMode 1817 }); 1818 }, WithTheme); 1819 this.checkBoxBuilder.bind(this)(); 1820 WithTheme.pop(); 1821 }); 1822 } else { 1823 this.ifElseBranchUpdateFunction(2, () => { 1824 }); 1825 } 1826 }, If); 1827 If.pop(); 1828 }; 1829 this.forEachUpdateFunction(u23, [this.textIndex, this.checkboxIndex], j); 1830 }, ForEach); 1831 ForEach.pop(); 1832 } 1833 }; 1834 }; 1835 s23.paramsGenerator_ = i; 1836 } else { 1837 this.updateStateVarsOfChildByElmtId(q23, {}); 1838 } 1839 }, { name: 'ConfirmDialogContentLayout' }); 1840 } 1841 } 1842 1843 initialRender() { 1844 this.observeComponentCreation2((n23, o23) => { 1845 __Common__.create(); 1846 __Common__.constraintSize({ maxHeight: '100%' }); 1847 }, __Common__); 1848 { 1849 this.observeComponentCreation2((j23, k23) => { 1850 if (k23) { 1851 let l23 = new CustomDialogContentComponent(this, { 1852 primaryTitle: this.title, 1853 controller: this.controller, 1854 contentBuilder: () => { 1855 this.buildContent(); 1856 }, 1857 minContentHeight: this.__minContentHeight, 1858 buttons: this.buttons, 1859 theme: this.theme, 1860 themeColorMode: this.themeColorMode, 1861 fontSizeScale: this.__fontSizeScale, 1862 }, undefined, j23, () => { 1863 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 749, col: 5 }); 1864 ViewPU.create(l23); 1865 let h = () => { 1866 return { 1867 primaryTitle: this.title, 1868 controller: this.controller, 1869 contentBuilder: () => { 1870 this.buildContent(); 1871 }, 1872 minContentHeight: this.minContentHeight, 1873 buttons: this.buttons, 1874 theme: this.theme, 1875 themeColorMode: this.themeColorMode, 1876 fontSizeScale: this.fontSizeScale 1877 }; 1878 }; 1879 l23.paramsGenerator_ = h; 1880 } else { 1881 this.updateStateVarsOfChildByElmtId(j23, {}); 1882 } 1883 }, { name: 'CustomDialogContentComponent' }); 1884 } 1885 __Common__.pop(); 1886 } 1887 1888 aboutToAppear() { 1889 this.fontColorWithTheme = this.theme?.colors?.fontPrimary ? 1890 this.theme.colors.fontPrimary : { 1891 'id': -1, 1892 'type': 10001, 1893 params: ['sys.color.font_primary'], 1894 'bundleName': '__harDefaultBundleName__', 1895 'moduleName': '__harDefaultModuleName__' 1896 }; 1897 this.initButtons(); 1898 this.initMargin(); 1899 } 1900 1901 initMargin() { 1902 this.marginOffset = 0 - PADDING_LEVEL_8; 1903 } 1904 1905 initButtons() { 1906 if (!this.primaryButton && !this.secondaryButton) { 1907 return; 1908 } 1909 this.buttons = []; 1910 if (this.primaryButton) { 1911 this.buttons.push(this.primaryButton); 1912 } 1913 if (this.secondaryButton) { 1914 this.buttons.push(this.secondaryButton); 1915 } 1916 } 1917 1918 rerender() { 1919 this.updateDirtyElements(); 1920 } 1921} 1922 1923export class AlertDialog extends ViewPU { 1924 constructor(d23, e23, f23, g23 = -1, h23 = undefined, i23) { 1925 super(d23, f23, g23, i23); 1926 if (typeof h23 === 'function') { 1927 this.paramsGenerator_ = h23; 1928 } 1929 this.controller = undefined; 1930 this.primaryTitle = undefined; 1931 this.secondaryTitle = undefined; 1932 this.content = ''; 1933 this.primaryButton = null; 1934 this.secondaryButton = null; 1935 this.buttons = undefined; 1936 this.__textAlign = new ObservedPropertySimplePU(TextAlign.Start, this, 'textAlign'); 1937 this.contentScroller = new Scroller(); 1938 this.__fontColorWithTheme = new ObservedPropertyObjectPU({ 1939 'id': -1, 1940 'type': 10001, 1941 params: ['sys.color.font_primary'], 1942 'bundleName': '__harDefaultBundleName__', 1943 'moduleName': '__harDefaultModuleName__' 1944 }, this, 'fontColorWithTheme'); 1945 this.theme = new CustomThemeImpl({}); 1946 this.themeColorMode = ThemeColorMode.SYSTEM; 1947 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 1948 this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight'); 1949 this.setInitiallyProvidedValue(e23); 1950 this.finalizeConstruction(); 1951 } 1952 1953 setInitiallyProvidedValue(c23) { 1954 if (c23.controller !== undefined) { 1955 this.controller = c23.controller; 1956 } 1957 if (c23.primaryTitle !== undefined) { 1958 this.primaryTitle = c23.primaryTitle; 1959 } 1960 if (c23.secondaryTitle !== undefined) { 1961 this.secondaryTitle = c23.secondaryTitle; 1962 } 1963 if (c23.content !== undefined) { 1964 this.content = c23.content; 1965 } 1966 if (c23.primaryButton !== undefined) { 1967 this.primaryButton = c23.primaryButton; 1968 } 1969 if (c23.secondaryButton !== undefined) { 1970 this.secondaryButton = c23.secondaryButton; 1971 } 1972 if (c23.buttons !== undefined) { 1973 this.buttons = c23.buttons; 1974 } 1975 if (c23.textAlign !== undefined) { 1976 this.textAlign = c23.textAlign; 1977 } 1978 if (c23.contentScroller !== undefined) { 1979 this.contentScroller = c23.contentScroller; 1980 } 1981 if (c23.fontColorWithTheme !== undefined) { 1982 this.fontColorWithTheme = c23.fontColorWithTheme; 1983 } 1984 if (c23.theme !== undefined) { 1985 this.theme = c23.theme; 1986 } 1987 if (c23.themeColorMode !== undefined) { 1988 this.themeColorMode = c23.themeColorMode; 1989 } 1990 if (c23.fontSizeScale !== undefined) { 1991 this.fontSizeScale = c23.fontSizeScale; 1992 } 1993 if (c23.minContentHeight !== undefined) { 1994 this.minContentHeight = c23.minContentHeight; 1995 } 1996 } 1997 1998 updateStateVars(b23) { 1999 } 2000 2001 purgeVariableDependenciesOnElmtId(a23) { 2002 this.__textAlign.purgeDependencyOnElmtId(a23); 2003 this.__fontColorWithTheme.purgeDependencyOnElmtId(a23); 2004 this.__fontSizeScale.purgeDependencyOnElmtId(a23); 2005 this.__minContentHeight.purgeDependencyOnElmtId(a23); 2006 } 2007 2008 aboutToBeDeleted() { 2009 this.__textAlign.aboutToBeDeleted(); 2010 this.__fontColorWithTheme.aboutToBeDeleted(); 2011 this.__fontSizeScale.aboutToBeDeleted(); 2012 this.__minContentHeight.aboutToBeDeleted(); 2013 SubscriberManager.Get().delete(this.id__()); 2014 this.aboutToBeDeletedInternal(); 2015 } 2016 2017 setController(z22) { 2018 this.controller = z22; 2019 } 2020 2021 get textAlign() { 2022 return this.__textAlign.get(); 2023 } 2024 2025 set textAlign(y22) { 2026 this.__textAlign.set(y22); 2027 } 2028 2029 get fontColorWithTheme() { 2030 return this.__fontColorWithTheme.get(); 2031 } 2032 2033 set fontColorWithTheme(x22) { 2034 this.__fontColorWithTheme.set(x22); 2035 } 2036 2037 get fontSizeScale() { 2038 return this.__fontSizeScale.get(); 2039 } 2040 2041 set fontSizeScale(w22) { 2042 this.__fontSizeScale.set(w22); 2043 } 2044 2045 get minContentHeight() { 2046 return this.__minContentHeight.get(); 2047 } 2048 2049 set minContentHeight(v22) { 2050 this.__minContentHeight.set(v22); 2051 } 2052 2053 initialRender() { 2054 this.observeComponentCreation2((t22, u22) => { 2055 __Common__.create(); 2056 __Common__.constraintSize({ maxHeight: '100%' }); 2057 }, __Common__); 2058 { 2059 this.observeComponentCreation2((p22, q22) => { 2060 if (q22) { 2061 let r22 = new CustomDialogContentComponent(this, { 2062 primaryTitle: this.primaryTitle, 2063 secondaryTitle: this.secondaryTitle, 2064 controller: this.controller, 2065 contentBuilder: () => { 2066 this.AlertDialogContentBuilder(); 2067 }, 2068 buttons: this.buttons, 2069 theme: this.theme, 2070 themeColorMode: this.themeColorMode, 2071 fontSizeScale: this.__fontSizeScale, 2072 minContentHeight: this.__minContentHeight, 2073 }, undefined, p22, () => { 2074 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 807, col: 5 }); 2075 ViewPU.create(r22); 2076 let g = () => { 2077 return { 2078 primaryTitle: this.primaryTitle, 2079 secondaryTitle: this.secondaryTitle, 2080 controller: this.controller, 2081 contentBuilder: () => { 2082 this.AlertDialogContentBuilder(); 2083 }, 2084 buttons: this.buttons, 2085 theme: this.theme, 2086 themeColorMode: this.themeColorMode, 2087 fontSizeScale: this.fontSizeScale, 2088 minContentHeight: this.minContentHeight 2089 }; 2090 }; 2091 r22.paramsGenerator_ = g; 2092 } else { 2093 this.updateStateVarsOfChildByElmtId(p22, {}); 2094 } 2095 }, { name: 'CustomDialogContentComponent' }); 2096 } 2097 __Common__.pop(); 2098 } 2099 2100 AlertDialogContentBuilder(f22 = null) { 2101 this.observeComponentCreation2((n22, o22) => { 2102 Column.create(); 2103 Column.margin({ end: LengthMetrics.vp(this.getMargin()) }); 2104 }, Column); 2105 this.observeComponentCreation2((l22, m22) => { 2106 Scroll.create(this.contentScroller); 2107 Scroll.nestedScroll({ 2108 scrollForward: NestedScrollMode.PARALLEL, 2109 scrollBackward: NestedScrollMode.PARALLEL 2110 }); 2111 Scroll.width('100%'); 2112 }, Scroll); 2113 this.observeComponentCreation2((g22, h22) => { 2114 Text.create(this.content); 2115 Text.focusable(true); 2116 Text.defaultFocus(!(this.primaryButton || this.secondaryButton)); 2117 Text.focusBox({ 2118 strokeWidth: LengthMetrics.px(0) 2119 }); 2120 Text.fontSize(`${BODY_L}fp`); 2121 Text.fontWeight(this.getFontWeight()); 2122 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 2123 Text.margin({ 2124 end: LengthMetrics.resource({ 2125 'id': -1, 2126 'type': 10002, 2127 params: ['sys.float.padding_level8'], 2128 'bundleName': '__harDefaultBundleName__', 2129 'moduleName': '__harDefaultModuleName__' 2130 }) 2131 }); 2132 Text.width(`calc(100% - ${PADDING_LEVEL_8}vp)`); 2133 Text.textAlign(this.textAlign); 2134 Text.onAreaChange((j22, k22) => { 2135 this.updateTextAlign(Number(k22.width)); 2136 }); 2137 Text.onKeyEvent((i22) => { 2138 if (i22) { 2139 resolveKeyEvent(i22, this.contentScroller); 2140 } 2141 }); 2142 }, Text); 2143 Text.pop(); 2144 Scroll.pop(); 2145 Column.pop(); 2146 } 2147 2148 aboutToAppear() { 2149 this.fontColorWithTheme = this.theme?.colors?.fontPrimary ? 2150 this.theme.colors.fontPrimary : { 2151 'id': -1, 2152 'type': 10001, 2153 params: ['sys.color.font_primary'], 2154 'bundleName': '__harDefaultBundleName__', 2155 'moduleName': '__harDefaultModuleName__' 2156 }; 2157 this.initButtons(); 2158 } 2159 2160 updateTextAlign(e22) { 2161 this.textAlign = getTextAlign(e22, this.content, `${BODY_L * this.fontSizeScale}vp`); 2162 } 2163 2164 initButtons() { 2165 if (!this.primaryButton && !this.secondaryButton) { 2166 return; 2167 } 2168 this.buttons = []; 2169 if (this.primaryButton) { 2170 this.buttons.push(this.primaryButton); 2171 } 2172 if (this.secondaryButton) { 2173 this.buttons.push(this.secondaryButton); 2174 } 2175 } 2176 2177 getMargin() { 2178 return 0 - PADDING_LEVEL_8; 2179 } 2180 2181 getFontWeight() { 2182 if (this.primaryTitle || this.secondaryTitle) { 2183 return FontWeight.Regular; 2184 } 2185 return FontWeight.Medium; 2186 } 2187 2188 rerender() { 2189 this.updateDirtyElements(); 2190 } 2191} 2192 2193export class CustomContentDialog extends ViewPU { 2194 constructor(y21, z21, a22, b22 = -1, c22 = undefined, d22) { 2195 super(y21, a22, b22, d22); 2196 if (typeof c22 === 'function') { 2197 this.paramsGenerator_ = c22; 2198 } 2199 this.controller = undefined; 2200 this.primaryTitle = undefined; 2201 this.secondaryTitle = undefined; 2202 this.contentBuilder = undefined; 2203 this.contentAreaPadding = undefined; 2204 this.localizedContentAreaPadding = undefined; 2205 this.buttons = undefined; 2206 this.theme = new CustomThemeImpl({}); 2207 this.themeColorMode = ThemeColorMode.SYSTEM; 2208 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 2209 this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight'); 2210 this.setInitiallyProvidedValue(z21); 2211 this.finalizeConstruction(); 2212 } 2213 2214 setInitiallyProvidedValue(x21) { 2215 if (x21.controller !== undefined) { 2216 this.controller = x21.controller; 2217 } 2218 if (x21.primaryTitle !== undefined) { 2219 this.primaryTitle = x21.primaryTitle; 2220 } 2221 if (x21.secondaryTitle !== undefined) { 2222 this.secondaryTitle = x21.secondaryTitle; 2223 } 2224 if (x21.contentBuilder !== undefined) { 2225 this.contentBuilder = x21.contentBuilder; 2226 } 2227 if (x21.contentAreaPadding !== undefined) { 2228 this.contentAreaPadding = x21.contentAreaPadding; 2229 } 2230 if (x21.localizedContentAreaPadding !== undefined) { 2231 this.localizedContentAreaPadding = x21.localizedContentAreaPadding; 2232 } 2233 if (x21.buttons !== undefined) { 2234 this.buttons = x21.buttons; 2235 } 2236 if (x21.theme !== undefined) { 2237 this.theme = x21.theme; 2238 } 2239 if (x21.themeColorMode !== undefined) { 2240 this.themeColorMode = x21.themeColorMode; 2241 } 2242 if (x21.fontSizeScale !== undefined) { 2243 this.fontSizeScale = x21.fontSizeScale; 2244 } 2245 if (x21.minContentHeight !== undefined) { 2246 this.minContentHeight = x21.minContentHeight; 2247 } 2248 } 2249 2250 updateStateVars(w21) { 2251 } 2252 2253 purgeVariableDependenciesOnElmtId(v21) { 2254 this.__fontSizeScale.purgeDependencyOnElmtId(v21); 2255 this.__minContentHeight.purgeDependencyOnElmtId(v21); 2256 } 2257 2258 aboutToBeDeleted() { 2259 this.__fontSizeScale.aboutToBeDeleted(); 2260 this.__minContentHeight.aboutToBeDeleted(); 2261 SubscriberManager.Get().delete(this.id__()); 2262 this.aboutToBeDeletedInternal(); 2263 } 2264 2265 setController(u21) { 2266 this.controller = u21; 2267 } 2268 2269 get fontSizeScale() { 2270 return this.__fontSizeScale.get(); 2271 } 2272 2273 set fontSizeScale(t21) { 2274 this.__fontSizeScale.set(t21); 2275 } 2276 2277 get minContentHeight() { 2278 return this.__minContentHeight.get(); 2279 } 2280 2281 set minContentHeight(s21) { 2282 this.__minContentHeight.set(s21); 2283 } 2284 2285 initialRender() { 2286 this.observeComponentCreation2((q21, r21) => { 2287 __Common__.create(); 2288 __Common__.constraintSize({ maxHeight: '100%' }); 2289 }, __Common__); 2290 { 2291 this.observeComponentCreation2((m21, n21) => { 2292 if (n21) { 2293 let o21 = new CustomDialogContentComponent(this, { 2294 controller: this.controller, 2295 primaryTitle: this.primaryTitle, 2296 secondaryTitle: this.secondaryTitle, 2297 contentBuilder: () => { 2298 this.contentBuilder(); 2299 }, 2300 contentAreaPadding: this.contentAreaPadding, 2301 localizedContentAreaPadding: this.localizedContentAreaPadding, 2302 buttons: this.buttons, 2303 theme: this.theme, 2304 themeColorMode: this.themeColorMode, 2305 fontSizeScale: this.__fontSizeScale, 2306 minContentHeight: this.__minContentHeight, 2307 customStyle: false 2308 }, undefined, m21, () => { 2309 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 903, col: 5 }); 2310 ViewPU.create(o21); 2311 let f = () => { 2312 return { 2313 controller: this.controller, 2314 primaryTitle: this.primaryTitle, 2315 secondaryTitle: this.secondaryTitle, 2316 contentBuilder: () => { 2317 this.contentBuilder(); 2318 }, 2319 contentAreaPadding: this.contentAreaPadding, 2320 localizedContentAreaPadding: this.localizedContentAreaPadding, 2321 buttons: this.buttons, 2322 theme: this.theme, 2323 themeColorMode: this.themeColorMode, 2324 fontSizeScale: this.fontSizeScale, 2325 minContentHeight: this.minContentHeight, 2326 customStyle: false 2327 }; 2328 }; 2329 o21.paramsGenerator_ = f; 2330 } else { 2331 this.updateStateVarsOfChildByElmtId(m21, {}); 2332 } 2333 }, { name: 'CustomDialogContentComponent' }); 2334 } 2335 __Common__.pop(); 2336 } 2337 2338 rerender() { 2339 this.updateDirtyElements(); 2340 } 2341} 2342 2343class CustomDialogControllerExtend extends CustomDialogController { 2344 constructor(l21) { 2345 super(l21); 2346 this.arg_ = l21; 2347 } 2348} 2349 2350class CustomDialogLayout extends ViewPU { 2351 constructor(f21, g21, h21, i21 = -1, j21 = undefined, k21) { 2352 super(f21, h21, i21, k21); 2353 if (typeof j21 === 'function') { 2354 this.paramsGenerator_ = j21; 2355 } 2356 this.__titleHeight = new SynchedPropertySimpleTwoWayPU(g21.titleHeight, this, 'titleHeight'); 2357 this.__buttonHeight = new SynchedPropertySimpleTwoWayPU(g21.buttonHeight, this, 'buttonHeight'); 2358 this.__titleMinHeight = new SynchedPropertyObjectTwoWayPU(g21.titleMinHeight, this, 'titleMinHeight'); 2359 this.dialogBuilder = this.doNothingBuilder; 2360 this.titleIndex = 0; 2361 this.contentIndex = 1; 2362 this.buttonIndex = 2; 2363 this.setInitiallyProvidedValue(g21); 2364 this.finalizeConstruction(); 2365 } 2366 2367 setInitiallyProvidedValue(e21) { 2368 if (e21.dialogBuilder !== undefined) { 2369 this.dialogBuilder = e21.dialogBuilder; 2370 } 2371 if (e21.titleIndex !== undefined) { 2372 this.titleIndex = e21.titleIndex; 2373 } 2374 if (e21.contentIndex !== undefined) { 2375 this.contentIndex = e21.contentIndex; 2376 } 2377 if (e21.buttonIndex !== undefined) { 2378 this.buttonIndex = e21.buttonIndex; 2379 } 2380 } 2381 2382 updateStateVars(d21) { 2383 } 2384 2385 purgeVariableDependenciesOnElmtId(c21) { 2386 this.__titleHeight.purgeDependencyOnElmtId(c21); 2387 this.__buttonHeight.purgeDependencyOnElmtId(c21); 2388 this.__titleMinHeight.purgeDependencyOnElmtId(c21); 2389 } 2390 2391 aboutToBeDeleted() { 2392 this.__titleHeight.aboutToBeDeleted(); 2393 this.__buttonHeight.aboutToBeDeleted(); 2394 this.__titleMinHeight.aboutToBeDeleted(); 2395 SubscriberManager.Get().delete(this.id__()); 2396 this.aboutToBeDeletedInternal(); 2397 } 2398 2399 doNothingBuilder(b21 = null) { 2400 } 2401 2402 get titleHeight() { 2403 return this.__titleHeight.get(); 2404 } 2405 2406 set titleHeight(a21) { 2407 this.__titleHeight.set(a21); 2408 } 2409 2410 get buttonHeight() { 2411 return this.__buttonHeight.get(); 2412 } 2413 2414 set buttonHeight(z20) { 2415 this.__buttonHeight.set(z20); 2416 } 2417 2418 get titleMinHeight() { 2419 return this.__titleMinHeight.get(); 2420 } 2421 2422 set titleMinHeight(y20) { 2423 this.__titleMinHeight.set(y20); 2424 } 2425 2426 onPlaceChildren(r20, s20, t20) { 2427 let u20 = 0; 2428 let v20 = 0; 2429 for (let w20 = 0; w20 < s20.length; w20++) { 2430 let x20 = s20[w20]; 2431 x20.layout({ x: u20, y: v20 }); 2432 v20 += x20.measureResult.height; 2433 } 2434 } 2435 2436 onMeasureSize(d20, e20, f20) { 2437 let g20 = { width: Number(f20.maxWidth), height: 0 }; 2438 let h20 = 3; 2439 if (e20.length < h20) { 2440 return g20; 2441 } 2442 let i20 = 0; 2443 let j20 = e20[this.titleIndex]; 2444 let k20 = { 2445 maxWidth: f20.maxWidth, 2446 minHeight: this.titleMinHeight, 2447 maxHeight: f20.maxHeight 2448 }; 2449 let l20 = j20.measure(k20); 2450 this.titleHeight = l20.height; 2451 i20 += this.titleHeight; 2452 let m20 = e20[this.buttonIndex]; 2453 let n20 = m20.measure(f20); 2454 this.buttonHeight = n20.height; 2455 i20 += this.buttonHeight; 2456 let o20 = e20[this.contentIndex]; 2457 let p20 = { 2458 maxWidth: f20.maxWidth, 2459 maxHeight: Number(f20.maxHeight) - i20 2460 }; 2461 let q20 = o20.measure(p20); 2462 i20 += q20.height; 2463 g20.height = i20; 2464 return g20; 2465 } 2466 2467 initialRender() { 2468 this.dialogBuilder.bind(this)(); 2469 } 2470 2471 rerender() { 2472 this.updateDirtyElements(); 2473 } 2474} 2475 2476class CustomDialogContentComponent extends ViewPU { 2477 constructor(x19, y19, z19, a20 = -1, b20 = undefined, c20) { 2478 super(x19, z19, a20, c20); 2479 if (typeof b20 === 'function') { 2480 this.paramsGenerator_ = b20; 2481 } 2482 this.controller = undefined; 2483 this.primaryTitle = undefined; 2484 this.secondaryTitle = undefined; 2485 this.localizedContentAreaPadding = undefined; 2486 this.contentBuilder = this.defaultContentBuilder; 2487 this.buttons = undefined; 2488 this.contentAreaPadding = undefined; 2489 this.keyIndex = 0; 2490 this.theme = new CustomThemeImpl({}); 2491 this.themeColorMode = ThemeColorMode.SYSTEM; 2492 this.__minContentHeight = new SynchedPropertySimpleTwoWayPU(y19.minContentHeight, this, 'minContentHeight'); 2493 this.__titleHeight = new ObservedPropertySimplePU(0, this, 'titleHeight'); 2494 this.__buttonHeight = new ObservedPropertySimplePU(0, this, 'buttonHeight'); 2495 this.__contentMaxHeight = new ObservedPropertyObjectPU('100%', this, 'contentMaxHeight'); 2496 this.__fontSizeScale = new SynchedPropertySimpleTwoWayPU(y19.fontSizeScale, this, 'fontSizeScale'); 2497 this.__customStyle = new ObservedPropertySimplePU(undefined, this, 'customStyle'); 2498 this.__buttonMaxFontSize = new ObservedPropertyObjectPU(`${BODY_L}fp`, this, 'buttonMaxFontSize'); 2499 this.__buttonMinFontSize = new ObservedPropertyObjectPU(9, this, 'buttonMinFontSize'); 2500 this.__primaryTitleMaxFontSize = new ObservedPropertyObjectPU(`${TITLE_S}fp`, this, 'primaryTitleMaxFontSize'); 2501 this.__primaryTitleMinFontSize = new ObservedPropertyObjectPU(`${BODY_L}fp`, this, 'primaryTitleMinFontSize'); 2502 this.__secondaryTitleMaxFontSize = new ObservedPropertyObjectPU(`${SUBTITLE_S}fp`, this, 'secondaryTitleMaxFontSize'); 2503 this.__secondaryTitleMinFontSize = new ObservedPropertyObjectPU(`${BODY_S}fp`, this, 'secondaryTitleMinFontSize'); 2504 this.__primaryTitleFontColorWithTheme = new ObservedPropertyObjectPU({ 2505 'id': -1, 2506 'type': 10001, 2507 params: ['sys.color.font_primary'], 2508 'bundleName': '__harDefaultBundleName__', 2509 'moduleName': '__harDefaultModuleName__' 2510 }, this, 'primaryTitleFontColorWithTheme'); 2511 this.__secondaryTitleFontColorWithTheme = new ObservedPropertyObjectPU({ 2512 'id': -1, 2513 'type': 10001, 2514 params: ['sys.color.font_secondary'], 2515 'bundleName': '__harDefaultBundleName__', 2516 'moduleName': '__harDefaultModuleName__' 2517 }, this, 'secondaryTitleFontColorWithTheme'); 2518 this.__titleTextAlign = new ObservedPropertySimplePU(TextAlign.Center, this, 'titleTextAlign'); 2519 this.__isButtonVertical = new ObservedPropertySimplePU(false, this, 'isButtonVertical'); 2520 this.__titleMinHeight = new ObservedPropertyObjectPU(0, this, 'titleMinHeight'); 2521 this.isFollowingSystemFontScale = false; 2522 this.appMaxFontScale = 3.2; 2523 this.titleIndex = 0; 2524 this.contentIndex = 1; 2525 this.buttonIndex = 2; 2526 this.setInitiallyProvidedValue(y19); 2527 this.finalizeConstruction(); 2528 } 2529 2530 setInitiallyProvidedValue(w19) { 2531 if (w19.controller !== undefined) { 2532 this.controller = w19.controller; 2533 } 2534 if (w19.primaryTitle !== undefined) { 2535 this.primaryTitle = w19.primaryTitle; 2536 } 2537 if (w19.secondaryTitle !== undefined) { 2538 this.secondaryTitle = w19.secondaryTitle; 2539 } 2540 if (w19.localizedContentAreaPadding !== undefined) { 2541 this.localizedContentAreaPadding = w19.localizedContentAreaPadding; 2542 } 2543 if (w19.contentBuilder !== undefined) { 2544 this.contentBuilder = w19.contentBuilder; 2545 } 2546 if (w19.buttons !== undefined) { 2547 this.buttons = w19.buttons; 2548 } 2549 if (w19.contentAreaPadding !== undefined) { 2550 this.contentAreaPadding = w19.contentAreaPadding; 2551 } 2552 if (w19.keyIndex !== undefined) { 2553 this.keyIndex = w19.keyIndex; 2554 } 2555 if (w19.theme !== undefined) { 2556 this.theme = w19.theme; 2557 } 2558 if (w19.themeColorMode !== undefined) { 2559 this.themeColorMode = w19.themeColorMode; 2560 } 2561 if (w19.titleHeight !== undefined) { 2562 this.titleHeight = w19.titleHeight; 2563 } 2564 if (w19.buttonHeight !== undefined) { 2565 this.buttonHeight = w19.buttonHeight; 2566 } 2567 if (w19.contentMaxHeight !== undefined) { 2568 this.contentMaxHeight = w19.contentMaxHeight; 2569 } 2570 if (w19.customStyle !== undefined) { 2571 this.customStyle = w19.customStyle; 2572 } 2573 if (w19.buttonMaxFontSize !== undefined) { 2574 this.buttonMaxFontSize = w19.buttonMaxFontSize; 2575 } 2576 if (w19.buttonMinFontSize !== undefined) { 2577 this.buttonMinFontSize = w19.buttonMinFontSize; 2578 } 2579 if (w19.primaryTitleMaxFontSize !== undefined) { 2580 this.primaryTitleMaxFontSize = w19.primaryTitleMaxFontSize; 2581 } 2582 if (w19.primaryTitleMinFontSize !== undefined) { 2583 this.primaryTitleMinFontSize = w19.primaryTitleMinFontSize; 2584 } 2585 if (w19.secondaryTitleMaxFontSize !== undefined) { 2586 this.secondaryTitleMaxFontSize = w19.secondaryTitleMaxFontSize; 2587 } 2588 if (w19.secondaryTitleMinFontSize !== undefined) { 2589 this.secondaryTitleMinFontSize = w19.secondaryTitleMinFontSize; 2590 } 2591 if (w19.primaryTitleFontColorWithTheme !== undefined) { 2592 this.primaryTitleFontColorWithTheme = w19.primaryTitleFontColorWithTheme; 2593 } 2594 if (w19.secondaryTitleFontColorWithTheme !== undefined) { 2595 this.secondaryTitleFontColorWithTheme = w19.secondaryTitleFontColorWithTheme; 2596 } 2597 if (w19.titleTextAlign !== undefined) { 2598 this.titleTextAlign = w19.titleTextAlign; 2599 } 2600 if (w19.isButtonVertical !== undefined) { 2601 this.isButtonVertical = w19.isButtonVertical; 2602 } 2603 if (w19.titleMinHeight !== undefined) { 2604 this.titleMinHeight = w19.titleMinHeight; 2605 } 2606 if (w19.isFollowingSystemFontScale !== undefined) { 2607 this.isFollowingSystemFontScale = w19.isFollowingSystemFontScale; 2608 } 2609 if (w19.appMaxFontScale !== undefined) { 2610 this.appMaxFontScale = w19.appMaxFontScale; 2611 } 2612 if (w19.titleIndex !== undefined) { 2613 this.titleIndex = w19.titleIndex; 2614 } 2615 if (w19.contentIndex !== undefined) { 2616 this.contentIndex = w19.contentIndex; 2617 } 2618 if (w19.buttonIndex !== undefined) { 2619 this.buttonIndex = w19.buttonIndex; 2620 } 2621 } 2622 2623 updateStateVars(v19) { 2624 } 2625 2626 purgeVariableDependenciesOnElmtId(u19) { 2627 this.__minContentHeight.purgeDependencyOnElmtId(u19); 2628 this.__titleHeight.purgeDependencyOnElmtId(u19); 2629 this.__buttonHeight.purgeDependencyOnElmtId(u19); 2630 this.__contentMaxHeight.purgeDependencyOnElmtId(u19); 2631 this.__fontSizeScale.purgeDependencyOnElmtId(u19); 2632 this.__customStyle.purgeDependencyOnElmtId(u19); 2633 this.__buttonMaxFontSize.purgeDependencyOnElmtId(u19); 2634 this.__buttonMinFontSize.purgeDependencyOnElmtId(u19); 2635 this.__primaryTitleMaxFontSize.purgeDependencyOnElmtId(u19); 2636 this.__primaryTitleMinFontSize.purgeDependencyOnElmtId(u19); 2637 this.__secondaryTitleMaxFontSize.purgeDependencyOnElmtId(u19); 2638 this.__secondaryTitleMinFontSize.purgeDependencyOnElmtId(u19); 2639 this.__primaryTitleFontColorWithTheme.purgeDependencyOnElmtId(u19); 2640 this.__secondaryTitleFontColorWithTheme.purgeDependencyOnElmtId(u19); 2641 this.__titleTextAlign.purgeDependencyOnElmtId(u19); 2642 this.__isButtonVertical.purgeDependencyOnElmtId(u19); 2643 this.__titleMinHeight.purgeDependencyOnElmtId(u19); 2644 } 2645 2646 aboutToBeDeleted() { 2647 this.__minContentHeight.aboutToBeDeleted(); 2648 this.__titleHeight.aboutToBeDeleted(); 2649 this.__buttonHeight.aboutToBeDeleted(); 2650 this.__contentMaxHeight.aboutToBeDeleted(); 2651 this.__fontSizeScale.aboutToBeDeleted(); 2652 this.__customStyle.aboutToBeDeleted(); 2653 this.__buttonMaxFontSize.aboutToBeDeleted(); 2654 this.__buttonMinFontSize.aboutToBeDeleted(); 2655 this.__primaryTitleMaxFontSize.aboutToBeDeleted(); 2656 this.__primaryTitleMinFontSize.aboutToBeDeleted(); 2657 this.__secondaryTitleMaxFontSize.aboutToBeDeleted(); 2658 this.__secondaryTitleMinFontSize.aboutToBeDeleted(); 2659 this.__primaryTitleFontColorWithTheme.aboutToBeDeleted(); 2660 this.__secondaryTitleFontColorWithTheme.aboutToBeDeleted(); 2661 this.__titleTextAlign.aboutToBeDeleted(); 2662 this.__isButtonVertical.aboutToBeDeleted(); 2663 this.__titleMinHeight.aboutToBeDeleted(); 2664 SubscriberManager.Get().delete(this.id__()); 2665 this.aboutToBeDeletedInternal(); 2666 } 2667 2668 get minContentHeight() { 2669 return this.__minContentHeight.get(); 2670 } 2671 2672 set minContentHeight(t19) { 2673 this.__minContentHeight.set(t19); 2674 } 2675 2676 defaultContentBuilder(s19 = null) { 2677 } 2678 2679 get titleHeight() { 2680 return this.__titleHeight.get(); 2681 } 2682 2683 set titleHeight(r19) { 2684 this.__titleHeight.set(r19); 2685 } 2686 2687 get buttonHeight() { 2688 return this.__buttonHeight.get(); 2689 } 2690 2691 set buttonHeight(q19) { 2692 this.__buttonHeight.set(q19); 2693 } 2694 2695 get contentMaxHeight() { 2696 return this.__contentMaxHeight.get(); 2697 } 2698 2699 set contentMaxHeight(p19) { 2700 this.__contentMaxHeight.set(p19); 2701 } 2702 2703 get fontSizeScale() { 2704 return this.__fontSizeScale.get(); 2705 } 2706 2707 set fontSizeScale(o19) { 2708 this.__fontSizeScale.set(o19); 2709 } 2710 2711 get customStyle() { 2712 return this.__customStyle.get(); 2713 } 2714 2715 set customStyle(n19) { 2716 this.__customStyle.set(n19); 2717 } 2718 2719 get buttonMaxFontSize() { 2720 return this.__buttonMaxFontSize.get(); 2721 } 2722 2723 set buttonMaxFontSize(m19) { 2724 this.__buttonMaxFontSize.set(m19); 2725 } 2726 2727 get buttonMinFontSize() { 2728 return this.__buttonMinFontSize.get(); 2729 } 2730 2731 set buttonMinFontSize(l19) { 2732 this.__buttonMinFontSize.set(l19); 2733 } 2734 2735 get primaryTitleMaxFontSize() { 2736 return this.__primaryTitleMaxFontSize.get(); 2737 } 2738 2739 set primaryTitleMaxFontSize(k19) { 2740 this.__primaryTitleMaxFontSize.set(k19); 2741 } 2742 2743 get primaryTitleMinFontSize() { 2744 return this.__primaryTitleMinFontSize.get(); 2745 } 2746 2747 set primaryTitleMinFontSize(j19) { 2748 this.__primaryTitleMinFontSize.set(j19); 2749 } 2750 2751 get secondaryTitleMaxFontSize() { 2752 return this.__secondaryTitleMaxFontSize.get(); 2753 } 2754 2755 set secondaryTitleMaxFontSize(i19) { 2756 this.__secondaryTitleMaxFontSize.set(i19); 2757 } 2758 2759 get secondaryTitleMinFontSize() { 2760 return this.__secondaryTitleMinFontSize.get(); 2761 } 2762 2763 set secondaryTitleMinFontSize(h19) { 2764 this.__secondaryTitleMinFontSize.set(h19); 2765 } 2766 2767 get primaryTitleFontColorWithTheme() { 2768 return this.__primaryTitleFontColorWithTheme.get(); 2769 } 2770 2771 set primaryTitleFontColorWithTheme(g19) { 2772 this.__primaryTitleFontColorWithTheme.set(g19); 2773 } 2774 2775 get secondaryTitleFontColorWithTheme() { 2776 return this.__secondaryTitleFontColorWithTheme.get(); 2777 } 2778 2779 set secondaryTitleFontColorWithTheme(f19) { 2780 this.__secondaryTitleFontColorWithTheme.set(f19); 2781 } 2782 2783 get titleTextAlign() { 2784 return this.__titleTextAlign.get(); 2785 } 2786 2787 set titleTextAlign(e19) { 2788 this.__titleTextAlign.set(e19); 2789 } 2790 2791 get isButtonVertical() { 2792 return this.__isButtonVertical.get(); 2793 } 2794 2795 set isButtonVertical(d19) { 2796 this.__isButtonVertical.set(d19); 2797 } 2798 2799 get titleMinHeight() { 2800 return this.__titleMinHeight.get(); 2801 } 2802 2803 set titleMinHeight(c19) { 2804 this.__titleMinHeight.set(c19); 2805 } 2806 initialRender() { 2807 this.observeComponentCreation2((a19, b19) => { 2808 WithTheme.create({ theme: this.theme, colorMode: this.themeColorMode }); 2809 }, WithTheme); 2810 this.observeComponentCreation2((y18, z18) => { 2811 Scroll.create(); 2812 Scroll.backgroundColor(this.themeColorMode === ThemeColorMode.SYSTEM || undefined ? 2813 Color.Transparent : { 2814 'id': -1, 2815 'type': 10001, 2816 params: ['sys.color.comp_background_primary'], 2817 'bundleName': '__harDefaultBundleName__', 2818 'moduleName': '__harDefaultModuleName__' 2819 }); 2820 }, Scroll); 2821 this.observeComponentCreation2((w18, x18) => { 2822 Column.create(); 2823 Column.constraintSize({ maxHeight: this.contentMaxHeight }); 2824 Column.backgroundBlurStyle(this.customStyle ? BlurStyle.Thick : BlurStyle.NONE); 2825 Column.borderRadius(this.customStyle ? { 2826 'id': -1, 2827 'type': 10002, 2828 params: ['sys.float.ohos_id_corner_radius_dialog'], 2829 'bundleName': '__harDefaultBundleName__', 2830 'moduleName': '__harDefaultModuleName__' 2831 } : 0); 2832 Column.margin(this.customStyle ? { 2833 start: LengthMetrics.resource({ 2834 'id': -1, 2835 'type': 10002, 2836 params: ['sys.float.ohos_id_dialog_margin_start'], 2837 'bundleName': '__harDefaultBundleName__', 2838 'moduleName': '__harDefaultModuleName__' 2839 }), 2840 end: LengthMetrics.resource({ 2841 'id': -1, 2842 'type': 10002, 2843 params: ['sys.float.ohos_id_dialog_margin_end'], 2844 'bundleName': '__harDefaultBundleName__', 2845 'moduleName': '__harDefaultModuleName__' 2846 }), 2847 bottom: LengthMetrics.resource({ 2848 'id': -1, 2849 'type': 10002, 2850 params: ['sys.float.ohos_id_dialog_margin_bottom'], 2851 'bundleName': '__harDefaultBundleName__', 2852 'moduleName': '__harDefaultModuleName__' 2853 }), 2854 } : { left: 0, right: 0, bottom: 0 }); 2855 Column.backgroundColor(this.customStyle ? { 2856 'id': -1, 2857 'type': 10001, 2858 params: ['sys.color.ohos_id_color_dialog_bg'], 2859 'bundleName': '__harDefaultBundleName__', 2860 'moduleName': '__harDefaultModuleName__' 2861 } : Color.Transparent); 2862 }, Column); 2863 { 2864 this.observeComponentCreation2((o17, p17) => { 2865 if (p17) { 2866 let q17 = new CustomDialogLayout(this, { 2867 buttonHeight: this.__buttonHeight, 2868 titleHeight: this.__titleHeight, 2869 titleMinHeight: this.__titleMinHeight, 2870 dialogBuilder: () => { 2871 this.observeComponentCreation2((h18, i18) => { 2872 ForEach.create(); 2873 const e = k18 => { 2874 const l18 = k18; 2875 this.observeComponentCreation2((m18, n18) => { 2876 If.create(); 2877 if (l18 === this.titleIndex) { 2878 this.ifElseBranchUpdateFunction(0, () => { 2879 this.observeComponentCreation2((u18, v18) => { 2880 WithTheme.create({ 2881 theme: this.theme, 2882 colorMode: this.themeColorMode 2883 }); 2884 }, WithTheme); 2885 this.titleBuilder.bind(this)(); 2886 WithTheme.pop(); 2887 }); 2888 } else if (l18 === this.contentIndex) { 2889 this.ifElseBranchUpdateFunction(1, () => { 2890 this.observeComponentCreation2((s18, t18) => { 2891 Column.create(); 2892 Column.padding(this.getContentPadding()); 2893 }, Column); 2894 this.observeComponentCreation2((q18, r18) => { 2895 WithTheme.create({ 2896 theme: this.theme, 2897 colorMode: this.themeColorMode 2898 }); 2899 }, WithTheme); 2900 this.contentBuilder.bind(this)(); 2901 WithTheme.pop(); 2902 Column.pop(); 2903 }); 2904 } else { 2905 this.ifElseBranchUpdateFunction(2, () => { 2906 this.observeComponentCreation2((o18, p18) => { 2907 WithTheme.create({ 2908 theme: this.theme, 2909 colorMode: this.themeColorMode 2910 }); 2911 }, WithTheme); 2912 this.ButtonBuilder.bind(this)(); 2913 WithTheme.pop(); 2914 }); 2915 } 2916 }, If); 2917 If.pop(); 2918 }; 2919 this.forEachUpdateFunction(h18, [this.titleIndex, this.contentIndex, 2920 this.buttonIndex], e); 2921 }, ForEach); 2922 ForEach.pop(); 2923 } 2924 }, undefined, o17, () => { 2925 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1041, col: 11 }); 2926 ViewPU.create(q17); 2927 let c = () => { 2928 return { 2929 buttonHeight: this.buttonHeight, 2930 titleHeight: this.titleHeight, 2931 titleMinHeight: this.titleMinHeight, 2932 dialogBuilder: () => { 2933 this.observeComponentCreation2((s17, t17) => { 2934 ForEach.create(); 2935 const d = v17 => { 2936 const w17 = v17; 2937 this.observeComponentCreation2((x17, y17) => { 2938 If.create(); 2939 if (w17 === this.titleIndex) { 2940 this.ifElseBranchUpdateFunction(0, () => { 2941 this.observeComponentCreation2((f18, g18) => { 2942 WithTheme.create({ 2943 theme: this.theme, 2944 colorMode: this.themeColorMode 2945 }); 2946 }, WithTheme); 2947 this.titleBuilder.bind(this)(); 2948 WithTheme.pop(); 2949 }); 2950 } else if (w17 === this.contentIndex) { 2951 this.ifElseBranchUpdateFunction(1, () => { 2952 this.observeComponentCreation2((d18, e18) => { 2953 Column.create(); 2954 Column.padding(this.getContentPadding()); 2955 }, Column); 2956 this.observeComponentCreation2((b18, c18) => { 2957 WithTheme.create({ 2958 theme: this.theme, 2959 colorMode: this.themeColorMode 2960 }); 2961 }, WithTheme); 2962 this.contentBuilder.bind(this)(); 2963 WithTheme.pop(); 2964 Column.pop(); 2965 }); 2966 } else { 2967 this.ifElseBranchUpdateFunction(2, () => { 2968 this.observeComponentCreation2((z17, a18) => { 2969 WithTheme.create({ 2970 theme: this.theme, 2971 colorMode: this.themeColorMode 2972 }); 2973 }, WithTheme); 2974 this.ButtonBuilder.bind(this)(); 2975 WithTheme.pop(); 2976 }); 2977 } 2978 }, If); 2979 If.pop(); 2980 }; 2981 this.forEachUpdateFunction(s17, [this.titleIndex, this.contentIndex, 2982 this.buttonIndex], d); 2983 }, ForEach); 2984 ForEach.pop(); 2985 } 2986 }; 2987 }; 2988 q17.paramsGenerator_ = c; 2989 } else { 2990 this.updateStateVarsOfChildByElmtId(o17, {}); 2991 } 2992 }, { name: 'CustomDialogLayout' }); 2993 } 2994 Column.pop(); 2995 Scroll.pop(); 2996 WithTheme.pop(); 2997 } 2998 2999 onMeasureSize(f17, g17, h17) { 3000 let i17 = { width: f17.width, height: f17.height }; 3001 let j17 = Number(h17.maxWidth); 3002 let k17 = Number(h17.maxHeight); 3003 this.fontSizeScale = this.updateFontScale(); 3004 this.updateFontSize(); 3005 this.isButtonVertical = this.isVerticalAlignButton(j17 - BUTTON_HORIZONTAL_MARGIN * 2); 3006 this.titleMinHeight = this.getTitleAreaMinHeight(); 3007 let l17 = 0; 3008 g17.forEach((m17) => { 3009 this.contentMaxHeight = '100%'; 3010 let n17 = m17.measure(h17); 3011 if (k17 - this.buttonHeight - this.titleHeight < this.minContentHeight) { 3012 this.contentMaxHeight = MAX_CONTENT_HEIGHT; 3013 n17 = m17.measure(h17); 3014 } 3015 l17 += n17.height; 3016 }); 3017 i17.height = l17; 3018 i17.width = j17; 3019 return i17; 3020 } 3021 3022 aboutToAppear() { 3023 let d17 = this.getUIContext(); 3024 this.isFollowingSystemFontScale = d17.isFollowingSystemFontScale(); 3025 this.appMaxFontScale = d17.getMaxFontScale(); 3026 this.fontSizeScale = this.updateFontScale(); 3027 if (this.controller && this.customStyle === undefined) { 3028 let e17 = this.controller; 3029 if (e17.arg_ && e17.arg_.customStyle && e17.arg_.customStyle === true) { 3030 this.customStyle = true; 3031 } 3032 } 3033 if (this.customStyle === undefined) { 3034 this.customStyle = false; 3035 } 3036 this.primaryTitleFontColorWithTheme = this.theme?.colors?.fontPrimary ? 3037 this.theme.colors.fontPrimary : { 3038 'id': -1, 3039 'type': 10001, 3040 params: ['sys.color.font_primary'], 3041 'bundleName': '__harDefaultBundleName__', 3042 'moduleName': '__harDefaultModuleName__' 3043 }; 3044 this.secondaryTitleFontColorWithTheme = this.theme?.colors?.fontSecondary ? 3045 this.theme.colors.fontSecondary : { 3046 'id': -1, 3047 'type': 10001, 3048 params: ['sys.color.font_secondary'], 3049 'bundleName': '__harDefaultBundleName__', 3050 'moduleName': '__harDefaultModuleName__' 3051 }; 3052 this.initTitleTextAlign(); 3053 } 3054 3055 updateFontSize() { 3056 if (this.fontSizeScale > MAX_FONT_SCALE) { 3057 this.buttonMaxFontSize = BODY_L * MAX_FONT_SCALE + 'vp'; 3058 this.buttonMinFontSize = BUTTON_MIN_FONT_SIZE * MAX_FONT_SCALE + 'vp'; 3059 } else { 3060 this.buttonMaxFontSize = BODY_L + 'fp'; 3061 this.buttonMinFontSize = BUTTON_MIN_FONT_SIZE + 'fp'; 3062 } 3063 } 3064 3065 updateFontScale() { 3066 try { 3067 let b17 = this.getUIContext(); 3068 let c17 = b17.getHostContext()?.config.fontSizeScale ?? 1; 3069 if (!this.isFollowingSystemFontScale) { 3070 return 1; 3071 } 3072 return Math.min(c17, this.appMaxFontScale); 3073 } catch (y16) { 3074 let z16 = y16.code; 3075 let a17 = y16.message; 3076 hilog.error(0x3900, 'Ace', `Faild to init fontsizescale info,cause, code: ${z16}, message: ${a17}`); 3077 return 1; 3078 } 3079 } 3080 getContentPadding() { 3081 if (this.localizedContentAreaPadding) { 3082 return this.localizedContentAreaPadding; 3083 } 3084 if (this.contentAreaPadding) { 3085 return this.contentAreaPadding; 3086 } 3087 if ((this.primaryTitle || this.secondaryTitle) && this.buttons && this.buttons.length > 0) { 3088 return { 3089 top: 0, 3090 right: { 3091 'id': -1, 3092 'type': 10002, 3093 params: ['sys.float.alert_content_default_padding'], 3094 'bundleName': '__harDefaultBundleName__', 3095 'moduleName': '__harDefaultModuleName__' 3096 }, 3097 bottom: 0, 3098 left: { 3099 'id': -1, 3100 'type': 10002, 3101 params: ['sys.float.alert_content_default_padding'], 3102 'bundleName': '__harDefaultBundleName__', 3103 'moduleName': '__harDefaultModuleName__' 3104 }, 3105 }; 3106 } else if (this.primaryTitle || this.secondaryTitle) { 3107 return { 3108 top: 0, 3109 right: { 3110 'id': -1, 3111 'type': 10002, 3112 params: ['sys.float.alert_content_default_padding'], 3113 'bundleName': '__harDefaultBundleName__', 3114 'moduleName': '__harDefaultModuleName__' 3115 }, 3116 bottom: { 3117 'id': -1, 3118 'type': 10002, 3119 params: ['sys.float.alert_content_default_padding'], 3120 'bundleName': '__harDefaultBundleName__', 3121 'moduleName': '__harDefaultModuleName__' 3122 }, 3123 left: { 3124 'id': -1, 3125 'type': 10002, 3126 params: ['sys.float.alert_content_default_padding'], 3127 'bundleName': '__harDefaultBundleName__', 3128 'moduleName': '__harDefaultModuleName__' 3129 }, 3130 }; 3131 } else if (this.buttons && this.buttons.length > 0) { 3132 return { 3133 top: { 3134 'id': -1, 3135 'type': 10002, 3136 params: ['sys.float.alert_content_default_padding'], 3137 'bundleName': '__harDefaultBundleName__', 3138 'moduleName': '__harDefaultModuleName__' 3139 }, 3140 right: { 3141 'id': -1, 3142 'type': 10002, 3143 params: ['sys.float.alert_content_default_padding'], 3144 'bundleName': '__harDefaultBundleName__', 3145 'moduleName': '__harDefaultModuleName__' 3146 }, 3147 bottom: 0, 3148 left: { 3149 'id': -1, 3150 'type': 10002, 3151 params: ['sys.float.alert_content_default_padding'], 3152 'bundleName': '__harDefaultBundleName__', 3153 'moduleName': '__harDefaultModuleName__' 3154 }, 3155 }; 3156 } else { 3157 return { 3158 top: { 3159 'id': -1, 3160 'type': 10002, 3161 params: ['sys.float.alert_content_default_padding'], 3162 'bundleName': '__harDefaultBundleName__', 3163 'moduleName': '__harDefaultModuleName__' 3164 }, 3165 right: { 3166 'id': -1, 3167 'type': 10002, 3168 params: ['sys.float.alert_content_default_padding'], 3169 'bundleName': '__harDefaultBundleName__', 3170 'moduleName': '__harDefaultModuleName__' 3171 }, 3172 bottom: { 3173 'id': -1, 3174 'type': 10002, 3175 params: ['sys.float.alert_content_default_padding'], 3176 'bundleName': '__harDefaultBundleName__', 3177 'moduleName': '__harDefaultModuleName__' 3178 }, 3179 left: { 3180 'id': -1, 3181 'type': 10002, 3182 params: ['sys.float.alert_content_default_padding'], 3183 'bundleName': '__harDefaultBundleName__', 3184 'moduleName': '__harDefaultModuleName__' 3185 }, 3186 }; 3187 } 3188 } 3189 3190 titleBuilder(j16 = null) { 3191 this.observeComponentCreation2((w16, x16) => { 3192 Column.create(); 3193 Column.justifyContent(FlexAlign.Center); 3194 Column.width('100%'); 3195 Column.padding(this.getTitleAreaPadding()); 3196 }, Column); 3197 this.observeComponentCreation2((u16, v16) => { 3198 Row.create(); 3199 Row.width('100%'); 3200 }, Row); 3201 this.observeComponentCreation2((s16, t16) => { 3202 Text.create(this.primaryTitle); 3203 Text.fontWeight(FontWeight.Bold); 3204 Text.fontColor(ObservedObject.GetRawObject(this.primaryTitleFontColorWithTheme)); 3205 Text.textAlign(this.titleTextAlign); 3206 Text.maxFontSize(ObservedObject.GetRawObject(this.primaryTitleMaxFontSize)); 3207 Text.minFontSize(ObservedObject.GetRawObject(this.primaryTitleMinFontSize)); 3208 Text.maxFontScale(Math.min(this.appMaxFontScale, MAX_FONT_SCALE)); 3209 Text.maxLines(TITLE_MAX_LINES); 3210 Text.heightAdaptivePolicy(TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST); 3211 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 3212 Text.width('100%'); 3213 }, Text); 3214 Text.pop(); 3215 Row.pop(); 3216 this.observeComponentCreation2((o16, p16) => { 3217 If.create(); 3218 if (this.primaryTitle && this.secondaryTitle) { 3219 this.ifElseBranchUpdateFunction(0, () => { 3220 this.observeComponentCreation2((q16, r16) => { 3221 Row.create(); 3222 Row.height({ 3223 'id': -1, 3224 'type': 10002, 3225 params: ['sys.float.padding_level1'], 3226 'bundleName': '__harDefaultBundleName__', 3227 'moduleName': '__harDefaultModuleName__' 3228 }); 3229 }, Row); 3230 Row.pop(); 3231 }); 3232 } else { 3233 this.ifElseBranchUpdateFunction(1, () => { 3234 }); 3235 } 3236 }, If); 3237 If.pop(); 3238 this.observeComponentCreation2((m16, n16) => { 3239 Row.create(); 3240 Row.width('100%'); 3241 }, Row); 3242 this.observeComponentCreation2((k16, l16) => { 3243 Text.create(this.secondaryTitle); 3244 Text.fontWeight(FontWeight.Regular); 3245 Text.fontColor(ObservedObject.GetRawObject(this.secondaryTitleFontColorWithTheme)); 3246 Text.textAlign(this.titleTextAlign); 3247 Text.maxFontSize(ObservedObject.GetRawObject(this.secondaryTitleMaxFontSize)); 3248 Text.minFontSize(ObservedObject.GetRawObject(this.secondaryTitleMinFontSize)); 3249 Text.maxFontScale(Math.min(this.appMaxFontScale, MAX_FONT_SCALE)); 3250 Text.maxLines(TITLE_MAX_LINES); 3251 Text.heightAdaptivePolicy(TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST); 3252 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 3253 Text.width('100%'); 3254 }, Text); 3255 Text.pop(); 3256 Row.pop(); 3257 Column.pop(); 3258 } 3259 3260 getTitleAreaPadding() { 3261 if (this.primaryTitle || this.secondaryTitle) { 3262 return { 3263 top: { 3264 'id': -1, 3265 'type': 10002, 3266 params: ['sys.float.alert_title_padding_top'], 3267 'bundleName': '__harDefaultBundleName__', 3268 'moduleName': '__harDefaultModuleName__' 3269 }, 3270 right: { 3271 'id': -1, 3272 'type': 10002, 3273 params: ['sys.float.alert_title_padding_right'], 3274 'bundleName': '__harDefaultBundleName__', 3275 'moduleName': '__harDefaultModuleName__' 3276 }, 3277 left: { 3278 'id': -1, 3279 'type': 10002, 3280 params: ['sys.float.alert_title_padding_left'], 3281 'bundleName': '__harDefaultBundleName__', 3282 'moduleName': '__harDefaultModuleName__' 3283 }, 3284 bottom: { 3285 'id': -1, 3286 'type': 10002, 3287 params: ['sys.float.alert_title_padding_bottom'], 3288 'bundleName': '__harDefaultBundleName__', 3289 'moduleName': '__harDefaultModuleName__' 3290 }, 3291 }; 3292 } 3293 return { 3294 top: 0, 3295 right: { 3296 'id': -1, 3297 'type': 10002, 3298 params: ['sys.float.alert_title_padding_right'], 3299 'bundleName': '__harDefaultBundleName__', 3300 'moduleName': '__harDefaultModuleName__' 3301 }, 3302 left: { 3303 'id': -1, 3304 'type': 10002, 3305 params: ['sys.float.alert_title_padding_left'], 3306 'bundleName': '__harDefaultBundleName__', 3307 'moduleName': '__harDefaultModuleName__' 3308 }, 3309 bottom: 0, 3310 }; 3311 } 3312 3313 initTitleTextAlign() { 3314 let i16 = ALERT_TITLE_ALIGNMENT; 3315 if (i16 === TextAlign.Start) { 3316 this.titleTextAlign = TextAlign.Start; 3317 } else if (i16 === TextAlign.Center) { 3318 this.titleTextAlign = TextAlign.Center; 3319 } else if (i16 === TextAlign.End) { 3320 this.titleTextAlign = TextAlign.End; 3321 } else if (i16 === TextAlign.JUSTIFY) { 3322 this.titleTextAlign = TextAlign.JUSTIFY; 3323 } else { 3324 this.titleTextAlign = TextAlign.Center; 3325 } 3326 } 3327 3328 getTitleAreaMinHeight() { 3329 if (this.secondaryTitle) { 3330 return { 3331 'id': -1, 3332 'type': 10002, 3333 params: ['sys.float.alert_title_secondary_height'], 3334 'bundleName': '__harDefaultBundleName__', 3335 'moduleName': '__harDefaultModuleName__' 3336 }; 3337 } else if (this.primaryTitle) { 3338 return { 3339 'id': -1, 3340 'type': 10002, 3341 params: ['sys.float.alert_title_primary_height'], 3342 'bundleName': '__harDefaultBundleName__', 3343 'moduleName': '__harDefaultModuleName__' 3344 }; 3345 } else { 3346 return 0; 3347 } 3348 } 3349 3350 ButtonBuilder(b16 = null) { 3351 this.observeComponentCreation2((g16, h16) => { 3352 Column.create(); 3353 Column.width('100%'); 3354 Column.padding(this.getOperationAreaPadding()); 3355 }, Column); 3356 this.observeComponentCreation2((c16, d16) => { 3357 If.create(); 3358 if (this.buttons && this.buttons.length > 0) { 3359 this.ifElseBranchUpdateFunction(0, () => { 3360 this.observeComponentCreation2((e16, f16) => { 3361 If.create(); 3362 if (this.isButtonVertical) { 3363 this.ifElseBranchUpdateFunction(0, () => { 3364 this.buildVerticalAlignButtons.bind(this)(); 3365 }); 3366 } else { 3367 this.ifElseBranchUpdateFunction(1, () => { 3368 this.buildHorizontalAlignButtons.bind(this)(); 3369 }); 3370 } 3371 }, If); 3372 If.pop(); 3373 }); 3374 } else { 3375 this.ifElseBranchUpdateFunction(1, () => { 3376 }); 3377 } 3378 }, If); 3379 If.pop(); 3380 Column.pop(); 3381 } 3382 3383 getOperationAreaPadding() { 3384 if (this.isButtonVertical) { 3385 return { 3386 top: { 3387 'id': -1, 3388 'type': 10002, 3389 params: ['sys.float.alert_button_top_padding'], 3390 'bundleName': '__harDefaultBundleName__', 3391 'moduleName': '__harDefaultModuleName__' 3392 }, 3393 right: { 3394 'id': -1, 3395 'type': 10002, 3396 params: ['sys.float.alert_right_padding_vertical'], 3397 'bundleName': '__harDefaultBundleName__', 3398 'moduleName': '__harDefaultModuleName__' 3399 }, 3400 left: { 3401 'id': -1, 3402 'type': 10002, 3403 params: ['sys.float.alert_left_padding_vertical'], 3404 'bundleName': '__harDefaultBundleName__', 3405 'moduleName': '__harDefaultModuleName__' 3406 }, 3407 bottom: { 3408 'id': -1, 3409 'type': 10002, 3410 params: ['sys.float.alert_button_bottom_padding_vertical'], 3411 'bundleName': '__harDefaultBundleName__', 3412 'moduleName': '__harDefaultModuleName__' 3413 }, 3414 }; 3415 } 3416 return { 3417 top: { 3418 'id': -1, 3419 'type': 10002, 3420 params: ['sys.float.alert_button_top_padding'], 3421 'bundleName': '__harDefaultBundleName__', 3422 'moduleName': '__harDefaultModuleName__' 3423 }, 3424 right: { 3425 'id': -1, 3426 'type': 10002, 3427 params: ['sys.float.alert_right_padding_horizontal'], 3428 'bundleName': '__harDefaultBundleName__', 3429 'moduleName': '__harDefaultModuleName__' 3430 }, 3431 left: { 3432 'id': -1, 3433 'type': 10002, 3434 params: ['sys.float.alert_left_padding_horizontal'], 3435 'bundleName': '__harDefaultBundleName__', 3436 'moduleName': '__harDefaultModuleName__' 3437 }, 3438 bottom: { 3439 'id': -1, 3440 'type': 10002, 3441 params: ['sys.float.alert_button_bottom_padding_horizontal'], 3442 'bundleName': '__harDefaultBundleName__', 3443 'moduleName': '__harDefaultModuleName__' 3444 }, 3445 }; 3446 } 3447 buildSingleButton(p15, q15 = null) { 3448 this.observeComponentCreation2((r15, s15) => { 3449 If.create(); 3450 if (this.isNewPropertiesHighPriority(p15)) { 3451 this.ifElseBranchUpdateFunction(0, () => { 3452 this.observeComponentCreation2((z15, a16) => { 3453 Button.createWithLabel(p15.value); 3454 __Button__setButtonProperties(p15, this.buttons, this.controller); 3455 Button.role(p15.role ?? ButtonRole.NORMAL); 3456 Button.key(`advanced_dialog_button_${this.keyIndex++}`); 3457 Button.labelStyle({ 3458 maxLines: 1, 3459 maxFontSize: this.buttonMaxFontSize, 3460 minFontSize: this.buttonMinFontSize 3461 }); 3462 }, Button); 3463 Button.pop(); 3464 }); 3465 } else if (p15.background !== undefined && p15.fontColor !== undefined) { 3466 this.ifElseBranchUpdateFunction(1, () => { 3467 this.observeComponentCreation2((x15, y15) => { 3468 Button.createWithLabel(p15.value); 3469 __Button__setButtonProperties(p15, this.buttons, this.controller); 3470 Button.backgroundColor(p15.background); 3471 Button.fontColor(p15.fontColor); 3472 Button.key(`advanced_dialog_button_${this.keyIndex++}`); 3473 Button.labelStyle({ 3474 maxLines: 1, 3475 maxFontSize: this.buttonMaxFontSize, 3476 minFontSize: this.buttonMinFontSize 3477 }); 3478 }, Button); 3479 Button.pop(); 3480 }); 3481 } else if (p15.background !== undefined) { 3482 this.ifElseBranchUpdateFunction(2, () => { 3483 this.observeComponentCreation2((v15, w15) => { 3484 Button.createWithLabel(p15.value); 3485 __Button__setButtonProperties(p15, this.buttons, this.controller); 3486 Button.backgroundColor(p15.background); 3487 Button.key(`advanced_dialog_button_${this.keyIndex++}`); 3488 Button.labelStyle({ 3489 maxLines: 1, 3490 maxFontSize: this.buttonMaxFontSize, 3491 minFontSize: this.buttonMinFontSize 3492 }); 3493 }, Button); 3494 Button.pop(); 3495 }); 3496 } else { 3497 this.ifElseBranchUpdateFunction(3, () => { 3498 this.observeComponentCreation2((t15, u15) => { 3499 Button.createWithLabel(p15.value); 3500 __Button__setButtonProperties(p15, this.buttons, this.controller); 3501 Button.fontColor(p15.fontColor); 3502 Button.key(`advanced_dialog_button_${this.keyIndex++}`); 3503 Button.labelStyle({ 3504 maxLines: 1, 3505 maxFontSize: this.buttonMaxFontSize, 3506 minFontSize: this.buttonMinFontSize 3507 }); 3508 }, Button); 3509 Button.pop(); 3510 }); 3511 } 3512 }, If); 3513 If.pop(); 3514 } 3515 3516 buildHorizontalAlignButtons(e15 = null) { 3517 this.observeComponentCreation2((f15, g15) => { 3518 If.create(); 3519 if (this.buttons && this.buttons.length > 0) { 3520 this.ifElseBranchUpdateFunction(0, () => { 3521 this.observeComponentCreation2((n15, o15) => { 3522 Row.create(); 3523 }, Row); 3524 this.buildSingleButton.bind(this)(this.buttons[0]); 3525 this.observeComponentCreation2((h15, i15) => { 3526 If.create(); 3527 if (this.buttons.length === HORIZON_BUTTON_MAX_COUNT) { 3528 this.ifElseBranchUpdateFunction(0, () => { 3529 this.observeComponentCreation2((l15, m15) => { 3530 Row.create(); 3531 Row.width(BUTTON_HORIZONTAL_SPACE * 2); 3532 Row.justifyContent(FlexAlign.Center); 3533 }, Row); 3534 this.observeComponentCreation2((j15, k15) => { 3535 Divider.create(); 3536 Divider.width({ 3537 'id': -1, 3538 'type': 10002, 3539 params: ['sys.float.alert_divider_width'], 3540 'bundleName': '__harDefaultBundleName__', 3541 'moduleName': '__harDefaultModuleName__' 3542 }); 3543 Divider.height({ 3544 'id': -1, 3545 'type': 10002, 3546 params: ['sys.float.alert_divider_height'], 3547 'bundleName': '__harDefaultBundleName__', 3548 'moduleName': '__harDefaultModuleName__' 3549 }); 3550 Divider.color(this.getDividerColor()); 3551 Divider.vertical(true); 3552 }, Divider); 3553 Row.pop(); 3554 this.buildSingleButton.bind(this)(this.buttons[HORIZON_BUTTON_MAX_COUNT - 1]); 3555 }); 3556 } else { 3557 this.ifElseBranchUpdateFunction(1, () => { 3558 }); 3559 } 3560 }, If); 3561 If.pop(); 3562 Row.pop(); 3563 }); 3564 } else { 3565 this.ifElseBranchUpdateFunction(1, () => { 3566 }); 3567 } 3568 }, If); 3569 If.pop(); 3570 } 3571 3572 buildVerticalAlignButtons(s14 = null) { 3573 this.observeComponentCreation2((t14, u14) => { 3574 If.create(); 3575 if (this.buttons) { 3576 this.ifElseBranchUpdateFunction(0, () => { 3577 this.observeComponentCreation2((c15, d15) => { 3578 Column.create(); 3579 }, Column); 3580 this.observeComponentCreation2((v14, w14) => { 3581 ForEach.create(); 3582 const b = (z14, a15) => { 3583 const b15 = z14; 3584 this.buildButtonWithDivider.bind(this)(this.buttons?.length === HORIZON_BUTTON_MAX_COUNT ? 3585 HORIZON_BUTTON_MAX_COUNT - a15 - 1 : a15); 3586 }; 3587 this.forEachUpdateFunction(v14, this.buttons.slice(0, VERTICAL_BUTTON_MAX_COUNT), 3588 b, (y14) => y14.value.toString(), true, false); 3589 }, ForEach); 3590 ForEach.pop(); 3591 Column.pop(); 3592 }); 3593 } else { 3594 this.ifElseBranchUpdateFunction(1, () => { 3595 }); 3596 } 3597 }, If); 3598 If.pop(); 3599 } 3600 3601 getDividerColor() { 3602 if (!this.buttons || this.buttons.length === 0 || !DIALOG_DIVIDER_SHOW) { 3603 return Color.Transparent; 3604 } 3605 if (this.buttons[0].buttonStyle === ButtonStyleMode.TEXTUAL || this.buttons[0].buttonStyle === undefined) { 3606 if (this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === ButtonStyleMode.TEXTUAL || 3607 this.buttons[HORIZON_BUTTON_MAX_COUNT - 1].buttonStyle === undefined) { 3608 return { 3609 'id': -1, 3610 'type': 10001, 3611 params: ['sys.color.alert_divider_color'], 3612 'bundleName': '__harDefaultBundleName__', 3613 'moduleName': '__harDefaultModuleName__' 3614 }; 3615 } 3616 } 3617 return Color.Transparent; 3618 } 3619 3620 isNewPropertiesHighPriority(r14) { 3621 if (r14.role === ButtonRole.ERROR) { 3622 return true; 3623 } 3624 if (r14.buttonStyle !== undefined && 3625 r14.buttonStyle !== ALERT_BUTTON_STYLE) { 3626 return true; 3627 } 3628 if (r14.background === undefined && r14.fontColor === undefined) { 3629 return true; 3630 } 3631 return false; 3632 } 3633 3634 buildButtonWithDivider(h14, i14 = null) { 3635 this.observeComponentCreation2((j14, k14) => { 3636 If.create(); 3637 if (this.buttons && this.buttons[h14]) { 3638 this.ifElseBranchUpdateFunction(0, () => { 3639 this.observeComponentCreation2((p14, q14) => { 3640 Row.create(); 3641 }, Row); 3642 this.buildSingleButton.bind(this)(this.buttons[h14]); 3643 Row.pop(); 3644 this.observeComponentCreation2((l14, m14) => { 3645 If.create(); 3646 if ((this.buttons.length === HORIZON_BUTTON_MAX_COUNT ? 3647 HORIZON_BUTTON_MAX_COUNT - h14 - 1 : h14) < 3648 Math.min(this.buttons.length, VERTICAL_BUTTON_MAX_COUNT) - 1) { 3649 this.ifElseBranchUpdateFunction(0, () => { 3650 this.observeComponentCreation2((n14, o14) => { 3651 Row.create(); 3652 Row.height({ 3653 'id': -1, 3654 'type': 10002, 3655 params: ['sys.float.alert_button_vertical_space'], 3656 'bundleName': '__harDefaultBundleName__', 3657 'moduleName': '__harDefaultModuleName__' 3658 }); 3659 }, Row); 3660 Row.pop(); 3661 }); 3662 } else { 3663 this.ifElseBranchUpdateFunction(1, () => { 3664 }); 3665 } 3666 }, If); 3667 If.pop(); 3668 }); 3669 } else { 3670 this.ifElseBranchUpdateFunction(1, () => { 3671 }); 3672 } 3673 }, If); 3674 If.pop(); 3675 } 3676 3677 isVerticalAlignButton(c14) { 3678 if (this.buttons) { 3679 if (this.buttons.length === 1) { 3680 return false; 3681 } 3682 if (this.buttons.length !== HORIZON_BUTTON_MAX_COUNT) { 3683 return true; 3684 } 3685 let d14 = false; 3686 let e14 = vp2px(c14 / HORIZON_BUTTON_MAX_COUNT - BUTTON_HORIZONTAL_MARGIN - 3687 BUTTON_HORIZONTAL_SPACE - 2 * BUTTON_HORIZONTAL_PADDING); 3688 this.buttons.forEach((f14) => { 3689 let g14 = measure.measureTextSize({ 3690 textContent: f14.value, 3691 fontSize: this.buttonMaxFontSize 3692 }); 3693 if (Number(g14.width) > e14) { 3694 d14 = true; 3695 } 3696 }); 3697 return d14; 3698 } 3699 return false; 3700 } 3701 3702 rerender() { 3703 this.updateDirtyElements(); 3704 } 3705} 3706 3707function __Button__setButtonProperties(z13, a14, b14) { 3708 Button.onClick(() => { 3709 if (z13.action) { 3710 z13.action(); 3711 } 3712 b14?.close(); 3713 }); 3714 Button.defaultFocus(z13.defaultFocus ? true : isHasDefaultFocus(a14) ? false : true); 3715 Button.buttonStyle(z13.buttonStyle ?? ALERT_BUTTON_STYLE); 3716 Button.layoutWeight(BUTTON_LAYOUT_WEIGHT); 3717 Button.type(ButtonType.ROUNDED_RECTANGLE); 3718} 3719 3720function isHasDefaultFocus(t13) { 3721 try { 3722 let x13 = false; 3723 t13?.forEach((y13) => { 3724 if (y13.defaultFocus) { 3725 x13 = true; 3726 } 3727 }); 3728 return x13; 3729 } catch (u13) { 3730 let v13 = u13.code; 3731 let w13 = u13.message; 3732 hilog.error(0x3900, 'Ace', `get defaultFocus exist error, code: ${v13}, message: ${w13}`); 3733 return false; 3734 } 3735} 3736 3737function getNumberByResourceId(m13, n13, o13) { 3738 try { 3739 let s13 = resourceManager.getSystemResourceManager().getNumber(m13); 3740 if (s13 > 0 || o13) { 3741 return s13; 3742 } else { 3743 return n13; 3744 } 3745 } catch (p13) { 3746 let q13 = p13.code; 3747 let r13 = p13.message; 3748 hilog.error(0x3900, 'Ace', `CustomContentDialog getNumberByResourceId error, code: ${q13}, message: ${r13}`); 3749 return n13; 3750 } 3751} 3752 3753function getEnumNumberByResourceId(g13, h13) { 3754 try { 3755 let l13 = getContext().resourceManager.getNumber(g13); 3756 if (l13 > 0) { 3757 return l13; 3758 } else { 3759 return h13; 3760 } 3761 } catch (i13) { 3762 let j13 = i13.code; 3763 let k13 = i13.message; 3764 hilog.error(0x3900, 'Ace', `getEnumNumberByResourceId error, code: ${j13}, message: ${k13}`); 3765 return h13; 3766 } 3767} 3768 3769function getAccessibilityText(z12, a13) { 3770 try { 3771 let e13 = getContext().resourceManager.getStringSync(125833934); 3772 let f13 = ''; 3773 if (typeof z12 === 'string') { 3774 f13 = z12; 3775 } else { 3776 f13 = getContext().resourceManager.getStringSync(z12); 3777 } 3778 return a13 ? `${e13},${f13}` : f13; 3779 } catch (b13) { 3780 let c13 = b13.code; 3781 let d13 = b13.message; 3782 hilog.error(0x3900, 'Ace', `getAccessibilityText error, code: ${c13}, message: ${d13}`); 3783 return ''; 3784 } 3785} 3786 3787function getTextAlign(u12, v12, w12) { 3788 let x12 = measure.measureTextSize({ 3789 textContent: v12, 3790 fontSize: w12, 3791 constraintWidth: u12, 3792 }); 3793 let y12 = measure.measureTextSize({ 3794 textContent: v12, 3795 fontSize: w12, 3796 }); 3797 if (getTextHeight(x12) <= getTextHeight(y12)) { 3798 return TextAlign.Center; 3799 } 3800 return TextAlign.Start; 3801} 3802 3803function getTextHeight(t12) { 3804 if (t12 && t12.height !== null && t12.height !== undefined) { 3805 return Number(t12.height); 3806 } 3807 return 0; 3808} 3809 3810function resolveKeyEvent(r12, s12) { 3811 if (r12.type === IGNORE_KEY_EVENT_TYPE) { 3812 return; 3813 } 3814 if (r12.keyCode === KEYCODE_UP) { 3815 s12.scrollPage({ next: false }); 3816 r12.stopPropagation(); 3817 } else if (r12.keyCode === KEYCODE_DOWN) { 3818 if (s12.isAtEnd()) { 3819 return; 3820 } else { 3821 s12.scrollPage({ next: true }); 3822 r12.stopPropagation(); 3823 } 3824 } 3825} 3826 3827export class LoadingDialog extends ViewPU { 3828 constructor(l12, m12, n12, o12 = -1, p12 = undefined, q12) { 3829 super(l12, n12, o12, q12); 3830 if (typeof p12 === 'function') { 3831 this.paramsGenerator_ = p12; 3832 } 3833 this.controller = undefined; 3834 this.content = ''; 3835 this.__fontColorWithTheme = new ObservedPropertyObjectPU({ 3836 'id': -1, 3837 'type': 10001, 3838 params: ['sys.color.font_primary'], 3839 'bundleName': '__harDefaultBundleName__', 3840 'moduleName': '__harDefaultModuleName__' 3841 }, this, 'fontColorWithTheme'); 3842 this.__loadingProgressIconColorWithTheme = new ObservedPropertyObjectPU({ 3843 'id': -1, 3844 'type': 10001, 3845 params: ['sys.color.icon_secondary'], 3846 'bundleName': '__harDefaultBundleName__', 3847 'moduleName': '__harDefaultModuleName__' 3848 }, this, 'loadingProgressIconColorWithTheme'); 3849 this.theme = new CustomThemeImpl({}); 3850 this.themeColorMode = ThemeColorMode.SYSTEM; 3851 this.__fontSizeScale = new ObservedPropertySimplePU(1, this, 'fontSizeScale'); 3852 this.__minContentHeight = new ObservedPropertySimplePU(MIN_CONTENT_HEIGHT, this, 'minContentHeight'); 3853 this.setInitiallyProvidedValue(m12); 3854 this.finalizeConstruction(); 3855 } 3856 3857 setInitiallyProvidedValue(k12) { 3858 if (k12.controller !== undefined) { 3859 this.controller = k12.controller; 3860 } 3861 if (k12.content !== undefined) { 3862 this.content = k12.content; 3863 } 3864 if (k12.fontColorWithTheme !== undefined) { 3865 this.fontColorWithTheme = k12.fontColorWithTheme; 3866 } 3867 if (k12.loadingProgressIconColorWithTheme !== undefined) { 3868 this.loadingProgressIconColorWithTheme = k12.loadingProgressIconColorWithTheme; 3869 } 3870 if (k12.theme !== undefined) { 3871 this.theme = k12.theme; 3872 } 3873 if (k12.themeColorMode !== undefined) { 3874 this.themeColorMode = k12.themeColorMode; 3875 } 3876 if (k12.fontSizeScale !== undefined) { 3877 this.fontSizeScale = k12.fontSizeScale; 3878 } 3879 if (k12.minContentHeight !== undefined) { 3880 this.minContentHeight = k12.minContentHeight; 3881 } 3882 } 3883 3884 updateStateVars(j12) { 3885 } 3886 3887 purgeVariableDependenciesOnElmtId(i12) { 3888 this.__fontColorWithTheme.purgeDependencyOnElmtId(i12); 3889 this.__loadingProgressIconColorWithTheme.purgeDependencyOnElmtId(i12); 3890 this.__fontSizeScale.purgeDependencyOnElmtId(i12); 3891 this.__minContentHeight.purgeDependencyOnElmtId(i12); 3892 } 3893 3894 aboutToBeDeleted() { 3895 this.__fontColorWithTheme.aboutToBeDeleted(); 3896 this.__loadingProgressIconColorWithTheme.aboutToBeDeleted(); 3897 this.__fontSizeScale.aboutToBeDeleted(); 3898 this.__minContentHeight.aboutToBeDeleted(); 3899 SubscriberManager.Get().delete(this.id__()); 3900 this.aboutToBeDeletedInternal(); 3901 } 3902 3903 setController(h12) { 3904 this.controller = h12; 3905 } 3906 3907 get fontColorWithTheme() { 3908 return this.__fontColorWithTheme.get(); 3909 } 3910 3911 set fontColorWithTheme(g12) { 3912 this.__fontColorWithTheme.set(g12); 3913 } 3914 3915 get loadingProgressIconColorWithTheme() { 3916 return this.__loadingProgressIconColorWithTheme.get(); 3917 } 3918 3919 set loadingProgressIconColorWithTheme(f12) { 3920 this.__loadingProgressIconColorWithTheme.set(f12); 3921 } 3922 3923 get fontSizeScale() { 3924 return this.__fontSizeScale.get(); 3925 } 3926 3927 set fontSizeScale(e12) { 3928 this.__fontSizeScale.set(e12); 3929 } 3930 3931 get minContentHeight() { 3932 return this.__minContentHeight.get(); 3933 } 3934 3935 set minContentHeight(d12) { 3936 this.__minContentHeight.set(d12); 3937 } 3938 3939 initialRender() { 3940 this.observeComponentCreation2((b12, c12) => { 3941 Column.create(); 3942 }, Column); 3943 this.observeComponentCreation2((z11, a12) => { 3944 __Common__.create(); 3945 __Common__.constraintSize({ maxHeight: '100%' }); 3946 }, __Common__); 3947 { 3948 this.observeComponentCreation2((v11, w11) => { 3949 if (w11) { 3950 let x11 = new CustomDialogContentComponent(this, { 3951 controller: this.controller, 3952 contentBuilder: () => { 3953 this.contentBuilder(); 3954 }, 3955 theme: this.theme, 3956 themeColorMode: this.themeColorMode, 3957 fontSizeScale: this.__fontSizeScale, 3958 minContentHeight: this.__minContentHeight, 3959 }, undefined, v11, () => { 3960 }, { page: 'library/src/main/ets/components/MainPage.ets', line: 1661, col: 7 }); 3961 ViewPU.create(x11); 3962 let a = () => { 3963 return { 3964 controller: this.controller, 3965 contentBuilder: () => { 3966 this.contentBuilder(); 3967 }, 3968 theme: this.theme, 3969 themeColorMode: this.themeColorMode, 3970 fontSizeScale: this.fontSizeScale, 3971 minContentHeight: this.minContentHeight 3972 }; 3973 }; 3974 x11.paramsGenerator_ = a; 3975 } else { 3976 this.updateStateVarsOfChildByElmtId(v11, {}); 3977 } 3978 }, { name: 'CustomDialogContentComponent' }); 3979 } 3980 __Common__.pop(); 3981 Column.pop(); 3982 } 3983 3984 contentBuilder(m11 = null) { 3985 this.observeComponentCreation2((t11, u11) => { 3986 Column.create(); 3987 }, Column); 3988 this.observeComponentCreation2((r11, s11) => { 3989 Row.create(); 3990 Row.constraintSize({ minHeight: LOADING_MIN_HEIGHT }); 3991 }, Row); 3992 this.observeComponentCreation2((p11, q11) => { 3993 Text.create(this.content); 3994 Text.fontSize(`${BODY_L}fp`); 3995 Text.fontWeight(FontWeight.Regular); 3996 Text.fontColor(ObservedObject.GetRawObject(this.fontColorWithTheme)); 3997 Text.layoutWeight(LOADING_TEXT_LAYOUT_WEIGHT); 3998 Text.maxLines(this.fontSizeScale > MAX_FONT_SCALE ? LOADING_MAX_LINES_BIG_FONT : LOADING_MAX_LINES); 3999 Text.focusable(true); 4000 Text.defaultFocus(true); 4001 Text.focusBox({ 4002 strokeWidth: LengthMetrics.px(0) 4003 }); 4004 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 4005 }, Text); 4006 Text.pop(); 4007 this.observeComponentCreation2((n11, o11) => { 4008 LoadingProgress.create(); 4009 LoadingProgress.color(ObservedObject.GetRawObject(this.loadingProgressIconColorWithTheme)); 4010 LoadingProgress.width(LOADING_PROGRESS_WIDTH); 4011 LoadingProgress.height(LOADING_PROGRESS_HEIGHT); 4012 LoadingProgress.margin({ start: LengthMetrics.vp(LOADING_TEXT_MARGIN_LEFT) }); 4013 }, LoadingProgress); 4014 Row.pop(); 4015 Column.pop(); 4016 } 4017 aboutToAppear() { 4018 this.fontColorWithTheme = this.theme?.colors?.fontPrimary ? 4019 this.theme.colors.fontPrimary : { 4020 'id': -1, 4021 'type': 10001, 4022 params: ['sys.color.font_primary'], 4023 'bundleName': '__harDefaultBundleName__', 4024 'moduleName': '__harDefaultModuleName__' 4025 }; 4026 this.loadingProgressIconColorWithTheme = this.theme?.colors?.iconSecondary ? 4027 this.theme.colors.iconSecondary : { 4028 'id': -1, 4029 'type': 10001, 4030 params: ['sys.color.icon_secondary'], 4031 'bundleName': '__harDefaultBundleName__', 4032 'moduleName': '__harDefaultModuleName__' 4033 }; 4034 } 4035 4036 rerender() { 4037 this.updateDirtyElements(); 4038 } 4039} 4040 4041export class PopoverDialog extends ViewPU { 4042 constructor(g11, h11, i11, j11 = -1, k11 = undefined, l11) { 4043 super(g11, i11, j11, l11); 4044 if (typeof k11 === 'function') { 4045 this.paramsGenerator_ = k11; 4046 } 4047 this.__visible = new SynchedPropertySimpleTwoWayPU(h11.visible, this, 'visible'); 4048 this.__popover = new SynchedPropertyObjectOneWayPU(h11.popover, this, 'popover'); 4049 this.targetBuilder = undefined; 4050 this.__dialogWidth = new ObservedPropertyObjectPU(this.popover?.width, this, 'dialogWidth'); 4051 this.setInitiallyProvidedValue(h11); 4052 this.finalizeConstruction(); 4053 } 4054 4055 setInitiallyProvidedValue(f11) { 4056 if (f11.targetBuilder !== undefined) { 4057 this.targetBuilder = f11.targetBuilder; 4058 } 4059 if (f11.dialogWidth !== undefined) { 4060 this.dialogWidth = f11.dialogWidth; 4061 } 4062 } 4063 4064 updateStateVars(e11) { 4065 this.__popover.reset(e11.popover); 4066 } 4067 4068 purgeVariableDependenciesOnElmtId(d11) { 4069 this.__visible.purgeDependencyOnElmtId(d11); 4070 this.__popover.purgeDependencyOnElmtId(d11); 4071 this.__dialogWidth.purgeDependencyOnElmtId(d11); 4072 } 4073 4074 aboutToBeDeleted() { 4075 this.__visible.aboutToBeDeleted(); 4076 this.__popover.aboutToBeDeleted(); 4077 this.__dialogWidth.aboutToBeDeleted(); 4078 SubscriberManager.Get().delete(this.id__()); 4079 this.aboutToBeDeletedInternal(); 4080 } 4081 4082 get visible() { 4083 return this.__visible.get(); 4084 } 4085 4086 set visible(c11) { 4087 this.__visible.set(c11); 4088 } 4089 4090 get popover() { 4091 return this.__popover.get(); 4092 } 4093 4094 set popover(b11) { 4095 this.__popover.set(b11); 4096 } 4097 4098 get dialogWidth() { 4099 return this.__dialogWidth.get(); 4100 } 4101 4102 set dialogWidth(a11) { 4103 this.__dialogWidth.set(a11); 4104 } 4105 4106 emptyBuilder(z10 = null) { 4107 } 4108 4109 aboutToAppear() { 4110 if (this.targetBuilder === undefined || this.targetBuilder === null) { 4111 this.targetBuilder = this.emptyBuilder; 4112 } 4113 } 4114 4115 initialRender() { 4116 this.observeComponentCreation2((k3, v3) => { 4117 Column.create(); 4118 Column.onClick(() => { 4119 let r4 = display.getDefaultDisplaySync(); 4120 let y4 = px2vp(r4.width); 4121 if (y4 - BUTTON_HORIZONTAL_MARGIN - BUTTON_HORIZONTAL_MARGIN > MAX_DIALOG_WIDTH) { 4122 this.popover.width = this.popover?.width ?? MAX_DIALOG_WIDTH; 4123 } else { 4124 this.popover.width = this.dialogWidth; 4125 } 4126 this.visible = !this.visible; 4127 }); 4128 Column.bindPopup(this.visible, { 4129 builder: this.popover?.builder, 4130 placement: this.popover?.placement ?? Placement.Bottom, 4131 popupColor: this.popover?.popupColor, 4132 enableArrow: this.popover?.enableArrow ?? true, 4133 autoCancel: this.popover?.autoCancel, 4134 onStateChange: this.popover?.onStateChange ?? ((o4) => { 4135 if (!o4.isVisible) { 4136 this.visible = false; 4137 } 4138 }), 4139 arrowOffset: this.popover?.arrowOffset, 4140 showInSubWindow: this.popover?.showInSubWindow, 4141 mask: this.popover?.mask, 4142 targetSpace: this.popover?.targetSpace, 4143 offset: this.popover?.offset, 4144 width: this.popover?.width, 4145 arrowPointPosition: this.popover?.arrowPointPosition, 4146 arrowWidth: this.popover?.arrowWidth, 4147 arrowHeight: this.popover?.arrowHeight, 4148 radius: this.popover?.radius ?? { 4149 'id': -1, 4150 'type': 10002, 4151 params: ['sys.float.corner_radius_level16'], 4152 'bundleName': '__harDefaultBundleName__', 4153 'moduleName': '__harDefaultModuleName__' 4154 }, 4155 shadow: this.popover?.shadow ?? ShadowStyle.OUTER_DEFAULT_MD, 4156 backgroundBlurStyle: this.popover?.backgroundBlurStyle ?? BlurStyle.COMPONENT_ULTRA_THICK, 4157 focusable: this.popover?.focusable, 4158 transition: this.popover?.transition, 4159 onWillDismiss: this.popover?.onWillDismiss 4160 }); 4161 }, Column); 4162 this.targetBuilder.bind(this)(); 4163 Column.pop(); 4164 } 4165 4166 rerender() { 4167 this.updateDirtyElements(); 4168 } 4169} 4170 4171export default { TipsDialog, ConfirmDialog, SelectDialog, AlertDialog, LoadingDialog, CustomContentDialog, PopoverDialog };