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} 19const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 20const measure = requireNapi('measure'); 21const mediaquery = requireNapi('mediaquery'); 22const resourceManager = requireNapi('resourceManager'); 23const componentUtils = requireNapi('arkui.componentUtils'); 24const hilog = requireNapi('hilog'); 25const ColorMetrics = requireNapi('arkui.node').ColorMetrics; 26const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 27const LengthUnit = requireNapi('arkui.node').LengthUnit; 28const o = 10003; 29const t = 10002; 30const u = 10007; 31export var ChipSize; 32(function (ChipSize) { 33 ChipSize['NORMAL'] = 'NORMAL'; 34 ChipSize['SMALL'] = 'SMALL'; 35})(ChipSize || (ChipSize = {})); 36var a1; 37(function (v1) { 38 v1['SM'] = 'SM'; 39 v1['MD'] = 'MD'; 40 v1['LG'] = 'LG'; 41})(a1 || (a1 = {})); 42export 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 = {})); 51export 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.chip_border_radius_normal'], 205 bundleName: '__harDefaultBundleName__', 206 moduleName: '__harDefaultModuleName__', 207 }, 208 b2: { 209 id: -1, 210 type: 10002, 211 params: ['sys.float.chip_border_radius_small'], 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}; 251const c1 = () => {}; 252export 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} 346function 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} 354function j(dimension) { 355 return i( 356 dimension, 357 new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i') 358 ); 359} 360function 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} 381export 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 this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false; 516 }, 517 onMemoryLevel() {}, 518 }; 519 this.callbackId = undefined; 520 this.y3 = new ObservedPropertyObjectPU( 521 this.toVp( 522 componentUtils.getRectangleById('PrefixSymbolGlyph')?.size?.width 523 ), 524 this, 525 'prefixSymbolWidth' 526 ); 527 this.z3 = new ObservedPropertyObjectPU( 528 this.toVp( 529 componentUtils.getRectangleById('SuffixSymbolGlyph')?.size?.width 530 ), 531 this, 532 'suffixSymbolWidth' 533 ); 534 this.a4 = new ObservedPropertyObjectPU( 535 this.toVp( 536 componentUtils.getRectangleById('AllowCloseSymbolGlyph')?.size?.width 537 ), 538 this, 539 'allowCloseSymbolWidth' 540 ); 541 this.b4 = new ObservedPropertyObjectPU( 542 new SymbolEffect(), 543 this, 544 'symbolEffect' 545 ); 546 this.setInitiallyProvidedValue(params); 547 this.finalizeConstruction(); 548 this.c4 = new ObservedPropertySimplePU(false, this, "isClipable"); 549 } 550 setInitiallyProvidedValue(params) { 551 if (params.theme !== undefined) { 552 this.theme = params.theme; 553 } 554 if (params.chipSize === undefined) { 555 this.n2.set(ChipSize.NORMAL); 556 } 557 if (params.allowClose === undefined) { 558 this.o2.set(true); 559 } 560 if (params.chipDirection === undefined) { 561 this.s2.set(Direction.Auto); 562 } 563 if (params.prefixIcon === undefined) { 564 this.t2.set({ src: '' }); 565 } 566 if (params.label === undefined) { 567 this.v2.set({ text: '' }); 568 } 569 if (params.suffixIcon === undefined) { 570 this.w2.set({ src: '' }); 571 } 572 if (params.chipNodeBackgroundColor === undefined) { 573 this.b3.set(this.theme.q1.backgroundColor); 574 } 575 if (params.chipNodeActivatedBackgroundColor === undefined) { 576 this.c3.set(this.theme.q1.activatedBackgroundColor); 577 } 578 if (params.chipNodeRadius === undefined) { 579 this.d3.set(void 0); 580 } 581 if (params.chipEnabled === undefined) { 582 this.e3.set(true); 583 } 584 if (params.isHover !== undefined) { 585 this.isHover = params.isHover; 586 } 587 if (params.chipScale !== undefined) { 588 this.chipScale = params.chipScale; 589 } 590 if (params.chipOpacity !== undefined) { 591 this.chipOpacity = params.chipOpacity; 592 } 593 if (params.chipBlendColor !== undefined) { 594 this.chipBlendColor = params.chipBlendColor; 595 } 596 if (params.deleteChip !== undefined) { 597 this.deleteChip = params.deleteChip; 598 } 599 if (params.chipNodeOnFocus !== undefined) { 600 this.chipNodeOnFocus = params.chipNodeOnFocus; 601 } 602 if (params.useDefaultSuffixIcon !== undefined) { 603 this.useDefaultSuffixIcon = params.useDefaultSuffixIcon; 604 } 605 if (params.chipNodeSize !== undefined) { 606 this.chipNodeSize = params.chipNodeSize; 607 } 608 if (params.onClose !== undefined) { 609 this.onClose = params.onClose; 610 } 611 if (params.onClicked !== undefined) { 612 this.onClicked = params.onClicked; 613 } 614 if (params.suffixIconOnFocus !== undefined) { 615 this.suffixIconOnFocus = params.suffixIconOnFocus; 616 } 617 if (params.chipBreakPoints !== undefined) { 618 this.chipBreakPoints = params.chipBreakPoints; 619 } 620 if (params.smListener !== undefined) { 621 this.smListener = params.smListener; 622 } 623 if (params.mdListener !== undefined) { 624 this.mdListener = params.mdListener; 625 } 626 if (params.lgListener !== undefined) { 627 this.lgListener = params.lgListener; 628 } 629 if (params.isShowPressedBackGroundColor !== undefined) { 630 this.isShowPressedBackGroundColor = params.isShowPressedBackGroundColor; 631 } 632 if (params.fontSizeScale !== undefined) { 633 this.fontSizeScale = params.fontSizeScale; 634 } 635 if (params.fontWeightScale !== undefined) { 636 this.fontWeightScale = params.fontWeightScale; 637 } 638 if (params.callbacks !== undefined) { 639 this.callbacks = params.callbacks; 640 } 641 if (params.callbackId !== undefined) { 642 this.callbackId = params.callbackId; 643 } 644 if (params.prefixSymbolWidth !== undefined) { 645 this.prefixSymbolWidth = params.prefixSymbolWidth; 646 } 647 if (params.suffixSymbolWidth !== undefined) { 648 this.suffixSymbolWidth = params.suffixSymbolWidth; 649 } 650 if (params.allowCloseSymbolWidth !== undefined) { 651 this.allowCloseSymbolWidth = params.allowCloseSymbolWidth; 652 } 653 if (params.symbolEffect !== undefined) { 654 this.symbolEffect = params.symbolEffect; 655 } 656 if (params.isClipable !== undefined) { 657 this.isClipable = params.isClipable; 658 } 659 } 660 updateStateVars(params) { 661 this.n2.reset(params.chipSize); 662 this.o2.reset(params.allowClose); 663 this.q2.reset(params.closeOptions); 664 this.s2.reset(params.chipDirection); 665 this.t2.reset(params.prefixIcon); 666 this.u2.reset(params.prefixSymbol); 667 this.v2.reset(params.label); 668 this.w2.reset(params.suffixIcon); 669 this.z2.reset(params.suffixSymbol); 670 this.a3.reset(params.suffixSymbolOptions); 671 this.b3.reset(params.chipNodeBackgroundColor); 672 this.c3.reset(params.chipNodeActivatedBackgroundColor); 673 this.d3.reset(params.chipNodeRadius); 674 this.e3.reset(params.chipEnabled); 675 this.f3.reset(params.chipActivated); 676 this.g3.reset(params.chipAccessibilitySelectedType); 677 this.h3.reset(params.chipAccessibilityDescription); 678 this.i3.reset(params.chipAccessibilityLevel); 679 } 680 purgeVariableDependenciesOnElmtId(rmElmtId) { 681 this.n2.purgeDependencyOnElmtId(rmElmtId); 682 this.o2.purgeDependencyOnElmtId(rmElmtId); 683 this.q2.purgeDependencyOnElmtId(rmElmtId); 684 this.s2.purgeDependencyOnElmtId(rmElmtId); 685 this.t2.purgeDependencyOnElmtId(rmElmtId); 686 this.u2.purgeDependencyOnElmtId(rmElmtId); 687 this.v2.purgeDependencyOnElmtId(rmElmtId); 688 this.w2.purgeDependencyOnElmtId(rmElmtId); 689 this.z2.purgeDependencyOnElmtId(rmElmtId); 690 this.a3.purgeDependencyOnElmtId(rmElmtId); 691 this.b3.purgeDependencyOnElmtId(rmElmtId); 692 this.c3.purgeDependencyOnElmtId(rmElmtId); 693 this.d3.purgeDependencyOnElmtId(rmElmtId); 694 this.e3.purgeDependencyOnElmtId(rmElmtId); 695 this.f3.purgeDependencyOnElmtId(rmElmtId); 696 this.g3.purgeDependencyOnElmtId(rmElmtId); 697 this.h3.purgeDependencyOnElmtId(rmElmtId); 698 this.i3.purgeDependencyOnElmtId(rmElmtId); 699 this.j3.purgeDependencyOnElmtId(rmElmtId); 700 this.l3.purgeDependencyOnElmtId(rmElmtId); 701 this.m3.purgeDependencyOnElmtId(rmElmtId); 702 this.n3.purgeDependencyOnElmtId(rmElmtId); 703 this.q3.purgeDependencyOnElmtId(rmElmtId); 704 this.r3.purgeDependencyOnElmtId(rmElmtId); 705 this.s3.purgeDependencyOnElmtId(rmElmtId); 706 this.t3.purgeDependencyOnElmtId(rmElmtId); 707 this.u3.purgeDependencyOnElmtId(rmElmtId); 708 this.v3.purgeDependencyOnElmtId(rmElmtId); 709 this.w3.purgeDependencyOnElmtId(rmElmtId); 710 this.x3.purgeDependencyOnElmtId(rmElmtId); 711 this.y3.purgeDependencyOnElmtId(rmElmtId); 712 this.z3.purgeDependencyOnElmtId(rmElmtId); 713 this.a4.purgeDependencyOnElmtId(rmElmtId); 714 this.b4.purgeDependencyOnElmtId(rmElmtId); 715 this.c4.purgeDependencyOnElmtId(rmElmtId); 716 } 717 aboutToBeDeleted() { 718 this.n2.aboutToBeDeleted(); 719 this.o2.aboutToBeDeleted(); 720 this.q2.aboutToBeDeleted(); 721 this.s2.aboutToBeDeleted(); 722 this.t2.aboutToBeDeleted(); 723 this.u2.aboutToBeDeleted(); 724 this.v2.aboutToBeDeleted(); 725 this.w2.aboutToBeDeleted(); 726 this.z2.aboutToBeDeleted(); 727 this.a3.aboutToBeDeleted(); 728 this.b3.aboutToBeDeleted(); 729 this.c3.aboutToBeDeleted(); 730 this.d3.aboutToBeDeleted(); 731 this.e3.aboutToBeDeleted(); 732 this.f3.aboutToBeDeleted(); 733 this.g3.aboutToBeDeleted(); 734 this.h3.aboutToBeDeleted(); 735 this.i3.aboutToBeDeleted(); 736 this.j3.aboutToBeDeleted(); 737 this.l3.aboutToBeDeleted(); 738 this.m3.aboutToBeDeleted(); 739 this.n3.aboutToBeDeleted(); 740 this.q3.aboutToBeDeleted(); 741 this.r3.aboutToBeDeleted(); 742 this.s3.aboutToBeDeleted(); 743 this.t3.aboutToBeDeleted(); 744 this.u3.aboutToBeDeleted(); 745 this.v3.aboutToBeDeleted(); 746 this.w3.aboutToBeDeleted(); 747 this.x3.aboutToBeDeleted(); 748 this.y3.aboutToBeDeleted(); 749 this.z3.aboutToBeDeleted(); 750 this.a4.aboutToBeDeleted(); 751 this.b4.aboutToBeDeleted(); 752 this.c4.aboutToBeDeleted(); 753 SubscriberManager.Get().delete(this.id__()); 754 this.aboutToBeDeletedInternal(); 755 } 756 get chipSize() { 757 return this.n2.get(); 758 } 759 set chipSize(newValue) { 760 this.n2.set(newValue); 761 } 762 get allowClose() { 763 return this.o2.get(); 764 } 765 set allowClose(newValue) { 766 this.o2.set(newValue); 767 } 768 get closeOptions() { 769 return this.q2.get(); 770 } 771 set closeOptions(newValue) { 772 this.q2.set(newValue); 773 } 774 get chipDirection() { 775 return this.s2.get(); 776 } 777 set chipDirection(newValue) { 778 this.s2.set(newValue); 779 } 780 get prefixIcon() { 781 return this.t2.get(); 782 } 783 set prefixIcon(newValue) { 784 this.t2.set(newValue); 785 } 786 get prefixSymbol() { 787 return this.u2.get(); 788 } 789 set prefixSymbol(newValue) { 790 this.u2.set(newValue); 791 } 792 get label() { 793 return this.v2.get(); 794 } 795 set label(newValue) { 796 this.v2.set(newValue); 797 } 798 get suffixIcon() { 799 return this.w2.get(); 800 } 801 set suffixIcon(newValue) { 802 this.w2.set(newValue); 803 } 804 get suffixSymbol() { 805 return this.z2.get(); 806 } 807 set suffixSymbol(newValue) { 808 this.z2.set(newValue); 809 } 810 get suffixSymbolOptions() { 811 return this.a3.get(); 812 } 813 set suffixSymbolOptions(newValue) { 814 this.a3.set(newValue); 815 } 816 get chipNodeBackgroundColor() { 817 return this.b3.get(); 818 } 819 set chipNodeBackgroundColor(newValue) { 820 this.b3.set(newValue); 821 } 822 get chipNodeActivatedBackgroundColor() { 823 return this.c3.get(); 824 } 825 set chipNodeActivatedBackgroundColor(newValue) { 826 this.c3.set(newValue); 827 } 828 get chipNodeRadius() { 829 return this.d3.get(); 830 } 831 set chipNodeRadius(newValue) { 832 this.d3.set(newValue); 833 } 834 get chipEnabled() { 835 return this.e3.get(); 836 } 837 set chipEnabled(newValue) { 838 this.e3.set(newValue); 839 } 840 get chipActivated() { 841 return this.f3.get(); 842 } 843 set chipActivated(newValue) { 844 this.f3.set(newValue); 845 } 846 get chipAccessibilitySelectedType() { 847 return this.g3.get(); 848 } 849 set chipAccessibilitySelectedType(newValue) { 850 this.g3.set(newValue); 851 } 852 get chipAccessibilityDescription() { 853 return this.h3.get(); 854 } 855 set chipAccessibilityDescription(newValue) { 856 this.h3.set(newValue); 857 } 858 get chipAccessibilityLevel() { 859 return this.i3.get(); 860 } 861 set chipAccessibilityLevel(newValue) { 862 this.i3.set(newValue); 863 } 864 get isHover() { 865 return this.j3.get(); 866 } 867 set isHover(newValue) { 868 this.j3.set(newValue); 869 } 870 get chipScale() { 871 return this.l3.get(); 872 } 873 set chipScale(newValue) { 874 this.l3.set(newValue); 875 } 876 get chipOpacity() { 877 return this.m3.get(); 878 } 879 set chipOpacity(newValue) { 880 this.m3.set(newValue); 881 } 882 get chipBlendColor() { 883 return this.n3.get(); 884 } 885 set chipBlendColor(newValue) { 886 this.n3.set(newValue); 887 } 888 get deleteChip() { 889 return this.q3.get(); 890 } 891 set deleteChip(newValue) { 892 this.q3.set(newValue); 893 } 894 get chipNodeOnFocus() { 895 return this.r3.get(); 896 } 897 set chipNodeOnFocus(newValue) { 898 this.r3.set(newValue); 899 } 900 get useDefaultSuffixIcon() { 901 return this.s3.get(); 902 } 903 set useDefaultSuffixIcon(newValue) { 904 this.s3.set(newValue); 905 } 906 get suffixIconOnFocus() { 907 return this.t3.get(); 908 } 909 set suffixIconOnFocus(newValue) { 910 this.t3.set(newValue); 911 } 912 get chipBreakPoints() { 913 return this.u3.get(); 914 } 915 set chipBreakPoints(newValue) { 916 this.u3.set(newValue); 917 } 918 get isShowPressedBackGroundColor() { 919 return this.v3.get(); 920 } 921 set isShowPressedBackGroundColor(newValue) { 922 this.v3.set(newValue); 923 } 924 get fontSizeScale() { 925 return this.w3.get(); 926 } 927 set fontSizeScale(newValue) { 928 this.w3.set(newValue); 929 } 930 get fontWeightScale() { 931 return this.x3.get(); 932 } 933 set fontWeightScale(newValue) { 934 this.x3.set(newValue); 935 } 936 get prefixSymbolWidth() { 937 return this.y3.get(); 938 } 939 set prefixSymbolWidth(newValue) { 940 this.y3.set(newValue); 941 } 942 get suffixSymbolWidth() { 943 return this.z3.get(); 944 } 945 set suffixSymbolWidth(newValue) { 946 this.z3.set(newValue); 947 } 948 get allowCloseSymbolWidth() { 949 return this.a4.get(); 950 } 951 set allowCloseSymbolWidth(newValue) { 952 this.a4.set(newValue); 953 } 954 get symbolEffect() { 955 return this.b4.get(); 956 } 957 set symbolEffect(newValue) { 958 this.b4.set(newValue); 959 } 960 get isClipable() { 961 return this.c4.get(); 962 } 963 set isClipable(newValue) { 964 this.c4.set(newValue); 965 } 966 isChipSizeEnum() { 967 return typeof this.chipSize === 'string'; 968 } 969 getLabelFontSize() { 970 if ( 971 this.label?.fontSize !== void 0 && 972 this.toVp(this.label.fontSize) >= 0 973 ) { 974 return this.label.fontSize; 975 } else { 976 if (this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL) { 977 try { 978 resourceManager 979 .getSystemResourceManager() 980 .getNumberByName(this.theme.label.f1.params[0].split('.')[2]); 981 return this.theme.label.f1; 982 } catch (error) { 983 return this.theme.label.defaultFontSize; 984 } 985 } else { 986 try { 987 resourceManager 988 .getSystemResourceManager() 989 .getNumberByName(this.theme.label.e1.params[0].split('.')[2]); 990 return this.theme.label.e1; 991 } catch (error) { 992 return this.theme.label.defaultFontSize; 993 } 994 } 995 } 996 } 997 getLabelFontColor() { 998 if (this.getChipActive()) { 999 return ( 1000 this.label?.activatedFontColor ?? this.theme.label.activatedFontColor 1001 ); 1002 } 1003 return this.label?.fontColor ?? this.theme.label.fontColor; 1004 } 1005 getLabelFontFamily() { 1006 return this.label?.fontFamily ?? this.theme.label.fontFamily; 1007 } 1008 getLabelFontWeight() { 1009 if (this.getChipActive()) { 1010 return FontWeight.Medium; 1011 } 1012 return FontWeight.Regular; 1013 } 1014 lengthMetricsToVp(s1) { 1015 let defaultValue = 0; 1016 if (s1) { 1017 switch (s1.unit) { 1018 case LengthUnit.PX: 1019 return px2vp(s1.value); 1020 case LengthUnit.VP: 1021 return s1.value; 1022 case LengthUnit.FP: 1023 px2vp(fp2px(s1.value)); 1024 break; 1025 case LengthUnit.PERCENT: 1026 return Number.NEGATIVE_INFINITY; 1027 case LengthUnit.LPX: 1028 return px2vp(lpx2px(s1.value)); 1029 } 1030 } 1031 return defaultValue; 1032 } 1033 toVp(value) { 1034 if (value === void 0) { 1035 return Number.NEGATIVE_INFINITY; 1036 } 1037 switch (typeof value) { 1038 case 'number': 1039 return value; 1040 case 'object': 1041 try { 1042 let q1 = this.lengthMetricsToVp(LengthMetrics.resource(value)); 1043 if (q1 === 0 && !m(getContext(this), value)) { 1044 return Number.NEGATIVE_INFINITY; 1045 } 1046 return q1; 1047 } catch (error) { 1048 return Number.NEGATIVE_INFINITY; 1049 } 1050 case 'string': 1051 let p1 = new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i'); 1052 let matches = value.match(p1); 1053 if (!matches) { 1054 return Number.NEGATIVE_INFINITY; 1055 } 1056 let length = Number(matches?.[1] ?? 0); 1057 let unit = matches?.[2] ?? 'vp'; 1058 switch (unit.toLowerCase()) { 1059 case 'px': 1060 length = px2vp(length); 1061 break; 1062 case 'fp': 1063 length = px2vp(fp2px(length)); 1064 break; 1065 case 'lpx': 1066 length = px2vp(lpx2px(length)); 1067 break; 1068 case '%': 1069 length = Number.NEGATIVE_INFINITY; 1070 break; 1071 case 'vp': 1072 break; 1073 default: 1074 break; 1075 } 1076 return length; 1077 default: 1078 return Number.NEGATIVE_INFINITY; 1079 } 1080 } 1081 getLabelMargin() { 1082 let labelMargin = { left: 0, right: 0 }; 1083 if ( 1084 this.label?.labelMargin?.left !== void 0 && 1085 this.toVp(this.label.labelMargin.left) >= 0 1086 ) { 1087 labelMargin.left = this.label?.labelMargin?.left; 1088 } else if ( 1089 this.prefixSymbol?.normal || 1090 this.prefixSymbol?.activated || 1091 this.prefixIcon?.src 1092 ) { 1093 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1094 labelMargin.left = this.theme.label.h1.left; 1095 } else { 1096 labelMargin.left = this.theme.label.g1.left; 1097 } 1098 } 1099 if ( 1100 this.label?.labelMargin?.right !== void 0 && 1101 this.toVp(this.label.labelMargin.right) >= 0 1102 ) { 1103 labelMargin.right = this.label?.labelMargin?.right; 1104 } else if ( 1105 this.suffixSymbol?.normal || 1106 this.suffixSymbol?.activated || 1107 this.suffixIcon?.src || 1108 this.useDefaultSuffixIcon 1109 ) { 1110 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1111 labelMargin.right = this.theme.label.h1.right; 1112 } else { 1113 labelMargin.right = this.theme.label.g1.right; 1114 } 1115 } 1116 return labelMargin; 1117 } 1118 getLocalizedLabelMargin() { 1119 let localizedLabelMargin = { 1120 start: LengthMetrics.vp(0), 1121 end: LengthMetrics.vp(0), 1122 }; 1123 if ( 1124 this.label?.localizedLabelMargin?.start?.value !== void 0 && 1125 this.lengthMetricsToVp(this.label.localizedLabelMargin.start) >= 0 1126 ) { 1127 localizedLabelMargin.start = this.label?.localizedLabelMargin?.start; 1128 } else if ( 1129 this.prefixSymbol?.normal || 1130 this.prefixSymbol?.activated || 1131 this.prefixIcon?.src 1132 ) { 1133 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1134 localizedLabelMargin.start = this.theme.label.j1.start; 1135 } else { 1136 localizedLabelMargin.start = this.theme.label.i1.start; 1137 } 1138 } 1139 if ( 1140 this.label?.localizedLabelMargin?.end?.value !== void 0 && 1141 this.lengthMetricsToVp(this.label.localizedLabelMargin.end) >= 0 1142 ) { 1143 localizedLabelMargin.end = this.label?.localizedLabelMargin?.end; 1144 } else if ( 1145 this.suffixSymbol?.normal || 1146 this.suffixSymbol?.activated || 1147 this.suffixIcon?.src || 1148 this.useDefaultSuffixIcon 1149 ) { 1150 if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 1151 localizedLabelMargin.end = this.theme.label.j1.end; 1152 } else { 1153 localizedLabelMargin.end = this.theme.label.i1.end; 1154 } 1155 } 1156 return localizedLabelMargin; 1157 } 1158 getLabelStartEndVp() { 1159 let labelMargin = this.getLocalizedLabelMargin(); 1160 if ( 1161 this.label && 1162 this.label.labelMargin !== void 0 && 1163 this.label.localizedLabelMargin === void 0 1164 ) { 1165 let margin = this.getLabelMargin(); 1166 return { 1167 start: LengthMetrics.vp(this.toVp(margin.left)), 1168 end: LengthMetrics.vp(this.toVp(margin.right)), 1169 }; 1170 } 1171 return { 1172 start: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.start)), 1173 end: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.end)), 1174 }; 1175 } 1176 getActualLabelMargin() { 1177 let localizedLabelMargin = this.getLocalizedLabelMargin(); 1178 if (this.label && this.label.localizedLabelMargin !== void 0) { 1179 return localizedLabelMargin; 1180 } 1181 if (this.label && this.label.labelMargin !== void 0) { 1182 return this.getLabelMargin(); 1183 } 1184 return localizedLabelMargin; 1185 } 1186 getSuffixIconSize() { 1187 let o1 = { width: 0, height: 0 }; 1188 if ( 1189 this.suffixIcon?.size?.width !== void 0 && 1190 this.toVp(this.suffixIcon?.size?.width) >= 0 1191 ) { 1192 o1.width = this.suffixIcon?.size?.width; 1193 } else { 1194 if (this.getSuffixIconSrc()) { 1195 o1.width = this.theme.suffixIcon.size.width; 1196 } else { 1197 o1.width = 0; 1198 } 1199 } 1200 if ( 1201 this.suffixIcon?.size?.height !== void 0 && 1202 this.toVp(this.suffixIcon?.size?.height) >= 0 1203 ) { 1204 o1.height = this.suffixIcon?.size?.height; 1205 } else { 1206 if (this.getSuffixIconSrc()) { 1207 o1.height = this.theme.suffixIcon.size.height; 1208 } else { 1209 o1.height = 0; 1210 } 1211 } 1212 return o1; 1213 } 1214 getPrefixIconSize() { 1215 let n1 = { width: 0, height: 0 }; 1216 if ( 1217 this.prefixIcon?.size?.width !== void 0 && 1218 this.toVp(this.prefixIcon?.size?.width) >= 0 1219 ) { 1220 n1.width = this.prefixIcon?.size?.width; 1221 } else { 1222 if (this.prefixIcon?.src) { 1223 n1.width = this.theme.prefixIcon.size.width; 1224 } else { 1225 n1.width = 0; 1226 } 1227 } 1228 if ( 1229 this.prefixIcon?.size?.height !== void 0 && 1230 this.toVp(this.prefixIcon?.size?.height) >= 0 1231 ) { 1232 n1.height = this.prefixIcon?.size?.height; 1233 } else { 1234 if (this.prefixIcon?.src) { 1235 n1.height = this.theme.prefixIcon.size.height; 1236 } else { 1237 n1.height = 0; 1238 } 1239 } 1240 return n1; 1241 } 1242 getPrefixIconFilledColor() { 1243 if (this.getChipActive()) { 1244 return ( 1245 this.prefixIcon?.activatedFillColor ?? 1246 this.theme.prefixIcon.activatedFillColor 1247 ); 1248 } 1249 return this.prefixIcon?.fillColor ?? this.theme.prefixIcon.fillColor; 1250 } 1251 getSuffixIconFilledColor() { 1252 if (this.getChipActive()) { 1253 return ( 1254 this.suffixIcon?.activatedFillColor ?? 1255 this.theme.suffixIcon.activatedFillColor 1256 ); 1257 } 1258 return this.suffixIcon?.fillColor ?? this.theme.suffixIcon.fillColor; 1259 } 1260 getDefaultSymbolColor() { 1261 if (this.getChipActive()) { 1262 return this.theme.m1.activatedFontColor; 1263 } 1264 return this.theme.m1.n1; 1265 } 1266 getPrefixSymbolModifier() { 1267 if (this.getChipActive()) { 1268 return this.prefixSymbol?.activated; 1269 } 1270 return this.prefixSymbol?.normal; 1271 } 1272 getSuffixSymbolModifier() { 1273 if (this.getChipActive()) { 1274 return this.suffixSymbol?.activated; 1275 } 1276 return this.suffixSymbol?.normal; 1277 } 1278 getSuffixIconFocusable() { 1279 return ( 1280 (this.useDefaultSuffixIcon && (this.allowClose ?? true)) || 1281 this.suffixIcon?.action !== void 0 1282 ); 1283 } 1284 getChipNodePadding() { 1285 return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 1286 ? this.theme.q1.d2 1287 : this.theme.q1.c2; 1288 } 1289 getChipNodeRadius() { 1290 if (this.chipNodeRadius !== void 0 && this.toVp(this.chipNodeRadius) >= 0) { 1291 return this.chipNodeRadius; 1292 } else { 1293 return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 1294 ? this.theme.q1.b2 1295 : this.theme.q1.a2; 1296 } 1297 } 1298 getChipNodeBackGroundColor() { 1299 let l1; 1300 if (this.getChipActive()) { 1301 l1 = 1302 this.chipNodeActivatedBackgroundColor ?? 1303 this.theme.q1.activatedBackgroundColor; 1304 } else { 1305 l1 = this.chipNodeBackgroundColor ?? this.theme.q1.backgroundColor; 1306 } 1307 let m1; 1308 try { 1309 m1 = ColorMetrics.resourceColor(l1); 1310 } catch (err) { 1311 hilog.error( 1312 0x3900, 1313 'Ace', 1314 `Chip resourceColor, error: ${err.toString()}` 1315 ); 1316 m1 = ColorMetrics.resourceColor(Color.Transparent); 1317 } 1318 if (!this.isShowPressedBackGroundColor) { 1319 return m1.color; 1320 } 1321 return m1.blendColor(ColorMetrics.resourceColor('#19000000')).color; 1322 } 1323 getChipNodeHeight() { 1324 if (this.isChipSizeEnum()) { 1325 return this.chipSize === ChipSize.SMALL 1326 ? this.theme.q1.v1 1327 : this.theme.q1.u1; 1328 } else { 1329 this.chipNodeSize = this.chipSize; 1330 return this.chipNodeSize?.height !== void 0 && 1331 this.toVp(this.chipNodeSize?.height) >= 0 1332 ? this.toVp(this.chipNodeSize?.height) 1333 : this.theme.q1.u1; 1334 } 1335 } 1336 getLabelWidth() { 1337 return px2vp( 1338 measure.measureText({ 1339 textContent: this.label?.text ?? '', 1340 fontSize: this.getLabelFontSize(), 1341 fontFamily: this.label?.fontFamily ?? this.theme.label.fontFamily, 1342 fontWeight: this.getLabelFontWeight(), 1343 maxLines: 1, 1344 overflow: TextOverflow.Ellipsis, 1345 textAlign: TextAlign.Center, 1346 }) 1347 ); 1348 } 1349 getCalculateChipNodeWidth() { 1350 let j1 = 0; 1351 let k1 = this.getLabelStartEndVp(); 1352 j1 += this.getChipNodePadding().start?.value ?? 0; 1353 j1 += this.toVp(this.getPrefixChipWidth()); 1354 j1 += this.toVp(k1.start?.value ?? 0); 1355 j1 += this.getLabelWidth(); 1356 j1 += this.toVp(k1.end?.value ?? 0); 1357 j1 += this.toVp(this.getSuffixChipWidth()); 1358 j1 += this.getChipNodePadding().end?.value ?? 0; 1359 return j1; 1360 } 1361 getPrefixChipWidth() { 1362 if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 1363 return this.prefixSymbolWidth; 1364 } else if (this.prefixIcon?.src) { 1365 return this.getPrefixIconSize().width; 1366 } else { 1367 return 0; 1368 } 1369 } 1370 getSuffixChipWidth() { 1371 if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 1372 return this.suffixSymbolWidth; 1373 } else if (this.suffixIcon?.src) { 1374 return this.getSuffixIconSize().width; 1375 } else if (!this.suffixIcon?.src && (this.allowClose ?? true)) { 1376 return this.allowCloseSymbolWidth; 1377 } else { 1378 return 0; 1379 } 1380 } 1381 getReserveChipNodeWidth() { 1382 return ( 1383 this.getCalculateChipNodeWidth() - this.getLabelWidth() + this.theme.q1.t1 1384 ); 1385 } 1386 getChipEnable() { 1387 return this.chipEnabled || this.chipEnabled === void 0; 1388 } 1389 getChipActive() { 1390 if (typeof this.chipActivated === 'undefined') { 1391 return false; 1392 } 1393 return this.chipActivated; 1394 } 1395 getChipNodeOpacity() { 1396 return this.chipOpacity; 1397 } 1398 handleTouch(event) { 1399 if (!this.getChipEnable()) { 1400 return; 1401 } 1402 if (this.isHover) { 1403 if (event.type === TouchType.Down || event.type === TouchType.Move) { 1404 this.isShowPressedBackGroundColor = true; 1405 } else if (event.type === TouchType.Up) { 1406 this.isShowPressedBackGroundColor = false; 1407 } else { 1408 this.isShowPressedBackGroundColor = false; 1409 } 1410 } else { 1411 if (event.type === TouchType.Down || event.type === TouchType.Move) { 1412 this.isShowPressedBackGroundColor = true; 1413 } else if (event.type === TouchType.Up) { 1414 this.isShowPressedBackGroundColor = false; 1415 } else { 1416 this.isShowPressedBackGroundColor = false; 1417 } 1418 } 1419 } 1420 hoverAnimate(isHover) { 1421 if (!this.getChipEnable()) { 1422 return; 1423 } 1424 this.isHover = isHover; 1425 if (this.isHover) { 1426 this.isShowPressedBackGroundColor = true; 1427 } else { 1428 this.isShowPressedBackGroundColor = false; 1429 } 1430 } 1431 deleteChipNodeAnimate() { 1432 Context.animateTo({ duration: 150, curve: Curve.Sharp }, () => { 1433 this.chipOpacity = 0; 1434 this.chipBlendColor = Color.Transparent; 1435 }); 1436 Context.animateTo( 1437 { 1438 duration: 150, 1439 curve: Curve.FastOutLinearIn, 1440 onFinish: () => { 1441 this.deleteChip = true; 1442 }, 1443 }, 1444 () => { 1445 this.chipScale = { x: 0.85, y: 0.85 }; 1446 } 1447 ); 1448 } 1449 getSuffixIconSrc() { 1450 this.useDefaultSuffixIcon = 1451 !this.suffixIcon?.src && (this.allowClose ?? true); 1452 return this.useDefaultSuffixIcon 1453 ? this.theme.suffixIcon.l1 1454 : this.suffixIcon?.src ?? void 0; 1455 } 1456 getChipNodeWidth() { 1457 if (!this.isChipSizeEnum()) { 1458 this.chipNodeSize = this.chipSize; 1459 if ( 1460 this.chipNodeSize?.width !== void 0 && 1461 this.toVp(this.chipNodeSize.width) >= 0 1462 ) { 1463 return this.toVp(this.chipNodeSize.width); 1464 } 1465 } 1466 let constraintWidth = this.getChipConstraintWidth(); 1467 return Math.min( 1468 Math.max(this.getCalculateChipNodeWidth(), constraintWidth.minWidth), 1469 constraintWidth.maxWidth 1470 ); 1471 } 1472 getFocusOverlaySize() { 1473 return { 1474 width: 1475 Math.max( 1476 this.getChipNodeWidth(), 1477 this.getChipConstraintWidth().minWidth 1478 ) + 8, 1479 height: this.getChipNodeHeight() + 8, 1480 }; 1481 } 1482 getChipConstraintWidth() { 1483 let i1 = this.getReserveChipNodeWidth(); 1484 let constraintWidth = this.getCalculateChipNodeWidth(); 1485 let constraintSize; 1486 switch (this.chipBreakPoints) { 1487 case a1.SM: 1488 constraintSize = { 1489 minWidth: i1, 1490 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.i2), 1491 }; 1492 break; 1493 case a1.MD: 1494 constraintSize = { 1495 minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 1496 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.j2), 1497 }; 1498 break; 1499 case a1.LG: 1500 constraintSize = { 1501 minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 1502 maxWidth: Math.min(constraintWidth, this.theme.q1.g2.l2), 1503 }; 1504 break; 1505 default: 1506 constraintSize = { minWidth: i1, maxWidth: constraintWidth }; 1507 break; 1508 } 1509 constraintSize.minWidth = Math.min( 1510 Math.max(this.getCalculateChipNodeWidth(), constraintSize.minWidth), 1511 constraintSize.maxWidth 1512 ); 1513 constraintSize.minHeight = this.getChipNodeHeight(); 1514 if ( 1515 !this.isChipSizeEnum() && 1516 this.chipNodeSize?.height !== void 0 && 1517 this.toVp(this.chipNodeSize?.height) >= 0 1518 ) { 1519 constraintSize.maxHeight = this.toVp(this.chipNodeSize.height); 1520 constraintSize.minHeight = this.toVp(this.chipNodeSize.height); 1521 } 1522 if ( 1523 !this.isChipSizeEnum() && 1524 this.chipNodeSize?.width !== void 0 && 1525 this.toVp(this.chipNodeSize?.width) >= 0 1526 ) { 1527 constraintSize.minWidth = this.toVp(this.chipNodeSize.width); 1528 constraintSize.maxWidth = this.toVp(this.chipNodeSize.width); 1529 } else if (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) { 1530 constraintSize.minWidth = void 0; 1531 constraintSize.maxWidth = void 0; 1532 } 1533 return constraintSize; 1534 } 1535 1536 focusOverlay(parent = null) { 1537 this.observeComponentCreation2((elmtId, isInitialRender) => { 1538 Stack.create(); 1539 Stack.direction(this.chipDirection); 1540 Stack.size({ width: 1, height: 1 }); 1541 Stack.align(Alignment.Center); 1542 }, Stack); 1543 this.observeComponentCreation2((elmtId, isInitialRender) => { 1544 If.create(); 1545 if (this.chipNodeOnFocus && !this.suffixIconOnFocus) { 1546 this.ifElseBranchUpdateFunction(0, () => { 1547 this.observeComponentCreation2((elmtId, isInitialRender) => { 1548 Stack.create(); 1549 Stack.direction(this.chipDirection); 1550 Stack.borderRadius(this.toVp(this.getChipNodeRadius()) + 4); 1551 Stack.size(this.getFocusOverlaySize()); 1552 Stack.borderColor(this.theme.q1.w1); 1553 Stack.borderWidth(this.theme.q1.borderWidth); 1554 }, Stack); 1555 Stack.pop(); 1556 }); 1557 } else { 1558 this.ifElseBranchUpdateFunction(1, () => {}); 1559 } 1560 }, If); 1561 If.pop(); 1562 Stack.pop(); 1563 } 1564 aboutToAppear() { 1565 let e1 = this.getUIContext(); 1566 this.fontSizeScale = e1.getHostContext()?.config?.fontSizeScale ?? 1; 1567 this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false; 1568 this.smListener.on('change', (h1) => { 1569 if (h1.matches) { 1570 this.chipBreakPoints = a1.SM; 1571 } 1572 }); 1573 this.mdListener.on('change', (g1) => { 1574 if (g1.matches) { 1575 this.chipBreakPoints = a1.MD; 1576 } 1577 }); 1578 this.lgListener.on('change', (f1) => { 1579 if (f1.matches) { 1580 this.chipBreakPoints = a1.LG; 1581 } 1582 }); 1583 this.callbackId = this.getUIContext() 1584 .getHostContext() 1585 ?.getApplicationContext() 1586 ?.on('environment', this.callbacks); 1587 } 1588 getVisibility() { 1589 if (this.toVp(this.getChipNodeHeight()) > 0) { 1590 return Visibility.Visible; 1591 } else { 1592 return Visibility.None; 1593 } 1594 } 1595 aboutToDisappear() { 1596 this.smListener.off('change'); 1597 this.mdListener.off('change'); 1598 this.lgListener.off('change'); 1599 if (this.callbackId) { 1600 this.getUIContext() 1601 .getHostContext() 1602 ?.getApplicationContext() 1603 ?.off('environment', this.callbackId); 1604 this.callbackId = void 0; 1605 } 1606 } 1607 chipBuilder(parent = null) { 1608 this.observeComponentCreation2((elmtId, isInitialRender) => { 1609 Button.createWithChild(); 1610 Button.constraintSize(this.getChipConstraintWidth()); 1611 Button.direction(this.chipDirection); 1612 Button.type(ButtonType.Normal); 1613 Button.clip(this.isClipable); 1614 Button.backgroundColor(this.getChipNodeBackGroundColor()); 1615 Button.borderRadius(this.getChipNodeRadius()); 1616 Button.enabled(this.getChipEnable()); 1617 Button.scale(ObservedObject.GetRawObject(this.chipScale)); 1618 Button.focusable(true); 1619 Button.opacity(this.getChipNodeOpacity()); 1620 Button.padding(0); 1621 Button.accessibilityGroup(true); 1622 Button.accessibilityDescription(this.getAccessibilityDescription()); 1623 Button.accessibilityLevel(this.getAccessibilityLevel()); 1624 Button.accessibilityChecked(this.getAccessibilityChecked()); 1625 Button.accessibilitySelected(this.getAccessibilitySelected()); 1626 Button.onFocus(() => { 1627 this.chipNodeOnFocus = true; 1628 }); 1629 Button.onBlur(() => { 1630 this.chipNodeOnFocus = false; 1631 }); 1632 Button.onTouch((event) => { 1633 this.handleTouch(event); 1634 }); 1635 Button.onHover((isHover) => { 1636 if (isHover) { 1637 this.isShowPressedBackGroundColor = true; 1638 } else { 1639 if (!this.isShowPressedBackGroundColor && isHover) { 1640 this.isShowPressedBackGroundColor = true; 1641 } else { 1642 this.isShowPressedBackGroundColor = false; 1643 } 1644 } 1645 }); 1646 Button.onKeyEvent((event) => { 1647 if ( 1648 event.type === KeyType.Down && 1649 event.keyCode === KeyCode.KEYCODE_FORWARD_DEL && 1650 !this.suffixIconOnFocus 1651 ) { 1652 this.deleteChipNodeAnimate(); 1653 } 1654 }); 1655 Button.onClick( 1656 this.onClicked === c1 ? undefined : this.onClicked.bind(this) 1657 ); 1658 }, Button); 1659 this.observeComponentCreation2((elmtId, isInitialRender) => { 1660 Row.create(); 1661 Row.direction(this.chipDirection); 1662 Row.alignItems(VerticalAlign.Center); 1663 Row.justifyContent(FlexAlign.Center); 1664 Row.padding(this.getChipNodePadding()); 1665 Row.constraintSize(this.getChipConstraintWidth()); 1666 }, Row); 1667 this.observeComponentCreation2((elmtId, isInitialRender) => { 1668 If.create(); 1669 if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 1670 this.ifElseBranchUpdateFunction(0, () => { 1671 this.observeComponentCreation2((elmtId, isInitialRender) => { 1672 SymbolGlyph.create(); 1673 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1674 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1675 SymbolGlyph.attributeModifier.bind(this)( 1676 this.getPrefixSymbolModifier() 1677 ); 1678 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1679 SymbolGlyph.symbolEffect( 1680 ObservedObject.GetRawObject(this.symbolEffect), 1681 false 1682 ); 1683 SymbolGlyph.symbolEffect( 1684 ObservedObject.GetRawObject(this.symbolEffect), 1685 this.theme.m1.o1 1686 ); 1687 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1688 this.prefixSymbolWidth = newValue?.width; 1689 }); 1690 SymbolGlyph.key('PrefixSymbolGlyph'); 1691 }, SymbolGlyph); 1692 }); 1693 } else if (this.prefixIcon?.src !== '') { 1694 this.ifElseBranchUpdateFunction(1, () => { 1695 this.observeComponentCreation2((elmtId, isInitialRender) => { 1696 Image.create(this.prefixIcon?.src); 1697 Image.direction(this.chipDirection); 1698 Image.opacity(this.getChipNodeOpacity()); 1699 Image.size(this.getPrefixIconSize()); 1700 Image.fillColor(this.getPrefixIconFilledColor()); 1701 Image.enabled(this.getChipEnable()); 1702 Image.objectFit(ImageFit.Cover); 1703 Image.focusable(false); 1704 Image.flexShrink(0); 1705 Image.visibility(this.getVisibility()); 1706 Image.draggable(false); 1707 }, Image); 1708 }); 1709 } else { 1710 this.ifElseBranchUpdateFunction(2, () => {}); 1711 } 1712 }, If); 1713 If.pop(); 1714 this.observeComponentCreation2((elmtId, isInitialRender) => { 1715 Text.create(this.label?.text ?? ''); 1716 Text.direction(this.chipDirection); 1717 Text.opacity(this.getChipNodeOpacity()); 1718 Text.fontSize(this.getLabelFontSize()); 1719 Text.fontColor(this.getLabelFontColor()); 1720 Text.fontFamily(this.getLabelFontFamily()); 1721 Text.fontWeight(this.getLabelFontWeight()); 1722 Text.margin(this.getActualLabelMargin()); 1723 Text.enabled(this.getChipEnable()); 1724 Text.maxLines(1); 1725 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1726 Text.flexShrink(1); 1727 Text.focusable(true); 1728 Text.textAlign(TextAlign.Center); 1729 Text.visibility(this.getVisibility()); 1730 Text.draggable(false); 1731 }, Text); 1732 Text.pop(); 1733 this.observeComponentCreation2((elmtId, isInitialRender) => { 1734 If.create(); 1735 if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 1736 this.ifElseBranchUpdateFunction(0, () => { 1737 this.observeComponentCreation2((elmtId, isInitialRender) => { 1738 Button.createWithChild({ type: ButtonType.Normal }); 1739 Button.onClick(this.getSuffixSymbolAction()); 1740 Button.accessibilityText(this.getSuffixSymbolAccessibilityText()); 1741 Button.accessibilityDescription( 1742 this.getSuffixSymbolAccessibilityDescription() 1743 ); 1744 Button.accessibilityLevel(this.getSuffixSymbolAccessibilityLevel()); 1745 Button.backgroundColor(Color.Transparent); 1746 Button.borderRadius(0); 1747 Button.padding(0); 1748 Button.stateEffect(false); 1749 }, Button); 1750 this.observeComponentCreation2((elmtId, isInitialRender) => { 1751 SymbolGlyph.create(); 1752 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1753 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1754 SymbolGlyph.attributeModifier.bind(this)( 1755 this.getSuffixSymbolModifier() 1756 ); 1757 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1758 SymbolGlyph.symbolEffect( 1759 ObservedObject.GetRawObject(this.symbolEffect), 1760 false 1761 ); 1762 SymbolGlyph.symbolEffect( 1763 ObservedObject.GetRawObject(this.symbolEffect), 1764 this.theme.m1.o1 1765 ); 1766 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1767 this.suffixSymbolWidth = newValue?.width; 1768 }); 1769 SymbolGlyph.key('SuffixSymbolGlyph'); 1770 }, SymbolGlyph); 1771 Button.pop(); 1772 }); 1773 } else if (this.suffixIcon?.src !== '') { 1774 this.ifElseBranchUpdateFunction(1, () => { 1775 this.observeComponentCreation2((elmtId, isInitialRender) => { 1776 Button.createWithChild({ type: ButtonType.Normal }); 1777 Button.backgroundColor(Color.Transparent); 1778 Button.borderRadius(0); 1779 Button.padding(0); 1780 Button.accessibilityText(this.getSuffixIconAccessibilityText()); 1781 Button.accessibilityDescription( 1782 this.getSuffixIconAccessibilityDescription() 1783 ); 1784 Button.accessibilityLevel(this.getSuffixIconAccessibilityLevel()); 1785 Button.onClick(() => { 1786 if (!this.getChipEnable()) { 1787 return; 1788 } 1789 if (this.suffixIcon?.action) { 1790 this.suffixIcon.action(); 1791 return; 1792 } 1793 if ((this.allowClose ?? true) && this.useDefaultSuffixIcon) { 1794 this.onClose(); 1795 this.deleteChipNodeAnimate(); 1796 return; 1797 } 1798 this.onClicked(); 1799 }); 1800 Button.focusable(this.getSuffixIconFocusable()); 1801 }, Button); 1802 this.observeComponentCreation2((elmtId, isInitialRender) => { 1803 Image.create(this.getSuffixIconSrc()); 1804 Image.direction(this.chipDirection); 1805 Image.opacity(this.getChipNodeOpacity()); 1806 Image.size(this.getSuffixIconSize()); 1807 Image.fillColor(this.getSuffixIconFilledColor()); 1808 Image.enabled(this.getChipEnable()); 1809 Image.objectFit(ImageFit.Cover); 1810 Image.flexShrink(0); 1811 Image.visibility(this.getVisibility()); 1812 Image.draggable(false); 1813 Image.onFocus(() => { 1814 this.suffixIconOnFocus = true; 1815 }); 1816 Image.onBlur(() => { 1817 this.suffixIconOnFocus = false; 1818 }); 1819 }, Image); 1820 Button.pop(); 1821 }); 1822 } else if (this.allowClose ?? true) { 1823 this.ifElseBranchUpdateFunction(2, () => { 1824 this.observeComponentCreation2((elmtId, isInitialRender) => { 1825 Button.createWithChild({ type: ButtonType.Normal }); 1826 Button.backgroundColor(Color.Transparent); 1827 Button.borderRadius(0); 1828 Button.padding(0); 1829 Button.accessibilityText(this.getCloseIconAccessibilityText()); 1830 Button.accessibilityDescription( 1831 this.getCloseIconAccessibilityDescription() 1832 ); 1833 Button.accessibilityLevel(this.getCloseIconAccessibilityLevel()); 1834 Button.onClick(() => { 1835 if (!this.getChipEnable()) { 1836 return; 1837 } 1838 this.onClose(); 1839 this.deleteChipNodeAnimate(); 1840 }); 1841 }, Button); 1842 this.observeComponentCreation2((elmtId, isInitialRender) => { 1843 SymbolGlyph.create({ 1844 id: -1, 1845 type: 40000, 1846 params: ['sys.symbol.xmark'], 1847 bundleName: '__harDefaultBundleName__', 1848 moduleName: '__harDefaultModuleName__', 1849 }); 1850 SymbolGlyph.fontSize(this.theme.m1.fontSize); 1851 SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 1852 SymbolGlyph.onSizeChange((oldValue, newValue) => { 1853 this.allowCloseSymbolWidth = newValue?.width; 1854 }); 1855 SymbolGlyph.key('AllowCloseSymbolGlyph'); 1856 }, SymbolGlyph); 1857 Button.pop(); 1858 }); 1859 } else { 1860 this.ifElseBranchUpdateFunction(3, () => {}); 1861 } 1862 }, If); 1863 If.pop(); 1864 Row.pop(); 1865 Button.pop(); 1866 } 1867 getSuffixSymbolAccessibilityLevel() { 1868 if (this.getChipActive()) { 1869 if ( 1870 !this.suffixSymbolOptions?.activatedAccessibility?.accessibilityLevel 1871 ) { 1872 return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 1873 } 1874 return this.suffixSymbolOptions.activatedAccessibility.accessibilityLevel; 1875 } 1876 if (!this.suffixSymbolOptions?.normalAccessibility?.accessibilityLevel) { 1877 return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 1878 } 1879 return this.suffixSymbolOptions.normalAccessibility.accessibilityLevel; 1880 } 1881 getSuffixSymbolAccessibilityDescription() { 1882 if (this.getChipActive()) { 1883 if ( 1884 typeof this.suffixSymbolOptions?.activatedAccessibility 1885 ?.accessibilityDescription !== 'undefined' 1886 ) { 1887 return this.suffixSymbolOptions.activatedAccessibility 1888 .accessibilityDescription; 1889 } 1890 return undefined; 1891 } 1892 if ( 1893 typeof this.suffixSymbolOptions?.normalAccessibility 1894 ?.accessibilityDescription !== 'undefined' 1895 ) { 1896 return this.suffixSymbolOptions.normalAccessibility 1897 .accessibilityDescription; 1898 } 1899 return undefined; 1900 } 1901 getSuffixSymbolAccessibilityText() { 1902 if (this.getChipActive()) { 1903 if ( 1904 typeof this.suffixSymbolOptions?.activatedAccessibility 1905 ?.accessibilityText !== 'undefined' 1906 ) { 1907 return this.suffixSymbolOptions.activatedAccessibility 1908 .accessibilityText; 1909 } 1910 return undefined; 1911 } 1912 if ( 1913 typeof this.suffixSymbolOptions?.normalAccessibility 1914 ?.accessibilityText !== 'undefined' 1915 ) { 1916 return this.suffixSymbolOptions.normalAccessibility.accessibilityText; 1917 } 1918 return undefined; 1919 } 1920 getSuffixSymbolAction() { 1921 if (typeof this.suffixSymbolOptions?.action === 'undefined') { 1922 return undefined; 1923 } 1924 return () => { 1925 if (!this.getChipEnable()) { 1926 return; 1927 } 1928 this.suffixSymbolOptions?.action?.(); 1929 }; 1930 } 1931 getAccessibilitySelected() { 1932 if ( 1933 this.getChipAccessibilitySelectedType() === 1934 AccessibilitySelectedType.SELECTED 1935 ) { 1936 return this.getChipActive(); 1937 } 1938 return undefined; 1939 } 1940 getAccessibilityChecked() { 1941 if ( 1942 this.getChipAccessibilitySelectedType() === 1943 AccessibilitySelectedType.CHECKED 1944 ) { 1945 return this.getChipActive(); 1946 } 1947 return undefined; 1948 } 1949 getChipAccessibilitySelectedType() { 1950 if (typeof this.chipActivated === 'undefined') { 1951 return AccessibilitySelectedType.CLICKED; 1952 } 1953 return ( 1954 this.chipAccessibilitySelectedType ?? AccessibilitySelectedType.CHECKED 1955 ); 1956 } 1957 getCloseIconAccessibilityLevel() { 1958 if (this.closeOptions?.accessibilityLevel) { 1959 return this.closeOptions.accessibilityLevel; 1960 } 1961 return 'yes'; 1962 } 1963 getCloseIconAccessibilityDescription() { 1964 if (typeof this.closeOptions?.accessibilityDescription === 'undefined') { 1965 return undefined; 1966 } 1967 return this.closeOptions.accessibilityDescription; 1968 } 1969 getCloseIconAccessibilityText() { 1970 if (typeof this.closeOptions?.accessibilityText === 'undefined') { 1971 return { 1972 id: -1, 1973 type: 10003, 1974 params: ['sys.string.delete_used_for_accessibility_text'], 1975 bundleName: '__harDefaultBundleName__', 1976 moduleName: '__harDefaultModuleName__', 1977 }; 1978 } 1979 return this.closeOptions.accessibilityText; 1980 } 1981 getSuffixIconAccessibilityLevel() { 1982 if (!this.suffixIcon?.accessibilityLevel) { 1983 return !this.suffixIcon?.action ? 'no' : 'yes'; 1984 } 1985 return this.suffixIcon.accessibilityLevel; 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 2026export default { 2027 Chip, 2028 ChipSize, 2029 AccessibilitySelectedType, 2030}; 2031