1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {}); 18 } 19 const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 20 const measure = requireNapi('measure'); 21 const mediaquery = requireNapi('mediaquery'); 22 const resourceManager = requireNapi('resourceManager'); 23 const componentUtils = requireNapi('arkui.componentUtils'); 24 const hilog = requireNapi('hilog'); 25 const ColorMetrics = requireNapi('arkui.node').ColorMetrics; 26 const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 27 const LengthUnit = requireNapi('arkui.node').LengthUnit; 28 const o = 10003; 29 const t = 10002; 30 const u = 10007; 31 export var ChipSize; 32 (function (ChipSize) { 33 ChipSize['NORMAL'] = 'NORMAL'; 34 ChipSize['SMALL'] = 'SMALL'; 35 })(ChipSize || (ChipSize = {})); 36 var a1; 37 (function (v1) { 38 v1['SM'] = 'SM'; 39 v1['MD'] = 'MD'; 40 v1['LG'] = 'LG'; 41 })(a1 || (a1 = {})); 42 export var AccessibilitySelectedType; 43 (function (AccessibilitySelectedType) { 44 AccessibilitySelectedType[(AccessibilitySelectedType['CLICKED'] = 0)] = 45 'CLICKED'; 46 AccessibilitySelectedType[(AccessibilitySelectedType['CHECKED'] = 1)] = 47 'CHECKED'; 48 AccessibilitySelectedType[(AccessibilitySelectedType['SELECTED'] = 2)] = 49 'SELECTED'; 50 })(AccessibilitySelectedType || (AccessibilitySelectedType = {})); 51 export const b1 = { 52 prefixIcon: { 53 size: { width: 16, height: 16 }, 54 fillColor: { 55 id: -1, 56 type: 10001, 57 params: ['sys.color.ohos_id_color_secondary'], 58 bundleName: '__harDefaultBundleName__', 59 moduleName: '__harDefaultModuleName__', 60 }, 61 activatedFillColor: { 62 id: -1, 63 type: 10001, 64 params: ['sys.color.ohos_id_color_text_primary_contrary'], 65 bundleName: '__harDefaultBundleName__', 66 moduleName: '__harDefaultModuleName__', 67 }, 68 }, 69 label: { 70 e1: { 71 id: -1, 72 type: 10002, 73 params: ['sys.float.ohos_id_text_size_button2'], 74 bundleName: '__harDefaultBundleName__', 75 moduleName: '__harDefaultModuleName__', 76 }, 77 f1: { 78 id: -1, 79 type: 10002, 80 params: ['sys.float.ohos_id_text_size_button2'], 81 bundleName: '__harDefaultBundleName__', 82 moduleName: '__harDefaultModuleName__', 83 }, 84 fontColor: { 85 id: -1, 86 type: 10001, 87 params: ['sys.color.ohos_id_color_text_primary'], 88 bundleName: '__harDefaultBundleName__', 89 moduleName: '__harDefaultModuleName__', 90 }, 91 activatedFontColor: { 92 id: -1, 93 type: 10001, 94 params: ['sys.color.ohos_id_color_text_primary_contrary'], 95 bundleName: '__harDefaultBundleName__', 96 moduleName: '__harDefaultModuleName__', 97 }, 98 fontFamily: 'HarmonyOS Sans', 99 g1: { 100 left: 6, 101 right: 6, 102 top: 0, 103 bottom: 0, 104 }, 105 h1: { 106 left: 4, 107 right: 4, 108 top: 0, 109 bottom: 0, 110 }, 111 defaultFontSize: 14, 112 i1: { 113 start: LengthMetrics.vp(6), 114 end: LengthMetrics.vp(6), 115 top: LengthMetrics.vp(0), 116 bottom: LengthMetrics.vp(0), 117 }, 118 j1: { 119 start: LengthMetrics.vp(4), 120 end: LengthMetrics.vp(4), 121 top: LengthMetrics.vp(0), 122 bottom: LengthMetrics.vp(0), 123 }, 124 }, 125 suffixIcon: { 126 size: { width: 16, height: 16 }, 127 fillColor: { 128 id: -1, 129 type: 10001, 130 params: ['sys.color.ohos_id_color_secondary'], 131 bundleName: '__harDefaultBundleName__', 132 moduleName: '__harDefaultModuleName__', 133 }, 134 activatedFillColor: { 135 id: -1, 136 type: 10001, 137 params: ['sys.color.ohos_id_color_text_primary_contrary'], 138 bundleName: '__harDefaultBundleName__', 139 moduleName: '__harDefaultModuleName__', 140 }, 141 l1: { 142 id: -1, 143 type: 20000, 144 params: ['sys.media.ohos_ic_public_cancel', 16, 16], 145 bundleName: '__harDefaultBundleName__', 146 moduleName: '__harDefaultModuleName__', 147 }, 148 focusable: false, 149 }, 150 m1: { 151 n1: [ 152 { 153 id: -1, 154 type: 10001, 155 params: ['sys.color.ohos_id_color_secondary'], 156 bundleName: '__harDefaultBundleName__', 157 moduleName: '__harDefaultModuleName__', 158 }, 159 ], 160 activatedFontColor: [ 161 { 162 id: -1, 163 type: 10001, 164 params: ['sys.color.ohos_id_color_text_primary_contrary'], 165 bundleName: '__harDefaultBundleName__', 166 moduleName: '__harDefaultModuleName__', 167 }, 168 ], 169 fontSize: 16, 170 o1: -1, 171 }, 172 q1: { 173 s1: 1.75, 174 t1: 12, 175 u1: 36, 176 v1: 28, 177 enabled: true, 178 activated: false, 179 backgroundColor: { 180 id: -1, 181 type: 10001, 182 params: ['sys.color.ohos_id_color_button_normal'], 183 bundleName: '__harDefaultBundleName__', 184 moduleName: '__harDefaultModuleName__', 185 }, 186 activatedBackgroundColor: { 187 id: -1, 188 type: 10001, 189 params: ['sys.color.ohos_id_color_emphasize'], 190 bundleName: '__harDefaultBundleName__', 191 moduleName: '__harDefaultModuleName__', 192 }, 193 w1: { 194 id: -1, 195 type: 10001, 196 params: ['sys.color.ohos_id_color_focused_outline'], 197 bundleName: '__harDefaultBundleName__', 198 moduleName: '__harDefaultModuleName__', 199 }, 200 z1: 2, 201 a2: { 202 id: -1, 203 type: 10002, 204 params: ['sys.float.ohos_id_corner_radius_tips_instant_tip'], 205 bundleName: '__harDefaultBundleName__', 206 moduleName: '__harDefaultModuleName__', 207 }, 208 b2: { 209 id: -1, 210 type: 10002, 211 params: ['sys.float.ohos_id_corner_radius_piece'], 212 bundleName: '__harDefaultBundleName__', 213 moduleName: '__harDefaultModuleName__', 214 }, 215 borderWidth: 2, 216 c2: { 217 start: LengthMetrics.vp(16), 218 end: LengthMetrics.vp(16), 219 top: LengthMetrics.vp(4), 220 bottom: LengthMetrics.vp(4), 221 }, 222 d2: { 223 start: LengthMetrics.vp(12), 224 end: LengthMetrics.vp(12), 225 top: LengthMetrics.vp(4), 226 bottom: LengthMetrics.vp(4), 227 }, 228 e2: { 229 id: -1, 230 type: 10001, 231 params: ['sys.color.ohos_id_color_hover'], 232 bundleName: '__harDefaultBundleName__', 233 moduleName: '__harDefaultModuleName__', 234 }, 235 f2: { 236 id: -1, 237 type: 10001, 238 params: ['sys.color.ohos_id_color_click_effect'], 239 bundleName: '__harDefaultBundleName__', 240 moduleName: '__harDefaultModuleName__', 241 }, 242 opacity: { normal: 1, hover: 0.95, pressed: 0.9 }, 243 g2: { 244 h2: 128, 245 i2: 156, 246 j2: 280, 247 l2: 400, 248 }, 249 }, 250 }; 251 const c1 = () => {}; 252 export function Chip(options, parent = null) { 253 const u1 = options; 254 { 255 (parent ? parent : this).observeComponentCreation2( 256 (elmtId, isInitialRender, options = u1) => { 257 if (isInitialRender) { 258 let componentCall = new d1( 259 parent ? parent : this, 260 { 261 chipSize: options.size, 262 prefixIcon: options.prefixIcon, 263 prefixSymbol: options.prefixSymbol, 264 label: options.label, 265 suffixIcon: options.suffixIcon, 266 suffixSymbol: options.suffixSymbol, 267 suffixSymbolOptions: options.suffixSymbolOptions, 268 allowClose: options.allowClose, 269 closeOptions: options.closeOptions, 270 chipEnabled: options.enabled, 271 chipActivated: options.activated, 272 chipNodeBackgroundColor: options.backgroundColor, 273 chipNodeActivatedBackgroundColor: 274 options.activatedBackgroundColor, 275 chipNodeRadius: options.borderRadius, 276 chipDirection: options.direction, 277 chipAccessibilitySelectedType: options.accessibilitySelectedType, 278 chipAccessibilityDescription: options.accessibilityDescription, 279 chipAccessibilityLevel: options.accessibilityLevel, 280 onClose: options.onClose, 281 onClicked: options.onClicked, 282 }, 283 undefined, 284 elmtId, 285 () => {}, 286 { 287 page: 'advancedComponents/src/main/ets/components/Chip.ets', 288 line: 296, 289 m2: 3, 290 } 291 ); 292 ViewPU.create(componentCall); 293 let paramsLambda = () => { 294 return { 295 chipSize: options.size, 296 prefixIcon: options.prefixIcon, 297 prefixSymbol: options.prefixSymbol, 298 label: options.label, 299 suffixIcon: options.suffixIcon, 300 suffixSymbol: options.suffixSymbol, 301 suffixSymbolOptions: options.suffixSymbolOptions, 302 allowClose: options.allowClose, 303 closeOptions: options.closeOptions, 304 chipEnabled: options.enabled, 305 chipActivated: options.activated, 306 chipNodeBackgroundColor: options.backgroundColor, 307 chipNodeActivatedBackgroundColor: 308 options.activatedBackgroundColor, 309 chipNodeRadius: options.borderRadius, 310 chipDirection: options.direction, 311 chipAccessibilitySelectedType: options.accessibilitySelectedType, 312 chipAccessibilityDescription: options.accessibilityDescription, 313 chipAccessibilityLevel: options.accessibilityLevel, 314 onClose: options.onClose, 315 onClicked: options.onClicked, 316 }; 317 }; 318 componentCall.paramsGenerator_ = paramsLambda; 319 } else { 320 (parent ? parent : this).updateStateVarsOfChildByElmtId(elmtId, { 321 chipSize: options.size, 322 prefixIcon: options.prefixIcon, 323 prefixSymbol: options.prefixSymbol, 324 label: options.label, 325 suffixIcon: options.suffixIcon, 326 suffixSymbol: options.suffixSymbol, 327 suffixSymbolOptions: options.suffixSymbolOptions, 328 allowClose: options.allowClose, 329 closeOptions: options.closeOptions, 330 chipEnabled: options.enabled, 331 chipActivated: options.activated, 332 chipNodeBackgroundColor: options.backgroundColor, 333 chipNodeActivatedBackgroundColor: options.activatedBackgroundColor, 334 chipNodeRadius: options.borderRadius, 335 chipDirection: options.direction, 336 chipAccessibilitySelectedType: options.accessibilitySelectedType, 337 chipAccessibilityDescription: options.accessibilityDescription, 338 chipAccessibilityLevel: options.accessibilityLevel, 339 }); 340 } 341 }, 342 { name: 'ChipComponent' } 343 ); 344 } 345 } 346 function i(dimension, t1) { 347 const matches = dimension.match(t1); 348 if (!matches || matches.length < 3) { 349 return false; 350 } 351 const value = Number.parseFloat(matches[1]); 352 return value >= 0; 353 } 354 function j(dimension) { 355 return i( 356 dimension, 357 new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i') 358 ); 359 } 360 function m(context, value) { 361 const resourceManager = context?.resourceManager; 362 if (value === void 0 || value === null || resourceManager === void 0) { 363 return false; 364 } 365 if (value.type !== o && value.type !== u && value.type !== t) { 366 return false; 367 } 368 if (value.type === u || value.type === t) { 369 if (resourceManager.getNumber(value.id) >= 0) { 370 return true; 371 } else { 372 return false; 373 } 374 } 375 if (value.type === o && !j(resourceManager.getStringSync(value.id))) { 376 return false; 377 } else { 378 return true; 379 } 380 } 381 export class d1 extends ViewPU { 382 constructor( 383 parent, 384 params, 385 __localStorage, 386 elmtId = -1, 387 paramsLambda = undefined, 388 extraInfo 389 ) { 390 super(parent, __localStorage, elmtId, extraInfo); 391 if (typeof paramsLambda === 'function') { 392 this.paramsGenerator_ = paramsLambda; 393 } 394 this.theme = b1; 395 this.n2 = new SynchedPropertyObjectOneWayPU( 396 params.chipSize, 397 this, 398 'chipSize' 399 ); 400 this.o2 = new SynchedPropertySimpleOneWayPU( 401 params.allowClose, 402 this, 403 'allowClose' 404 ); 405 this.q2 = new SynchedPropertyObjectOneWayPU( 406 params.closeOptions, 407 this, 408 'closeOptions' 409 ); 410 this.s2 = new SynchedPropertySimpleOneWayPU( 411 params.chipDirection, 412 this, 413 'chipDirection' 414 ); 415 this.t2 = new SynchedPropertyObjectOneWayPU( 416 params.prefixIcon, 417 this, 418 'prefixIcon' 419 ); 420 this.u2 = new SynchedPropertyObjectOneWayPU( 421 params.prefixSymbol, 422 this, 423 'prefixSymbol' 424 ); 425 this.v2 = new SynchedPropertyObjectOneWayPU(params.label, this, 'label'); 426 this.w2 = new SynchedPropertyObjectOneWayPU( 427 params.suffixIcon, 428 this, 429 'suffixIcon' 430 ); 431 this.z2 = new SynchedPropertyObjectOneWayPU( 432 params.suffixSymbol, 433 this, 434 'suffixSymbol' 435 ); 436 this.a3 = new SynchedPropertyObjectOneWayPU( 437 params.suffixSymbolOptions, 438 this, 439 'suffixSymbolOptions' 440 ); 441 this.b3 = new SynchedPropertyObjectOneWayPU( 442 params.chipNodeBackgroundColor, 443 this, 444 'chipNodeBackgroundColor' 445 ); 446 this.c3 = new SynchedPropertyObjectOneWayPU( 447 params.chipNodeActivatedBackgroundColor, 448 this, 449 'chipNodeActivatedBackgroundColor' 450 ); 451 this.d3 = new SynchedPropertyObjectOneWayPU( 452 params.chipNodeRadius, 453 this, 454 'chipNodeRadius' 455 ); 456 this.e3 = new SynchedPropertySimpleOneWayPU( 457 params.chipEnabled, 458 this, 459 'chipEnabled' 460 ); 461 this.f3 = new SynchedPropertySimpleOneWayPU( 462 params.chipActivated, 463 this, 464 'chipActivated' 465 ); 466 this.g3 = new SynchedPropertySimpleOneWayPU( 467 params.chipAccessibilitySelectedType, 468 this, 469 'chipAccessibilitySelectedType' 470 ); 471 this.h3 = new SynchedPropertyObjectOneWayPU( 472 params.chipAccessibilityDescription, 473 this, 474 'chipAccessibilityDescription' 475 ); 476 this.i3 = new SynchedPropertySimpleOneWayPU( 477 params.chipAccessibilityLevel, 478 this, 479 'chipAccessibilityLevel' 480 ); 481 this.j3 = new ObservedPropertySimplePU(false, this, 'isHover'); 482 this.l3 = new ObservedPropertyObjectPU({ x: 1, y: 1 }, this, 'chipScale'); 483 this.m3 = new ObservedPropertySimplePU(1, this, 'chipOpacity'); 484 this.n3 = new ObservedPropertyObjectPU( 485 Color.Transparent, 486 this, 487 'chipBlendColor' 488 ); 489 this.q3 = new ObservedPropertySimplePU(false, this, 'deleteChip'); 490 this.r3 = new ObservedPropertySimplePU(false, this, 'chipNodeOnFocus'); 491 this.s3 = new ObservedPropertySimplePU(false, this, 'useDefaultSuffixIcon'); 492 this.chipNodeSize = {}; 493 this.onClose = c1; 494 this.onClicked = c1; 495 this.t3 = new ObservedPropertySimplePU(false, this, 'suffixIconOnFocus'); 496 this.u3 = new ObservedPropertySimplePU(a1.SM, this, 'chipBreakPoints'); 497 this.smListener = mediaquery.matchMediaSync( 498 '(0vp<width) and (width<600vp)' 499 ); 500 this.mdListener = mediaquery.matchMediaSync( 501 '(600vp<=width) and (width<840vp)' 502 ); 503 this.lgListener = mediaquery.matchMediaSync('(840vp<=width)'); 504 this.v3 = new ObservedPropertySimplePU( 505 false, 506 this, 507 'isShowPressedBackGroundColor' 508 ); 509 this.w3 = new ObservedPropertyObjectPU(0, this, 'fontSizeScale'); 510 this.x3 = new ObservedPropertyObjectPU(0, this, 'fontWeightScale'); 511 this.callbacks = { 512 onConfigurationUpdated: (configuration) => { 513 this.fontSizeScale = configuration.fontSizeScale; 514 this.fontWeightScale = configuration.fontWeightScale; 515 }, 516 onMemoryLevel() {}, 517 }; 518 this.callbackId = undefined; 519 this.y3 = new ObservedPropertyObjectPU( 520 this.toVp( 521 componentUtils.getRectangleById('PrefixSymbolGlyph')?.size?.width 522 ), 523 this, 524 'prefixSymbolWidth' 525 ); 526 this.z3 = new ObservedPropertyObjectPU( 527 this.toVp( 528 componentUtils.getRectangleById('SuffixSymbolGlyph')?.size?.width 529 ), 530 this, 531 'suffixSymbolWidth' 532 ); 533 this.a4 = new ObservedPropertyObjectPU( 534 this.toVp( 535 componentUtils.getRectangleById('AllowCloseSymbolGlyph')?.size?.width 536 ), 537 this, 538 'allowCloseSymbolWidth' 539 ); 540 this.b4 = new ObservedPropertyObjectPU( 541 new SymbolEffect(), 542 this, 543 'symbolEffect' 544 ); 545 this.setInitiallyProvidedValue(params); 546 this.finalizeConstruction(); 547 } 548 setInitiallyProvidedValue(params) { 549 if (params.theme !== undefined) { 550 this.theme = params.theme; 551 } 552 if (params.chipSize === undefined) { 553 this.n2.set(ChipSize.NORMAL); 554 } 555 if (params.allowClose === undefined) { 556 this.o2.set(true); 557 } 558 if (params.chipDirection === undefined) { 559 this.s2.set(Direction.Auto); 560 } 561 if (params.prefixIcon === undefined) { 562 this.t2.set({ src: '' }); 563 } 564 if (params.label === undefined) { 565 this.v2.set({ text: '' }); 566 } 567 if (params.suffixIcon === undefined) { 568 this.w2.set({ src: '' }); 569 } 570 if (params.chipNodeBackgroundColor === undefined) { 571 this.b3.set(this.theme.q1.backgroundColor); 572 } 573 if (params.chipNodeActivatedBackgroundColor === undefined) { 574 this.c3.set(this.theme.q1.activatedBackgroundColor); 575 } 576 if (params.chipNodeRadius === undefined) { 577 this.d3.set(void 0); 578 } 579 if (params.chipEnabled === undefined) { 580 this.e3.set(true); 581 } 582 if (params.isHover !== undefined) { 583 this.isHover = params.isHover; 584 } 585 if (params.chipScale !== undefined) { 586 this.chipScale = params.chipScale; 587 } 588 if (params.chipOpacity !== undefined) { 589 this.chipOpacity = params.chipOpacity; 590 } 591 if (params.chipBlendColor !== undefined) { 592 this.chipBlendColor = params.chipBlendColor; 593 } 594 if (params.deleteChip !== undefined) { 595 this.deleteChip = params.deleteChip; 596 } 597 if (params.chipNodeOnFocus !== undefined) { 598 this.chipNodeOnFocus = params.chipNodeOnFocus; 599 } 600 if (params.useDefaultSuffixIcon !== undefined) { 601 this.useDefaultSuffixIcon = params.useDefaultSuffixIcon; 602 } 603 if (params.chipNodeSize !== undefined) { 604 this.chipNodeSize = params.chipNodeSize; 605 } 606 if (params.onClose !== undefined) { 607 this.onClose = params.onClose; 608 } 609 if (params.onClicked !== undefined) { 610 this.onClicked = params.onClicked; 611 } 612 if (params.suffixIconOnFocus !== undefined) { 613 this.suffixIconOnFocus = params.suffixIconOnFocus; 614 } 615 if (params.chipBreakPoints !== undefined) { 616 this.chipBreakPoints = params.chipBreakPoints; 617 } 618 if (params.smListener !== undefined) { 619 this.smListener = params.smListener; 620 } 621 if (params.mdListener !== undefined) { 622 this.mdListener = params.mdListener; 623 } 624 if (params.lgListener !== undefined) { 625 this.lgListener = params.lgListener; 626 } 627 if (params.isShowPressedBackGroundColor !== undefined) { 628 this.isShowPressedBackGroundColor = params.isShowPressedBackGroundColor; 629 } 630 if (params.fontSizeScale !== undefined) { 631 this.fontSizeScale = params.fontSizeScale; 632 } 633 if (params.fontWeightScale !== undefined) { 634 this.fontWeightScale = params.fontWeightScale; 635 } 636 if (params.callbacks !== undefined) { 637 this.callbacks = params.callbacks; 638 } 639 if (params.callbackId !== undefined) { 640 this.callbackId = params.callbackId; 641 } 642 if (params.prefixSymbolWidth !== undefined) { 643 this.prefixSymbolWidth = params.prefixSymbolWidth; 644 } 645 if (params.suffixSymbolWidth !== undefined) { 646 this.suffixSymbolWidth = params.suffixSymbolWidth; 647 } 648 if (params.allowCloseSymbolWidth !== undefined) { 649 this.allowCloseSymbolWidth = params.allowCloseSymbolWidth; 650 } 651 if (params.symbolEffect !== undefined) { 652 this.symbolEffect = params.symbolEffect; 653 } 654 } 655 updateStateVars(params) { 656 this.n2.reset(params.chipSize); 657 this.o2.reset(params.allowClose); 658 this.q2.reset(params.closeOptions); 659 this.s2.reset(params.chipDirection); 660 this.t2.reset(params.prefixIcon); 661 this.u2.reset(params.prefixSymbol); 662 this.v2.reset(params.label); 663 this.w2.reset(params.suffixIcon); 664 this.z2.reset(params.suffixSymbol); 665 this.a3.reset(params.suffixSymbolOptions); 666 this.b3.reset(params.chipNodeBackgroundColor); 667 this.c3.reset(params.chipNodeActivatedBackgroundColor); 668 this.d3.reset(params.chipNodeRadius); 669 this.e3.reset(params.chipEnabled); 670 this.f3.reset(params.chipActivated); 671 this.g3.reset(params.chipAccessibilitySelectedType); 672 this.h3.reset(params.chipAccessibilityDescription); 673 this.i3.reset(params.chipAccessibilityLevel); 674 } 675 purgeVariableDependenciesOnElmtId(rmElmtId) { 676 this.n2.purgeDependencyOnElmtId(rmElmtId); 677 this.o2.purgeDependencyOnElmtId(rmElmtId); 678 this.q2.purgeDependencyOnElmtId(rmElmtId); 679 this.s2.purgeDependencyOnElmtId(rmElmtId); 680 this.t2.purgeDependencyOnElmtId(rmElmtId); 681 this.u2.purgeDependencyOnElmtId(rmElmtId); 682 this.v2.purgeDependencyOnElmtId(rmElmtId); 683 this.w2.purgeDependencyOnElmtId(rmElmtId); 684 this.z2.purgeDependencyOnElmtId(rmElmtId); 685 this.a3.purgeDependencyOnElmtId(rmElmtId); 686 this.b3.purgeDependencyOnElmtId(rmElmtId); 687 this.c3.purgeDependencyOnElmtId(rmElmtId); 688 this.d3.purgeDependencyOnElmtId(rmElmtId); 689 this.e3.purgeDependencyOnElmtId(rmElmtId); 690 this.f3.purgeDependencyOnElmtId(rmElmtId); 691 this.g3.purgeDependencyOnElmtId(rmElmtId); 692 this.h3.purgeDependencyOnElmtId(rmElmtId); 693 this.i3.purgeDependencyOnElmtId(rmElmtId); 694 this.j3.purgeDependencyOnElmtId(rmElmtId); 695 this.l3.purgeDependencyOnElmtId(rmElmtId); 696 this.m3.purgeDependencyOnElmtId(rmElmtId); 697 this.n3.purgeDependencyOnElmtId(rmElmtId); 698 this.q3.purgeDependencyOnElmtId(rmElmtId); 699 this.r3.purgeDependencyOnElmtId(rmElmtId); 700 this.s3.purgeDependencyOnElmtId(rmElmtId); 701 this.t3.purgeDependencyOnElmtId(rmElmtId); 702 this.u3.purgeDependencyOnElmtId(rmElmtId); 703 this.v3.purgeDependencyOnElmtId(rmElmtId); 704 this.w3.purgeDependencyOnElmtId(rmElmtId); 705 this.x3.purgeDependencyOnElmtId(rmElmtId); 706 this.y3.purgeDependencyOnElmtId(rmElmtId); 707 this.z3.purgeDependencyOnElmtId(rmElmtId); 708 this.a4.purgeDependencyOnElmtId(rmElmtId); 709 this.b4.purgeDependencyOnElmtId(rmElmtId); 710 } 711 aboutToBeDeleted() { 712 this.n2.aboutToBeDeleted(); 713 this.o2.aboutToBeDeleted(); 714 this.q2.aboutToBeDeleted(); 715 this.s2.aboutToBeDeleted(); 716 this.t2.aboutToBeDeleted(); 717 this.u2.aboutToBeDeleted(); 718 this.v2.aboutToBeDeleted(); 719 this.w2.aboutToBeDeleted(); 720 this.z2.aboutToBeDeleted(); 721 this.a3.aboutToBeDeleted(); 722 this.b3.aboutToBeDeleted(); 723 this.c3.aboutToBeDeleted(); 724 this.d3.aboutToBeDeleted(); 725 this.e3.aboutToBeDeleted(); 726 this.f3.aboutToBeDeleted(); 727 this.g3.aboutToBeDeleted(); 728 this.h3.aboutToBeDeleted(); 729 this.i3.aboutToBeDeleted(); 730 this.j3.aboutToBeDeleted(); 731 this.l3.aboutToBeDeleted(); 732 this.m3.aboutToBeDeleted(); 733 this.n3.aboutToBeDeleted(); 734 this.q3.aboutToBeDeleted(); 735 this.r3.aboutToBeDeleted(); 736 this.s3.aboutToBeDeleted(); 737 this.t3.aboutToBeDeleted(); 738 this.u3.aboutToBeDeleted(); 739 this.v3.aboutToBeDeleted(); 740 this.w3.aboutToBeDeleted(); 741 this.x3.aboutToBeDeleted(); 742 this.y3.aboutToBeDeleted(); 743 this.z3.aboutToBeDeleted(); 744 this.a4.aboutToBeDeleted(); 745 this.b4.aboutToBeDeleted(); 746 SubscriberManager.Get().delete(this.id__()); 747 this.aboutToBeDeletedInternal(); 748 } 749 get chipSize() { 750 return this.n2.get(); 751 } 752 set chipSize(newValue) { 753 this.n2.set(newValue); 754 } 755 get allowClose() { 756 return this.o2.get(); 757 } 758 set allowClose(newValue) { 759 this.o2.set(newValue); 760 } 761 get closeOptions() { 762 return this.q2.get(); 763 } 764 set closeOptions(newValue) { 765 this.q2.set(newValue); 766 } 767 get chipDirection() { 768 return this.s2.get(); 769 } 770 set chipDirection(newValue) { 771 this.s2.set(newValue); 772 } 773 get prefixIcon() { 774 return this.t2.get(); 775 } 776 set prefixIcon(newValue) { 777 this.t2.set(newValue); 778 } 779 get prefixSymbol() { 780 return this.u2.get(); 781 } 782 set prefixSymbol(newValue) { 783 this.u2.set(newValue); 784 } 785 get label() { 786 return this.v2.get(); 787 } 788 set label(newValue) { 789 this.v2.set(newValue); 790 } 791 get suffixIcon() { 792 return this.w2.get(); 793 } 794 set suffixIcon(newValue) { 795 this.w2.set(newValue); 796 } 797 get suffixSymbol() { 798 return this.z2.get(); 799 } 800 set suffixSymbol(newValue) { 801 this.z2.set(newValue); 802 } 803 get suffixSymbolOptions() { 804 return this.a3.get(); 805 } 806 set suffixSymbolOptions(newValue) { 807 this.a3.set(newValue); 808 } 809 get chipNodeBackgroundColor() { 810 return this.b3.get(); 811 } 812 set chipNodeBackgroundColor(newValue) { 813 this.b3.set(newValue); 814 } 815 get chipNodeActivatedBackgroundColor() { 816 return this.c3.get(); 817 } 818 set chipNodeActivatedBackgroundColor(newValue) { 819 this.c3.set(newValue); 820 } 821 get chipNodeRadius() { 822 return this.d3.get(); 823 } 824 set chipNodeRadius(newValue) { 825 this.d3.set(newValue); 826 } 827 get chipEnabled() { 828 return this.e3.get(); 829 } 830 set chipEnabled(newValue) { 831 this.e3.set(newValue); 832 } 833 get chipActivated() { 834 return this.f3.get(); 835 } 836 set chipActivated(newValue) { 837 this.f3.set(newValue); 838 } 839 get chipAccessibilitySelectedType() { 840 return this.g3.get(); 841 } 842 set chipAccessibilitySelectedType(newValue) { 843 this.g3.set(newValue); 844 } 845 get chipAccessibilityDescription() { 846 return this.h3.get(); 847 } 848 set chipAccessibilityDescription(newValue) { 849 this.h3.set(newValue); 850 } 851 get chipAccessibilityLevel() { 852 return this.i3.get(); 853 } 854 set chipAccessibilityLevel(newValue) { 855 this.i3.set(newValue); 856 } 857 get isHover() { 858 return this.j3.get(); 859 } 860 set isHover(newValue) { 861 this.j3.set(newValue); 862 } 863 get chipScale() { 864 return this.l3.get(); 865 } 866 set chipScale(newValue) { 867 this.l3.set(newValue); 868 } 869 get chipOpacity() { 870 return this.m3.get(); 871 } 872 set chipOpacity(newValue) { 873 this.m3.set(newValue); 874 } 875 get chipBlendColor() { 876 return this.n3.get(); 877 } 878 set chipBlendColor(newValue) { 879 this.n3.set(newValue); 880 } 881 get deleteChip() { 882 return this.q3.get(); 883 } 884 set deleteChip(newValue) { 885 this.q3.set(newValue); 886 } 887 get chipNodeOnFocus() { 888 return this.r3.get(); 889 } 890 set chipNodeOnFocus(newValue) { 891 this.r3.set(newValue); 892 } 893 get useDefaultSuffixIcon() { 894 return this.s3.get(); 895 } 896 set useDefaultSuffixIcon(newValue) { 897 this.s3.set(newValue); 898 } 899 get suffixIconOnFocus() { 900 return this.t3.get(); 901 } 902 set suffixIconOnFocus(newValue) { 903 this.t3.set(newValue); 904 } 905 get chipBreakPoints() { 906 return this.u3.get(); 907 } 908 set chipBreakPoints(newValue) { 909 this.u3.set(newValue); 910 } 911 get isShowPressedBackGroundColor() { 912 return this.v3.get(); 913 } 914 set isShowPressedBackGroundColor(newValue) { 915 this.v3.set(newValue); 916 } 917 get fontSizeScale() { 918 return this.w3.get(); 919 } 920 set fontSizeScale(newValue) { 921 this.w3.set(newValue); 922 } 923 get fontWeightScale() { 924 return this.x3.get(); 925 } 926 set fontWeightScale(newValue) { 927 this.x3.set(newValue); 928 } 929 get prefixSymbolWidth() { 930 return this.y3.get(); 931 } 932 set prefixSymbolWidth(newValue) { 933 this.y3.set(newValue); 934 } 935 get suffixSymbolWidth() { 936 return this.z3.get(); 937 } 938 set suffixSymbolWidth(newValue) { 939 this.z3.set(newValue); 940 } 941 get allowCloseSymbolWidth() { 942 return this.a4.get(); 943 } 944 set allowCloseSymbolWidth(newValue) { 945 this.a4.set(newValue); 946 } 947 get symbolEffect() { 948 return this.b4.get(); 949 } 950 set symbolEffect(newValue) { 951 this.b4.set(newValue); 952 } 953 isChipSizeEnum() { 954 return typeof this.chipSize === 'string'; 955 } 956 getLabelFontSize() { 957 if ( 958 this.label?.fontSize !== void 0 && 959 this.toVp(this.label.fontSize) >= 0 960 ) { 961 return this.label.fontSize; 962 } else { 963 if (this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL) { 964 try { 965 resourceManager 966 .getSystemResourceManager() 967 .getNumberByName(this.theme.label.f1.params[0].split('.')[2]); 968 return this.theme.label.f1; 969 } catch (error) { 970 return this.theme.label.defaultFontSize; 971 } 972 } else { 973 try { 974 resourceManager 975 .getSystemResourceManager() 976 .getNumberByName(this.theme.label.e1.params[0].split('.')[2]); 977 return this.theme.label.e1; 978 } catch (error) { 979 return this.theme.label.defaultFontSize; 980 } 981 } 982 } 983 } 984 getLabelFontColor() { 985 if (this.getChipActive()) { 986 return ( 987 this.label?.activatedFontColor ?? this.theme.label.activatedFontColor 988 ); 989 } 990 return this.label?.fontColor ?? this.theme.label.fontColor; 991 } 992 getLabelFontFamily() { 993 return this.label?.fontFamily ?? this.theme.label.fontFamily; 994 } 995 getLabelFontWeight() { 996 if (this.getChipActive()) { 997 return FontWeight.Medium; 998 } 999 return FontWeight.Regular; 1000 } 1001 lengthMetricsToVp(s1) { 1002 let defaultValue = 0; 1003 if (s1) { 1004 switch (s1.unit) { 1005 case LengthUnit.PX: 1006 return px2vp(s1.value); 1007 case LengthUnit.VP: 1008 return s1.value; 1009 case LengthUnit.FP: 1010 return px2vp(fp2px(s1.value)); 1011 case LengthUnit.PERCENT: 1012 return Number.NEGATIVE_INFINITY; 1013 case LengthUnit.LPX: 1014 return px2vp(lpx2px(s1.value)); 1015 } 1016 } 1017 return defaultValue; 1018 } 1019 toVp(value) { 1020 if (value === void 0) { 1021 return Number.NEGATIVE_INFINITY; 1022 } 1023 switch (typeof value) { 1024 case 'number': 1025 return value; 1026 case 'object': 1027 try { 1028 let q1 = this.lengthMetricsToVp(LengthMetrics.resource(value)); 1029 if (q1 === 0 && !m(getContext(this), value)) { 1030 return Number.NEGATIVE_INFINITY; 1031 } 1032 return q1; 1033 } catch (error) { 1034 return Number.NEGATIVE_INFINITY; 1035 } 1036 case 'string': 1037 let p1 = new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i'); 1038 let matches = value.match(p1); 1039 if (!matches) { 1040 return Number.NEGATIVE_INFINITY; 1041 } 1042 let length = Number(matches?.[1] ?? 0); 1043 let unit = matches?.[2] ?? 'vp'; 1044 switch (unit.toLowerCase()) { 1045 case 'px': 1046 length = px2vp(length); 1047 break; 1048 case 'fp': 1049 length = px2vp(fp2px(length)); 1050 break; 1051 case 'lpx': 1052 length = px2vp(lpx2px(length)); 1053 break; 1054 case '%': 1055 length = Number.NEGATIVE_INFINITY; 1056 break; 1057 case 'vp': 1058 break; 1059 default: 1060 break; 1061 } 1062 return length; 1063 default: 1064 return Number.NEGATIVE_INFINITY; 1065 } 1066 } 1067 getLabelMargin() { 1068 let labelMargin = { left: 0, right: 0 }; 1069 if ( 1070 this.label?.labelMargin?.left !== void 0 && 1071 this.toVp(this.label.labelMargin.left) >= 0 1072 ) { 1073 labelMargin.left = this.label?.labelMargin?.left; 1074 } else if ( 1075 this.prefixSymbol?.normal || 1076 this.prefixSymbol?.activated || 1077 this.prefixIcon?.src 1078 ) { 1079 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1080 labelMargin.left = this.theme.label.h1.left; 1081 } else { 1082 labelMargin.left = this.theme.label.g1.left; 1083 } 1084 } 1085 if ( 1086 this.label?.labelMargin?.right !== void 0 && 1087 this.toVp(this.label.labelMargin.right) >= 0 1088 ) { 1089 labelMargin.right = this.label?.labelMargin?.right; 1090 } else if ( 1091 this.suffixSymbol?.normal || 1092 this.suffixSymbol?.activated || 1093 this.suffixIcon?.src || 1094 this.useDefaultSuffixIcon 1095 ) { 1096 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1097 labelMargin.right = this.theme.label.h1.right; 1098 } else { 1099 labelMargin.right = this.theme.label.g1.right; 1100 } 1101 } 1102 return labelMargin; 1103 } 1104 getLocalizedLabelMargin() { 1105 let localizedLabelMargin = { 1106 start: LengthMetrics.vp(0), 1107 end: LengthMetrics.vp(0), 1108 }; 1109 if ( 1110 this.label?.localizedLabelMargin?.start?.value !== void 0 && 1111 this.lengthMetricsToVp(this.label.localizedLabelMargin.start) >= 0 1112 ) { 1113 localizedLabelMargin.start = this.label?.localizedLabelMargin?.start; 1114 } else if ( 1115 this.prefixSymbol?.normal || 1116 this.prefixSymbol?.activated || 1117 this.prefixIcon?.src 1118 ) { 1119 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1120 localizedLabelMargin.start = this.theme.label.j1.start; 1121 } else { 1122 localizedLabelMargin.start = this.theme.label.i1.start; 1123 } 1124 } 1125 if ( 1126 this.label?.localizedLabelMargin?.end?.value !== void 0 && 1127 this.lengthMetricsToVp(this.label.localizedLabelMargin.end) >= 0 1128 ) { 1129 localizedLabelMargin.end = this.label?.localizedLabelMargin?.end; 1130 } else if ( 1131 this.suffixSymbol?.normal || 1132 this.suffixSymbol?.activated || 1133 this.suffixIcon?.src || 1134 this.useDefaultSuffixIcon 1135 ) { 1136 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1137 localizedLabelMargin.end = this.theme.label.j1.end; 1138 } else { 1139 localizedLabelMargin.end = this.theme.label.i1.end; 1140 } 1141 } 1142 return localizedLabelMargin; 1143 } 1144 getLabelStartEndVp() { 1145 let labelMargin = this.getLocalizedLabelMargin(); 1146 if ( 1147 this.label && 1148 this.label.labelMargin !== void 0 && 1149 this.label.localizedLabelMargin === void 0 1150 ) { 1151 let margin = this.getLabelMargin(); 1152 return { 1153 start: LengthMetrics.vp(this.toVp(margin.left)), 1154 end: LengthMetrics.vp(this.toVp(margin.right)), 1155 }; 1156 } 1157 return { 1158 start: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.start)), 1159 end: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.end)), 1160 }; 1161 } 1162 getActualLabelMargin() { 1163 let localizedLabelMargin = this.getLocalizedLabelMargin(); 1164 if (this.label && this.label.localizedLabelMargin !== void 0) { 1165 return localizedLabelMargin; 1166 } 1167 if (this.label && this.label.labelMargin !== void 0) { 1168 return this.getLabelMargin(); 1169 } 1170 return localizedLabelMargin; 1171 } 1172 getSuffixIconSize() { 1173 let o1 = { width: 0, height: 0 }; 1174 if ( 1175 this.suffixIcon?.size?.width !== void 0 && 1176 this.toVp(this.suffixIcon?.size?.width) >= 0 1177 ) { 1178 o1.width = this.suffixIcon?.size?.width; 1179 } else { 1180 if (this.getSuffixIconSrc()) { 1181 o1.width = this.theme.suffixIcon.size.width; 1182 } else { 1183 o1.width = 0; 1184 } 1185 } 1186 if ( 1187 this.suffixIcon?.size?.height !== void 0 && 1188 this.toVp(this.suffixIcon?.size?.height) >= 0 1189 ) { 1190 o1.height = this.suffixIcon?.size?.height; 1191 } else { 1192 if (this.getSuffixIconSrc()) { 1193 o1.height = this.theme.suffixIcon.size.height; 1194 } else { 1195 o1.height = 0; 1196 } 1197 } 1198 return o1; 1199 } 1200 getPrefixIconSize() { 1201 let n1 = { width: 0, height: 0 }; 1202 if ( 1203 this.prefixIcon?.size?.width !== void 0 && 1204 this.toVp(this.prefixIcon?.size?.width) >= 0 1205 ) { 1206 n1.width = this.prefixIcon?.size?.width; 1207 } else { 1208 if (this.prefixIcon?.src) { 1209 n1.width = this.theme.prefixIcon.size.width; 1210 } else { 1211 n1.width = 0; 1212 } 1213 } 1214 if ( 1215 this.prefixIcon?.size?.height !== void 0 && 1216 this.toVp(this.prefixIcon?.size?.height) >= 0 1217 ) { 1218 n1.height = this.prefixIcon?.size?.height; 1219 } else { 1220 if (this.prefixIcon?.src) { 1221 n1.height = this.theme.prefixIcon.size.height; 1222 } else { 1223 n1.height = 0; 1224 } 1225 } 1226 return n1; 1227 } 1228 getPrefixIconFilledColor() { 1229 if (this.getChipActive()) { 1230 return ( 1231 this.prefixIcon?.activatedFillColor ?? 1232 this.theme.prefixIcon.activatedFillColor 1233 ); 1234 } 1235 return this.prefixIcon?.fillColor ?? this.theme.prefixIcon.fillColor; 1236 } 1237 getSuffixIconFilledColor() { 1238 if (this.getChipActive()) { 1239 return ( 1240 this.suffixIcon?.activatedFillColor ?? 1241 this.theme.suffixIcon.activatedFillColor 1242 ); 1243 } 1244 return this.suffixIcon?.fillColor ?? this.theme.suffixIcon.fillColor; 1245 } 1246 getDefaultSymbolColor() { 1247 if (this.getChipActive()) { 1248 return this.theme.m1.activatedFontColor; 1249 } 1250 return this.theme.m1.n1; 1251 } 1252 getPrefixSymbolModifier() { 1253 if (this.getChipActive()) { 1254 return this.prefixSymbol?.activated; 1255 } 1256 return this.prefixSymbol?.normal; 1257 } 1258 getSuffixSymbolModifier() { 1259 if (this.getChipActive()) { 1260 return this.suffixSymbol?.activated; 1261 } 1262 return this.suffixSymbol?.normal; 1263 } 1264 getSuffixIconFocusable() { 1265 return ( 1266 (this.useDefaultSuffixIcon && (this.allowClose ?? true)) || 1267 this.suffixIcon?.action !== void 0 1268 ); 1269 } 1270 getChipNodePadding() { 1271 return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 1272 ? this.theme.q1.d2 1273 : this.theme.q1.c2; 1274 } 1275 getChipNodeRadius() { 1276 if (this.chipNodeRadius !== void 0 && this.toVp(this.chipNodeRadius) >= 0) { 1277 return this.chipNodeRadius; 1278 } else { 1279 return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 1280 ? this.theme.q1.b2 1281 : this.theme.q1.a2; 1282 } 1283 } 1284 getChipNodeBackGroundColor() { 1285 let l1; 1286 if (this.getChipActive()) { 1287 l1 = 1288 this.chipNodeActivatedBackgroundColor ?? 1289 this.theme.q1.activatedBackgroundColor; 1290 } else { 1291 l1 = this.chipNodeBackgroundColor ?? this.theme.q1.backgroundColor; 1292 } 1293 let m1; 1294 try { 1295 m1 = ColorMetrics.resourceColor(l1); 1296 } catch (err) { 1297 hilog.error( 1298 0x3900, 1299 'Ace', 1300 `Chip resourceColor, error: ${err.toString()}` 1301 ); 1302 m1 = ColorMetrics.resourceColor(Color.Transparent); 1303 } 1304 if (!this.isShowPressedBackGroundColor) { 1305 return m1.color; 1306 } 1307 return m1.blendColor(ColorMetrics.resourceColor('#19000000')).color; 1308 } 1309 getChipNodeHeight() { 1310 if (this.isChipSizeEnum()) { 1311 return this.chipSize === ChipSize.SMALL 1312 ? this.theme.q1.v1 1313 : this.theme.q1.u1; 1314 } else { 1315 this.chipNodeSize = this.chipSize; 1316 return this.chipNodeSize?.height !== void 0 && 1317 this.toVp(this.chipNodeSize?.height) >= 0 1318 ? this.toVp(this.chipNodeSize?.height) 1319 : this.theme.q1.u1; 1320 } 1321 } 1322 getLabelWidth() { 1323 return px2vp( 1324 measure.measureText({ 1325 textContent: this.label?.text ?? '', 1326 fontSize: this.getLabelFontSize(), 1327 fontFamily: this.label?.fontFamily ?? this.theme.label.fontFamily, 1328 fontWeight: this.getLabelFontWeight(), 1329 maxLines: 1, 1330 overflow: TextOverflow.Ellipsis, 1331 textAlign: TextAlign.Center, 1332 }) 1333 ); 1334 } 1335 getCalculateChipNodeWidth() { 1336 let j1 = 0; 1337 let k1 = this.getLabelStartEndVp(); 1338 j1 += this.getChipNodePadding().start?.value ?? 0; 1339 j1 += this.toVp(this.getPrefixChipWidth()); 1340 j1 += this.toVp(k1.start?.value ?? 0); 1341 j1 += this.getLabelWidth(); 1342 j1 += this.toVp(k1.end?.value ?? 0); 1343 j1 += this.toVp(this.getSuffixChipWidth()); 1344 j1 += this.getChipNodePadding().end?.value ?? 0; 1345 return j1; 1346 } 1347 getPrefixChipWidth() { 1348 if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 1349 return this.prefixSymbolWidth; 1350 } else if (this.prefixIcon?.src) { 1351 return this.getPrefixIconSize().width; 1352 } else { 1353 return 0; 1354 } 1355 } 1356 getSuffixChipWidth() { 1357 if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 1358 return this.suffixSymbolWidth; 1359 } else if (this.suffixIcon?.src) { 1360 return this.getSuffixIconSize().width; 1361 } else if (!this.suffixIcon?.src && (this.allowClose ?? true)) { 1362 return this.allowCloseSymbolWidth; 1363 } else { 1364 return 0; 1365 } 1366 } 1367 getReserveChipNodeWidth() { 1368 return ( 1369 this.getCalculateChipNodeWidth() - this.getLabelWidth() + this.theme.q1.t1 1370 ); 1371 } 1372 getChipEnable() { 1373 return this.chipEnabled || this.chipEnabled === void 0; 1374 } 1375 getChipActive() { 1376 if (typeof this.chipActivated === 'undefined') { 1377 return false; 1378 } 1379 return this.chipActivated; 1380 } 1381 getChipNodeOpacity() { 1382 return this.chipOpacity; 1383 } 1384 handleTouch(event) { 1385 if (!this.getChipEnable()) { 1386 return; 1387 } 1388 if (this.isHover) { 1389 if (event.type === TouchType.Down || event.type === TouchType.Move) { 1390 this.isShowPressedBackGroundColor = true; 1391 } else if (event.type === TouchType.Up) { 1392 this.isShowPressedBackGroundColor = false; 1393 } else { 1394 this.isShowPressedBackGroundColor = false; 1395 } 1396 } else { 1397 if (event.type === TouchType.Down || event.type === TouchType.Move) { 1398 this.isShowPressedBackGroundColor = true; 1399 } else if (event.type === TouchType.Up) { 1400 this.isShowPressedBackGroundColor = false; 1401 } else { 1402 this.isShowPressedBackGroundColor = false; 1403 } 1404 } 1405 } 1406 hoverAnimate(isHover) { 1407 if (!this.getChipEnable()) { 1408 return; 1409 } 1410 this.isHover = isHover; 1411 if (this.isHover) { 1412 this.isShowPressedBackGroundColor = true; 1413 } else { 1414 this.isShowPressedBackGroundColor = false; 1415 } 1416 } 1417 deleteChipNodeAnimate() { 1418 Context.animateTo({ duration: 150, curve: Curve.Sharp }, () => { 1419 this.chipOpacity = 0; 1420 this.chipBlendColor = Color.Transparent; 1421 }); 1422 Context.animateTo( 1423 { 1424 duration: 150, 1425 curve: Curve.FastOutLinearIn, 1426 onFinish: () => { 1427 this.deleteChip = true; 1428 }, 1429 }, 1430 () => { 1431 this.chipScale = { x: 0.85, y: 0.85 }; 1432 } 1433 ); 1434 } 1435 getSuffixIconSrc() { 1436 this.useDefaultSuffixIcon = 1437 !this.suffixIcon?.src && (this.allowClose ?? true); 1438 return this.useDefaultSuffixIcon 1439 ? this.theme.suffixIcon.l1 1440 : this.suffixIcon?.src ?? void 0; 1441 } 1442 getChipNodeWidth() { 1443 if (!this.isChipSizeEnum()) { 1444 this.chipNodeSize = this.chipSize; 1445 if ( 1446 this.chipNodeSize?.width !== void 0 && 1447 this.toVp(this.chipNodeSize.width) >= 0 1448 ) { 1449 return this.toVp(this.chipNodeSize.width); 1450 } 1451 } 1452 let constraintWidth = this.getChipConstraintWidth(); 1453 return Math.min( 1454 Math.max(this.getCalculateChipNodeWidth(), constraintWidth.minWidth), 1455 constraintWidth.maxWidth 1456 ); 1457 } 1458 getFocusOverlaySize() { 1459 return { 1460 width: 1461 Math.max( 1462 this.getChipNodeWidth(), 1463 this.getChipConstraintWidth().minWidth 1464 ) + 8, 1465 height: this.getChipNodeHeight() + 8, 1466 }; 1467 } 1468 getChipConstraintWidth() { 1469 let i1 = this.getReserveChipNodeWidth(); 1470 let constraintWidth = this.getCalculateChipNodeWidth(); 1471 let constraintSize; 1472 switch (this.chipBreakPoints) { 1473 case a1.SM: 1474 constraintSize = { 1475 minWidth: i1, 1476 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.i2), 1477 }; 1478 break; 1479 case a1.MD: 1480 constraintSize = { 1481 minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 1482 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.j2), 1483 }; 1484 break; 1485 case a1.LG: 1486 constraintSize = { 1487 minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 1488 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.l2), 1489 }; 1490 break; 1491 default: 1492 constraintSize = { minWidth: i1, maxWidth: constraintWidth }; 1493 break; 1494 } 1495 constraintSize.minWidth = Math.min( 1496 Math.max(this.getCalculateChipNodeWidth(), constraintSize.minWidth), 1497 constraintSize.maxWidth 1498 ); 1499 constraintSize.minHeight = this.getChipNodeHeight(); 1500 if ( 1501 !this.isChipSizeEnum() && 1502 this.chipNodeSize?.height !== void 0 && 1503 this.toVp(this.chipNodeSize?.height) >= 0 1504 ) { 1505 constraintSize.maxHeight = this.toVp(this.chipNodeSize.height); 1506 constraintSize.minHeight = this.toVp(this.chipNodeSize.height); 1507 } 1508 if ( 1509 !this.isChipSizeEnum() && 1510 this.chipNodeSize?.width !== void 0 && 1511 this.toVp(this.chipNodeSize?.width) >= 0 1512 ) { 1513 constraintSize.minWidth = this.toVp(this.chipNodeSize.width); 1514 constraintSize.maxWidth = this.toVp(this.chipNodeSize.width); 1515 } else if (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) { 1516 constraintSize.minWidth = void 0; 1517 constraintSize.maxWidth = void 0; 1518 } 1519 return constraintSize; 1520 } 1521 focusOverlay(parent = null) { 1522 this.observeComponentCreation2((elmtId, isInitialRender) => { 1523 Stack.create(); 1524 Stack.direction(this.chipDirection); 1525 Stack.size({ width: 1, height: 1 }); 1526 Stack.align(Alignment.Center); 1527 }, Stack); 1528 this.observeComponentCreation2((elmtId, isInitialRender) => { 1529 If.create(); 1530 if (this.chipNodeOnFocus && !this.suffixIconOnFocus) { 1531 this.ifElseBranchUpdateFunction(0, () => { 1532 this.observeComponentCreation2((elmtId, isInitialRender) => { 1533 Stack.create(); 1534 Stack.direction(this.chipDirection); 1535 Stack.borderRadius(this.toVp(this.getChipNodeRadius()) + 4); 1536 Stack.size(this.getFocusOverlaySize()); 1537 Stack.borderColor(this.theme.q1.w1); 1538 Stack.borderWidth(this.theme.q1.borderWidth); 1539 }, Stack); 1540 Stack.pop(); 1541 }); 1542 } else { 1543 this.ifElseBranchUpdateFunction(1, () => {}); 1544 } 1545 }, If); 1546 If.pop(); 1547 Stack.pop(); 1548 } 1549 aboutToAppear() { 1550 let e1 = this.getUIContext(); 1551 this.fontSizeScale = e1.getHostContext()?.config?.fontSizeScale ?? 1; 1552 this.smListener.on('change', (h1) => { 1553 if (h1.matches) { 1554 this.chipBreakPoints = a1.SM; 1555 } 1556 }); 1557 this.mdListener.on('change', (g1) => { 1558 if (g1.matches) { 1559 this.chipBreakPoints = a1.MD; 1560 } 1561 }); 1562 this.lgListener.on('change', (f1) => { 1563 if (f1.matches) { 1564 this.chipBreakPoints = a1.LG; 1565 } 1566 }); 1567 this.callbackId = this.getUIContext() 1568 .getHostContext() 1569 ?.getApplicationContext() 1570 ?.on('environment', this.callbacks); 1571 } 1572 getVisibility() { 1573 if (this.toVp(this.getChipNodeHeight()) > 0) { 1574 return Visibility.Visible; 1575 } else { 1576 return Visibility.None; 1577 } 1578 } 1579 aboutToDisappear() { 1580 this.smListener.off('change'); 1581 this.mdListener.off('change'); 1582 this.lgListener.off('change'); 1583 if (this.callbackId) { 1584 this.getUIContext() 1585 .getHostContext() 1586 ?.getApplicationContext() 1587 ?.off('environment', this.callbackId); 1588 this.callbackId = void 0; 1589 } 1590 } 1591 chipBuilder(parent = null) { 1592 this.observeComponentCreation2((elmtId, isInitialRender) => { 1593 Button.createWithChild(); 1594 Button.constraintSize(this.getChipConstraintWidth()); 1595 Button.direction(this.chipDirection); 1596 Button.type(ButtonType.Normal); 1597 Button.clip(false); 1598 Button.backgroundColor(this.getChipNodeBackGroundColor()); 1599 Button.borderRadius(this.getChipNodeRadius()); 1600 Button.enabled(this.getChipEnable()); 1601 Button.scale(ObservedObject.GetRawObject(this.chipScale)); 1602 Button.focusable(true); 1603 Button.opacity(this.getChipNodeOpacity()); 1604 Button.padding(0); 1605 Button.accessibilityGroup(true); 1606 Button.accessibilityDescription(this.getAccessibilityDescription()); 1607 Button.accessibilityLevel(this.getAccessibilityLevel()); 1608 Button.accessibilityChecked(this.getAccessibilityChecked()); 1609 Button.accessibilitySelected(this.getAccessibilitySelected()); 1610 Button.onFocus(() => { 1611 this.chipNodeOnFocus = true; 1612 }); 1613 Button.onBlur(() => { 1614 this.chipNodeOnFocus = false; 1615 }); 1616 Button.onTouch((event) => { 1617 this.handleTouch(event); 1618 }); 1619 Button.onHover((isHover) => { 1620 if (isHover) { 1621 this.isShowPressedBackGroundColor = true; 1622 } else { 1623 if (!this.isShowPressedBackGroundColor && isHover) { 1624 this.isShowPressedBackGroundColor = true; 1625 } else { 1626 this.isShowPressedBackGroundColor = false; 1627 } 1628 } 1629 }); 1630 Button.onKeyEvent((event) => { 1631 if ( 1632 event.type === KeyType.Down && 1633 event.keyCode === KeyCode.KEYCODE_FORWARD_DEL && 1634 !this.suffixIconOnFocus 1635 ) { 1636 this.deleteChipNodeAnimate(); 1637 } 1638 }); 1639 Button.onClick( 1640 this.onClicked === c1 ? undefined : this.onClicked.bind(this) 1641 ); 1642 }, Button); 1643 this.observeComponentCreation2((elmtId, isInitialRender) => { 1644 Row.create(); 1645 Row.direction(this.chipDirection); 1646 Row.alignItems(VerticalAlign.Center); 1647 Row.justifyContent(FlexAlign.Center); 1648 Row.padding(this.getChipNodePadding()); 1649 Row.constraintSize(this.getChipConstraintWidth()); 1650 }, Row); 1651 this.observeComponentCreation2((elmtId, isInitialRender) => { 1652 If.create(); 1653 if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 1654 this.ifElseBranchUpdateFunction(0, () => { 1655 this.observeComponentCreation2((elmtId, isInitialRender) => { 1656 SymbolGlyph.create(); 1657 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1658 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1659 SymbolGlyph.attributeModifier.bind(this)( 1660 this.getPrefixSymbolModifier() 1661 ); 1662 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1663 SymbolGlyph.symbolEffect( 1664 ObservedObject.GetRawObject(this.symbolEffect), 1665 false 1666 ); 1667 SymbolGlyph.symbolEffect( 1668 ObservedObject.GetRawObject(this.symbolEffect), 1669 this.theme.m1.o1 1670 ); 1671 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1672 this.prefixSymbolWidth = newValue?.width; 1673 }); 1674 SymbolGlyph.key('PrefixSymbolGlyph'); 1675 }, SymbolGlyph); 1676 }); 1677 } else if (this.prefixIcon?.src !== '') { 1678 this.ifElseBranchUpdateFunction(1, () => { 1679 this.observeComponentCreation2((elmtId, isInitialRender) => { 1680 Image.create(this.prefixIcon?.src); 1681 Image.direction(this.chipDirection); 1682 Image.opacity(this.getChipNodeOpacity()); 1683 Image.size(this.getPrefixIconSize()); 1684 Image.fillColor(this.getPrefixIconFilledColor()); 1685 Image.enabled(this.getChipEnable()); 1686 Image.objectFit(ImageFit.Cover); 1687 Image.focusable(false); 1688 Image.flexShrink(0); 1689 Image.visibility(this.getVisibility()); 1690 Image.draggable(false); 1691 }, Image); 1692 }); 1693 } else { 1694 this.ifElseBranchUpdateFunction(2, () => {}); 1695 } 1696 }, If); 1697 If.pop(); 1698 this.observeComponentCreation2((elmtId, isInitialRender) => { 1699 Text.create(this.label?.text ?? ''); 1700 Text.direction(this.chipDirection); 1701 Text.opacity(this.getChipNodeOpacity()); 1702 Text.fontSize(this.getLabelFontSize()); 1703 Text.fontColor(this.getLabelFontColor()); 1704 Text.fontFamily(this.getLabelFontFamily()); 1705 Text.fontWeight(this.getLabelFontWeight()); 1706 Text.margin(this.getActualLabelMargin()); 1707 Text.enabled(this.getChipEnable()); 1708 Text.maxLines(1); 1709 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1710 Text.flexShrink(1); 1711 Text.focusable(true); 1712 Text.textAlign(TextAlign.Center); 1713 Text.visibility(this.getVisibility()); 1714 Text.draggable(false); 1715 }, Text); 1716 Text.pop(); 1717 this.observeComponentCreation2((elmtId, isInitialRender) => { 1718 If.create(); 1719 if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 1720 this.ifElseBranchUpdateFunction(0, () => { 1721 this.observeComponentCreation2((elmtId, isInitialRender) => { 1722 Button.createWithChild({ type: ButtonType.Normal }); 1723 Button.onClick(this.getSuffixSymbolAction()); 1724 Button.accessibilityText(this.getSuffixSymbolAccessibilityText()); 1725 Button.accessibilityDescription( 1726 this.getSuffixSymbolAccessibilityDescription() 1727 ); 1728 Button.accessibilityLevel(this.getSuffixSymbolAccessibilityLevel()); 1729 Button.backgroundColor(Color.Transparent); 1730 Button.borderRadius(0); 1731 Button.padding(0); 1732 Button.stateEffect(false); 1733 }, Button); 1734 this.observeComponentCreation2((elmtId, isInitialRender) => { 1735 SymbolGlyph.create(); 1736 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1737 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1738 SymbolGlyph.attributeModifier.bind(this)( 1739 this.getSuffixSymbolModifier() 1740 ); 1741 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1742 SymbolGlyph.symbolEffect( 1743 ObservedObject.GetRawObject(this.symbolEffect), 1744 false 1745 ); 1746 SymbolGlyph.symbolEffect( 1747 ObservedObject.GetRawObject(this.symbolEffect), 1748 this.theme.m1.o1 1749 ); 1750 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1751 this.suffixSymbolWidth = newValue?.width; 1752 }); 1753 SymbolGlyph.key('SuffixSymbolGlyph'); 1754 }, SymbolGlyph); 1755 Button.pop(); 1756 }); 1757 } else if (this.suffixIcon?.src !== '') { 1758 this.ifElseBranchUpdateFunction(1, () => { 1759 this.observeComponentCreation2((elmtId, isInitialRender) => { 1760 Button.createWithChild({ type: ButtonType.Normal }); 1761 Button.backgroundColor(Color.Transparent); 1762 Button.borderRadius(0); 1763 Button.padding(0); 1764 Button.size(this.getSuffixIconSize()); 1765 Button.accessibilityText(this.getSuffixIconAccessibilityText()); 1766 Button.accessibilityDescription( 1767 this.getSuffixIconAccessibilityDescription() 1768 ); 1769 Button.accessibilityLevel(this.getSuffixIconAccessibilityLevel()); 1770 Button.onClick(() => { 1771 if (!this.getChipEnable()) { 1772 return; 1773 } 1774 if (this.suffixIcon?.action) { 1775 this.suffixIcon.action(); 1776 return; 1777 } 1778 if ((this.allowClose ?? true) && this.useDefaultSuffixIcon) { 1779 this.onClose(); 1780 this.deleteChipNodeAnimate(); 1781 return; 1782 } 1783 this.onClicked(); 1784 }); 1785 Button.focusable(this.getSuffixIconFocusable()); 1786 }, Button); 1787 this.observeComponentCreation2((elmtId, isInitialRender) => { 1788 Image.create(this.getSuffixIconSrc()); 1789 Image.direction(this.chipDirection); 1790 Image.opacity(this.getChipNodeOpacity()); 1791 Image.size(this.getSuffixIconSize()); 1792 Image.fillColor(this.getSuffixIconFilledColor()); 1793 Image.enabled(this.getChipEnable()); 1794 Image.objectFit(ImageFit.Cover); 1795 Image.flexShrink(0); 1796 Image.visibility(this.getVisibility()); 1797 Image.draggable(false); 1798 Image.onFocus(() => { 1799 this.suffixIconOnFocus = true; 1800 }); 1801 Image.onBlur(() => { 1802 this.suffixIconOnFocus = false; 1803 }); 1804 }, Image); 1805 Button.pop(); 1806 }); 1807 } else if (this.allowClose ?? true) { 1808 this.ifElseBranchUpdateFunction(2, () => { 1809 this.observeComponentCreation2((elmtId, isInitialRender) => { 1810 Button.createWithChild({ type: ButtonType.Normal }); 1811 Button.backgroundColor(Color.Transparent); 1812 Button.borderRadius(0); 1813 Button.padding(0); 1814 Button.accessibilityText(this.getCloseIconAccessibilityText()); 1815 Button.accessibilityDescription( 1816 this.getCloseIconAccessibilityDescription() 1817 ); 1818 Button.accessibilityLevel(this.getCloseIconAccessibilityLevel()); 1819 Button.onClick(() => { 1820 if (!this.getChipEnable()) { 1821 return; 1822 } 1823 this.onClose(); 1824 this.deleteChipNodeAnimate(); 1825 }); 1826 }, Button); 1827 this.observeComponentCreation2((elmtId, isInitialRender) => { 1828 SymbolGlyph.create({ 1829 id: -1, 1830 type: 40000, 1831 params: ['sys.symbol.xmark'], 1832 bundleName: '__harDefaultBundleName__', 1833 moduleName: '__harDefaultModuleName__', 1834 }); 1835 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1836 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1837 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1838 this.allowCloseSymbolWidth = newValue?.width; 1839 }); 1840 SymbolGlyph.key('AllowCloseSymbolGlyph'); 1841 }, SymbolGlyph); 1842 Button.pop(); 1843 }); 1844 } else { 1845 this.ifElseBranchUpdateFunction(3, () => {}); 1846 } 1847 }, If); 1848 If.pop(); 1849 Row.pop(); 1850 Button.pop(); 1851 } 1852 getSuffixSymbolAccessibilityLevel() { 1853 if (this.getChipActive()) { 1854 if ( 1855 this.suffixSymbolOptions?.activatedAccessibility?.accessibilityLevel === 1856 'no' || 1857 this.suffixSymbolOptions?.activatedAccessibility?.accessibilityLevel === 1858 'no-hide-descendants' 1859 ) { 1860 return this.suffixSymbolOptions.activatedAccessibility 1861 .accessibilityLevel; 1862 } 1863 return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 1864 } 1865 if ( 1866 this.suffixSymbolOptions?.normalAccessibility?.accessibilityLevel === 1867 'no' || 1868 this.suffixSymbolOptions?.normalAccessibility?.accessibilityLevel === 1869 'no-hide-descendants' 1870 ) { 1871 return this.suffixSymbolOptions.normalAccessibility.accessibilityLevel; 1872 } 1873 return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 1874 } 1875 getSuffixSymbolAccessibilityDescription() { 1876 if (this.getChipActive()) { 1877 if ( 1878 typeof this.suffixSymbolOptions?.activatedAccessibility 1879 ?.accessibilityDescription !== 'undefined' 1880 ) { 1881 return this.suffixSymbolOptions.activatedAccessibility 1882 .accessibilityDescription; 1883 } 1884 return undefined; 1885 } 1886 if ( 1887 typeof this.suffixSymbolOptions?.normalAccessibility 1888 ?.accessibilityDescription !== 'undefined' 1889 ) { 1890 return this.suffixSymbolOptions.normalAccessibility 1891 .accessibilityDescription; 1892 } 1893 return undefined; 1894 } 1895 getSuffixSymbolAccessibilityText() { 1896 if (this.getChipActive()) { 1897 if ( 1898 typeof this.suffixSymbolOptions?.activatedAccessibility 1899 ?.accessibilityText !== 'undefined' 1900 ) { 1901 return this.suffixSymbolOptions.activatedAccessibility 1902 .accessibilityText; 1903 } 1904 return undefined; 1905 } 1906 if ( 1907 typeof this.suffixSymbolOptions?.normalAccessibility 1908 ?.accessibilityText !== 'undefined' 1909 ) { 1910 return this.suffixSymbolOptions.normalAccessibility.accessibilityText; 1911 } 1912 return undefined; 1913 } 1914 getSuffixSymbolAction() { 1915 if (typeof this.suffixSymbolOptions?.action === 'undefined') { 1916 return undefined; 1917 } 1918 return () => { 1919 if (!this.getChipEnable()) { 1920 return; 1921 } 1922 this.suffixSymbolOptions?.action?.(); 1923 }; 1924 } 1925 getAccessibilitySelected() { 1926 if ( 1927 this.getChipAccessibilitySelectedType() === 1928 AccessibilitySelectedType.SELECTED 1929 ) { 1930 return this.getChipActive(); 1931 } 1932 return undefined; 1933 } 1934 getAccessibilityChecked() { 1935 if ( 1936 this.getChipAccessibilitySelectedType() === 1937 AccessibilitySelectedType.CHECKED 1938 ) { 1939 return this.getChipActive(); 1940 } 1941 return undefined; 1942 } 1943 getChipAccessibilitySelectedType() { 1944 if (typeof this.chipActivated === 'undefined') { 1945 return AccessibilitySelectedType.CLICKED; 1946 } 1947 return ( 1948 this.chipAccessibilitySelectedType ?? AccessibilitySelectedType.CHECKED 1949 ); 1950 } 1951 getCloseIconAccessibilityLevel() { 1952 if ( 1953 this.closeOptions?.accessibilityLevel === 'no' || 1954 this.closeOptions?.accessibilityLevel === 'no-hide-descendants' 1955 ) { 1956 return this.closeOptions.accessibilityLevel; 1957 } 1958 return 'yes'; 1959 } 1960 getCloseIconAccessibilityDescription() { 1961 if (typeof this.closeOptions?.accessibilityDescription === 'undefined') { 1962 return undefined; 1963 } 1964 return this.closeOptions.accessibilityDescription; 1965 } 1966 getCloseIconAccessibilityText() { 1967 if (typeof this.closeOptions?.accessibilityText === 'undefined') { 1968 return { 1969 id: -1, 1970 type: 10003, 1971 params: ['sys.string.delete_used_for_accessibility_text'], 1972 bundleName: '__harDefaultBundleName__', 1973 moduleName: '__harDefaultModuleName__', 1974 }; 1975 } 1976 return this.closeOptions.accessibilityText; 1977 } 1978 getSuffixIconAccessibilityLevel() { 1979 if ( 1980 this.suffixIcon?.accessibilityLevel === 'no' || 1981 this.suffixIcon?.accessibilityLevel === 'no-hide-descendants' 1982 ) { 1983 return this.suffixIcon.accessibilityLevel; 1984 } 1985 return this.suffixIcon?.action ? 'yes' : 'no'; 1986 } 1987 getSuffixIconAccessibilityDescription() { 1988 if (typeof this.suffixIcon?.accessibilityDescription === 'undefined') { 1989 return undefined; 1990 } 1991 return this.suffixIcon.accessibilityDescription; 1992 } 1993 getSuffixIconAccessibilityText() { 1994 if (typeof this.suffixIcon?.accessibilityText === 'undefined') { 1995 return undefined; 1996 } 1997 return this.suffixIcon.accessibilityText; 1998 } 1999 getAccessibilityLevel() { 2000 return this.chipAccessibilityLevel; 2001 } 2002 getAccessibilityDescription() { 2003 if (typeof this.chipAccessibilityDescription === 'undefined') { 2004 return undefined; 2005 } 2006 return this.chipAccessibilityDescription; 2007 } 2008 initialRender() { 2009 this.observeComponentCreation2((elmtId, isInitialRender) => { 2010 If.create(); 2011 if (!this.deleteChip) { 2012 this.ifElseBranchUpdateFunction(0, () => { 2013 this.chipBuilder.bind(this)(); 2014 }); 2015 } else { 2016 this.ifElseBranchUpdateFunction(1, () => {}); 2017 } 2018 }, If); 2019 If.pop(); 2020 } 2021 rerender() { 2022 this.updateDirtyElements(); 2023 } 2024 } 2025 2026 export default { 2027 Chip, 2028 ChipSize, 2029 AccessibilitySelectedType, 2030 }; 2031