123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ciif (!('finalizeConstruction' in ViewPU.prototype)) { 1723b3eb3cSopenharmony_ci Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => {}); 1823b3eb3cSopenharmony_ci} 1923b3eb3cSopenharmony_ciconst KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 2023b3eb3cSopenharmony_ciconst measure = requireNapi('measure'); 2123b3eb3cSopenharmony_ciconst mediaquery = requireNapi('mediaquery'); 2223b3eb3cSopenharmony_ciconst resourceManager = requireNapi('resourceManager'); 2323b3eb3cSopenharmony_ciconst componentUtils = requireNapi('arkui.componentUtils'); 2423b3eb3cSopenharmony_ciconst hilog = requireNapi('hilog'); 2523b3eb3cSopenharmony_ciconst ColorMetrics = requireNapi('arkui.node').ColorMetrics; 2623b3eb3cSopenharmony_ciconst LengthMetrics = requireNapi('arkui.node').LengthMetrics; 2723b3eb3cSopenharmony_ciconst LengthUnit = requireNapi('arkui.node').LengthUnit; 2823b3eb3cSopenharmony_ciconst o = 10003; 2923b3eb3cSopenharmony_ciconst t = 10002; 3023b3eb3cSopenharmony_ciconst u = 10007; 3123b3eb3cSopenharmony_ciexport var ChipSize; 3223b3eb3cSopenharmony_ci(function (ChipSize) { 3323b3eb3cSopenharmony_ci ChipSize['NORMAL'] = 'NORMAL'; 3423b3eb3cSopenharmony_ci ChipSize['SMALL'] = 'SMALL'; 3523b3eb3cSopenharmony_ci})(ChipSize || (ChipSize = {})); 3623b3eb3cSopenharmony_civar a1; 3723b3eb3cSopenharmony_ci(function (v1) { 3823b3eb3cSopenharmony_ci v1['SM'] = 'SM'; 3923b3eb3cSopenharmony_ci v1['MD'] = 'MD'; 4023b3eb3cSopenharmony_ci v1['LG'] = 'LG'; 4123b3eb3cSopenharmony_ci})(a1 || (a1 = {})); 4223b3eb3cSopenharmony_ciexport var AccessibilitySelectedType; 4323b3eb3cSopenharmony_ci(function (AccessibilitySelectedType) { 4423b3eb3cSopenharmony_ci AccessibilitySelectedType[(AccessibilitySelectedType['CLICKED'] = 0)] = 4523b3eb3cSopenharmony_ci 'CLICKED'; 4623b3eb3cSopenharmony_ci AccessibilitySelectedType[(AccessibilitySelectedType['CHECKED'] = 1)] = 4723b3eb3cSopenharmony_ci 'CHECKED'; 4823b3eb3cSopenharmony_ci AccessibilitySelectedType[(AccessibilitySelectedType['SELECTED'] = 2)] = 4923b3eb3cSopenharmony_ci 'SELECTED'; 5023b3eb3cSopenharmony_ci})(AccessibilitySelectedType || (AccessibilitySelectedType = {})); 5123b3eb3cSopenharmony_ciexport const b1 = { 5223b3eb3cSopenharmony_ci prefixIcon: { 5323b3eb3cSopenharmony_ci size: { width: 16, height: 16 }, 5423b3eb3cSopenharmony_ci fillColor: { 5523b3eb3cSopenharmony_ci id: -1, 5623b3eb3cSopenharmony_ci type: 10001, 5723b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_secondary'], 5823b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 5923b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 6023b3eb3cSopenharmony_ci }, 6123b3eb3cSopenharmony_ci activatedFillColor: { 6223b3eb3cSopenharmony_ci id: -1, 6323b3eb3cSopenharmony_ci type: 10001, 6423b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary_contrary'], 6523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 6623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 6723b3eb3cSopenharmony_ci }, 6823b3eb3cSopenharmony_ci }, 6923b3eb3cSopenharmony_ci label: { 7023b3eb3cSopenharmony_ci e1: { 7123b3eb3cSopenharmony_ci id: -1, 7223b3eb3cSopenharmony_ci type: 10002, 7323b3eb3cSopenharmony_ci params: ['sys.float.ohos_id_text_size_button2'], 7423b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 7523b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 7623b3eb3cSopenharmony_ci }, 7723b3eb3cSopenharmony_ci f1: { 7823b3eb3cSopenharmony_ci id: -1, 7923b3eb3cSopenharmony_ci type: 10002, 8023b3eb3cSopenharmony_ci params: ['sys.float.ohos_id_text_size_button2'], 8123b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 8223b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 8323b3eb3cSopenharmony_ci }, 8423b3eb3cSopenharmony_ci fontColor: { 8523b3eb3cSopenharmony_ci id: -1, 8623b3eb3cSopenharmony_ci type: 10001, 8723b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary'], 8823b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 8923b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 9023b3eb3cSopenharmony_ci }, 9123b3eb3cSopenharmony_ci activatedFontColor: { 9223b3eb3cSopenharmony_ci id: -1, 9323b3eb3cSopenharmony_ci type: 10001, 9423b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary_contrary'], 9523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 9623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 9723b3eb3cSopenharmony_ci }, 9823b3eb3cSopenharmony_ci fontFamily: 'HarmonyOS Sans', 9923b3eb3cSopenharmony_ci g1: { 10023b3eb3cSopenharmony_ci left: 6, 10123b3eb3cSopenharmony_ci right: 6, 10223b3eb3cSopenharmony_ci top: 0, 10323b3eb3cSopenharmony_ci bottom: 0, 10423b3eb3cSopenharmony_ci }, 10523b3eb3cSopenharmony_ci h1: { 10623b3eb3cSopenharmony_ci left: 4, 10723b3eb3cSopenharmony_ci right: 4, 10823b3eb3cSopenharmony_ci top: 0, 10923b3eb3cSopenharmony_ci bottom: 0, 11023b3eb3cSopenharmony_ci }, 11123b3eb3cSopenharmony_ci defaultFontSize: 14, 11223b3eb3cSopenharmony_ci i1: { 11323b3eb3cSopenharmony_ci start: LengthMetrics.vp(6), 11423b3eb3cSopenharmony_ci end: LengthMetrics.vp(6), 11523b3eb3cSopenharmony_ci top: LengthMetrics.vp(0), 11623b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(0), 11723b3eb3cSopenharmony_ci }, 11823b3eb3cSopenharmony_ci j1: { 11923b3eb3cSopenharmony_ci start: LengthMetrics.vp(4), 12023b3eb3cSopenharmony_ci end: LengthMetrics.vp(4), 12123b3eb3cSopenharmony_ci top: LengthMetrics.vp(0), 12223b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(0), 12323b3eb3cSopenharmony_ci }, 12423b3eb3cSopenharmony_ci }, 12523b3eb3cSopenharmony_ci suffixIcon: { 12623b3eb3cSopenharmony_ci size: { width: 16, height: 16 }, 12723b3eb3cSopenharmony_ci fillColor: { 12823b3eb3cSopenharmony_ci id: -1, 12923b3eb3cSopenharmony_ci type: 10001, 13023b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_secondary'], 13123b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 13223b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 13323b3eb3cSopenharmony_ci }, 13423b3eb3cSopenharmony_ci activatedFillColor: { 13523b3eb3cSopenharmony_ci id: -1, 13623b3eb3cSopenharmony_ci type: 10001, 13723b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary_contrary'], 13823b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 13923b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 14023b3eb3cSopenharmony_ci }, 14123b3eb3cSopenharmony_ci l1: { 14223b3eb3cSopenharmony_ci id: -1, 14323b3eb3cSopenharmony_ci type: 20000, 14423b3eb3cSopenharmony_ci params: ['sys.media.ohos_ic_public_cancel', 16, 16], 14523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 14623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 14723b3eb3cSopenharmony_ci }, 14823b3eb3cSopenharmony_ci focusable: false, 14923b3eb3cSopenharmony_ci }, 15023b3eb3cSopenharmony_ci m1: { 15123b3eb3cSopenharmony_ci n1: [ 15223b3eb3cSopenharmony_ci { 15323b3eb3cSopenharmony_ci id: -1, 15423b3eb3cSopenharmony_ci type: 10001, 15523b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_secondary'], 15623b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 15723b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 15823b3eb3cSopenharmony_ci }, 15923b3eb3cSopenharmony_ci ], 16023b3eb3cSopenharmony_ci activatedFontColor: [ 16123b3eb3cSopenharmony_ci { 16223b3eb3cSopenharmony_ci id: -1, 16323b3eb3cSopenharmony_ci type: 10001, 16423b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary_contrary'], 16523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 16623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 16723b3eb3cSopenharmony_ci }, 16823b3eb3cSopenharmony_ci ], 16923b3eb3cSopenharmony_ci fontSize: 16, 17023b3eb3cSopenharmony_ci o1: -1, 17123b3eb3cSopenharmony_ci }, 17223b3eb3cSopenharmony_ci q1: { 17323b3eb3cSopenharmony_ci s1: 1.75, 17423b3eb3cSopenharmony_ci t1: 12, 17523b3eb3cSopenharmony_ci u1: 36, 17623b3eb3cSopenharmony_ci v1: 28, 17723b3eb3cSopenharmony_ci enabled: true, 17823b3eb3cSopenharmony_ci activated: false, 17923b3eb3cSopenharmony_ci backgroundColor: { 18023b3eb3cSopenharmony_ci id: -1, 18123b3eb3cSopenharmony_ci type: 10001, 18223b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_button_normal'], 18323b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 18423b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 18523b3eb3cSopenharmony_ci }, 18623b3eb3cSopenharmony_ci activatedBackgroundColor: { 18723b3eb3cSopenharmony_ci id: -1, 18823b3eb3cSopenharmony_ci type: 10001, 18923b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_emphasize'], 19023b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 19123b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 19223b3eb3cSopenharmony_ci }, 19323b3eb3cSopenharmony_ci w1: { 19423b3eb3cSopenharmony_ci id: -1, 19523b3eb3cSopenharmony_ci type: 10001, 19623b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_focused_outline'], 19723b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 19823b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 19923b3eb3cSopenharmony_ci }, 20023b3eb3cSopenharmony_ci z1: 2, 20123b3eb3cSopenharmony_ci a2: { 20223b3eb3cSopenharmony_ci id: -1, 20323b3eb3cSopenharmony_ci type: 10002, 20423b3eb3cSopenharmony_ci params: ['sys.float.chip_border_radius_normal'], 20523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 20623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 20723b3eb3cSopenharmony_ci }, 20823b3eb3cSopenharmony_ci b2: { 20923b3eb3cSopenharmony_ci id: -1, 21023b3eb3cSopenharmony_ci type: 10002, 21123b3eb3cSopenharmony_ci params: ['sys.float.chip_border_radius_small'], 21223b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 21323b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 21423b3eb3cSopenharmony_ci }, 21523b3eb3cSopenharmony_ci borderWidth: 2, 21623b3eb3cSopenharmony_ci c2: { 21723b3eb3cSopenharmony_ci start: LengthMetrics.vp(16), 21823b3eb3cSopenharmony_ci end: LengthMetrics.vp(16), 21923b3eb3cSopenharmony_ci top: LengthMetrics.vp(4), 22023b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(4), 22123b3eb3cSopenharmony_ci }, 22223b3eb3cSopenharmony_ci d2: { 22323b3eb3cSopenharmony_ci start: LengthMetrics.vp(12), 22423b3eb3cSopenharmony_ci end: LengthMetrics.vp(12), 22523b3eb3cSopenharmony_ci top: LengthMetrics.vp(4), 22623b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(4), 22723b3eb3cSopenharmony_ci }, 22823b3eb3cSopenharmony_ci e2: { 22923b3eb3cSopenharmony_ci id: -1, 23023b3eb3cSopenharmony_ci type: 10001, 23123b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_hover'], 23223b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 23323b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 23423b3eb3cSopenharmony_ci }, 23523b3eb3cSopenharmony_ci f2: { 23623b3eb3cSopenharmony_ci id: -1, 23723b3eb3cSopenharmony_ci type: 10001, 23823b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_click_effect'], 23923b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 24023b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 24123b3eb3cSopenharmony_ci }, 24223b3eb3cSopenharmony_ci opacity: { normal: 1, hover: 0.95, pressed: 0.9 }, 24323b3eb3cSopenharmony_ci g2: { 24423b3eb3cSopenharmony_ci h2: 128, 24523b3eb3cSopenharmony_ci i2: 156, 24623b3eb3cSopenharmony_ci j2: 280, 24723b3eb3cSopenharmony_ci l2: 400, 24823b3eb3cSopenharmony_ci }, 24923b3eb3cSopenharmony_ci }, 25023b3eb3cSopenharmony_ci}; 25123b3eb3cSopenharmony_ciconst c1 = () => {}; 25223b3eb3cSopenharmony_ciexport function Chip(options, parent = null) { 25323b3eb3cSopenharmony_ci const u1 = options; 25423b3eb3cSopenharmony_ci { 25523b3eb3cSopenharmony_ci (parent ? parent : this).observeComponentCreation2( 25623b3eb3cSopenharmony_ci (elmtId, isInitialRender, options = u1) => { 25723b3eb3cSopenharmony_ci if (isInitialRender) { 25823b3eb3cSopenharmony_ci let componentCall = new d1( 25923b3eb3cSopenharmony_ci parent ? parent : this, 26023b3eb3cSopenharmony_ci { 26123b3eb3cSopenharmony_ci chipSize: options.size, 26223b3eb3cSopenharmony_ci prefixIcon: options.prefixIcon, 26323b3eb3cSopenharmony_ci prefixSymbol: options.prefixSymbol, 26423b3eb3cSopenharmony_ci label: options.label, 26523b3eb3cSopenharmony_ci suffixIcon: options.suffixIcon, 26623b3eb3cSopenharmony_ci suffixSymbol: options.suffixSymbol, 26723b3eb3cSopenharmony_ci suffixSymbolOptions: options.suffixSymbolOptions, 26823b3eb3cSopenharmony_ci allowClose: options.allowClose, 26923b3eb3cSopenharmony_ci closeOptions: options.closeOptions, 27023b3eb3cSopenharmony_ci chipEnabled: options.enabled, 27123b3eb3cSopenharmony_ci chipActivated: options.activated, 27223b3eb3cSopenharmony_ci chipNodeBackgroundColor: options.backgroundColor, 27323b3eb3cSopenharmony_ci chipNodeActivatedBackgroundColor: 27423b3eb3cSopenharmony_ci options.activatedBackgroundColor, 27523b3eb3cSopenharmony_ci chipNodeRadius: options.borderRadius, 27623b3eb3cSopenharmony_ci chipDirection: options.direction, 27723b3eb3cSopenharmony_ci chipAccessibilitySelectedType: options.accessibilitySelectedType, 27823b3eb3cSopenharmony_ci chipAccessibilityDescription: options.accessibilityDescription, 27923b3eb3cSopenharmony_ci chipAccessibilityLevel: options.accessibilityLevel, 28023b3eb3cSopenharmony_ci onClose: options.onClose, 28123b3eb3cSopenharmony_ci onClicked: options.onClicked, 28223b3eb3cSopenharmony_ci }, 28323b3eb3cSopenharmony_ci undefined, 28423b3eb3cSopenharmony_ci elmtId, 28523b3eb3cSopenharmony_ci () => {}, 28623b3eb3cSopenharmony_ci { 28723b3eb3cSopenharmony_ci page: 'advancedComponents/src/main/ets/components/Chip.ets', 28823b3eb3cSopenharmony_ci line: 296, 28923b3eb3cSopenharmony_ci m2: 3, 29023b3eb3cSopenharmony_ci } 29123b3eb3cSopenharmony_ci ); 29223b3eb3cSopenharmony_ci ViewPU.create(componentCall); 29323b3eb3cSopenharmony_ci let paramsLambda = () => { 29423b3eb3cSopenharmony_ci return { 29523b3eb3cSopenharmony_ci chipSize: options.size, 29623b3eb3cSopenharmony_ci prefixIcon: options.prefixIcon, 29723b3eb3cSopenharmony_ci prefixSymbol: options.prefixSymbol, 29823b3eb3cSopenharmony_ci label: options.label, 29923b3eb3cSopenharmony_ci suffixIcon: options.suffixIcon, 30023b3eb3cSopenharmony_ci suffixSymbol: options.suffixSymbol, 30123b3eb3cSopenharmony_ci suffixSymbolOptions: options.suffixSymbolOptions, 30223b3eb3cSopenharmony_ci allowClose: options.allowClose, 30323b3eb3cSopenharmony_ci closeOptions: options.closeOptions, 30423b3eb3cSopenharmony_ci chipEnabled: options.enabled, 30523b3eb3cSopenharmony_ci chipActivated: options.activated, 30623b3eb3cSopenharmony_ci chipNodeBackgroundColor: options.backgroundColor, 30723b3eb3cSopenharmony_ci chipNodeActivatedBackgroundColor: 30823b3eb3cSopenharmony_ci options.activatedBackgroundColor, 30923b3eb3cSopenharmony_ci chipNodeRadius: options.borderRadius, 31023b3eb3cSopenharmony_ci chipDirection: options.direction, 31123b3eb3cSopenharmony_ci chipAccessibilitySelectedType: options.accessibilitySelectedType, 31223b3eb3cSopenharmony_ci chipAccessibilityDescription: options.accessibilityDescription, 31323b3eb3cSopenharmony_ci chipAccessibilityLevel: options.accessibilityLevel, 31423b3eb3cSopenharmony_ci onClose: options.onClose, 31523b3eb3cSopenharmony_ci onClicked: options.onClicked, 31623b3eb3cSopenharmony_ci }; 31723b3eb3cSopenharmony_ci }; 31823b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 31923b3eb3cSopenharmony_ci } else { 32023b3eb3cSopenharmony_ci (parent ? parent : this).updateStateVarsOfChildByElmtId(elmtId, { 32123b3eb3cSopenharmony_ci chipSize: options.size, 32223b3eb3cSopenharmony_ci prefixIcon: options.prefixIcon, 32323b3eb3cSopenharmony_ci prefixSymbol: options.prefixSymbol, 32423b3eb3cSopenharmony_ci label: options.label, 32523b3eb3cSopenharmony_ci suffixIcon: options.suffixIcon, 32623b3eb3cSopenharmony_ci suffixSymbol: options.suffixSymbol, 32723b3eb3cSopenharmony_ci suffixSymbolOptions: options.suffixSymbolOptions, 32823b3eb3cSopenharmony_ci allowClose: options.allowClose, 32923b3eb3cSopenharmony_ci closeOptions: options.closeOptions, 33023b3eb3cSopenharmony_ci chipEnabled: options.enabled, 33123b3eb3cSopenharmony_ci chipActivated: options.activated, 33223b3eb3cSopenharmony_ci chipNodeBackgroundColor: options.backgroundColor, 33323b3eb3cSopenharmony_ci chipNodeActivatedBackgroundColor: options.activatedBackgroundColor, 33423b3eb3cSopenharmony_ci chipNodeRadius: options.borderRadius, 33523b3eb3cSopenharmony_ci chipDirection: options.direction, 33623b3eb3cSopenharmony_ci chipAccessibilitySelectedType: options.accessibilitySelectedType, 33723b3eb3cSopenharmony_ci chipAccessibilityDescription: options.accessibilityDescription, 33823b3eb3cSopenharmony_ci chipAccessibilityLevel: options.accessibilityLevel, 33923b3eb3cSopenharmony_ci }); 34023b3eb3cSopenharmony_ci } 34123b3eb3cSopenharmony_ci }, 34223b3eb3cSopenharmony_ci { name: 'ChipComponent' } 34323b3eb3cSopenharmony_ci ); 34423b3eb3cSopenharmony_ci } 34523b3eb3cSopenharmony_ci} 34623b3eb3cSopenharmony_cifunction i(dimension, t1) { 34723b3eb3cSopenharmony_ci const matches = dimension.match(t1); 34823b3eb3cSopenharmony_ci if (!matches || matches.length < 3) { 34923b3eb3cSopenharmony_ci return false; 35023b3eb3cSopenharmony_ci } 35123b3eb3cSopenharmony_ci const value = Number.parseFloat(matches[1]); 35223b3eb3cSopenharmony_ci return value >= 0; 35323b3eb3cSopenharmony_ci} 35423b3eb3cSopenharmony_cifunction j(dimension) { 35523b3eb3cSopenharmony_ci return i( 35623b3eb3cSopenharmony_ci dimension, 35723b3eb3cSopenharmony_ci new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i') 35823b3eb3cSopenharmony_ci ); 35923b3eb3cSopenharmony_ci} 36023b3eb3cSopenharmony_cifunction m(context, value) { 36123b3eb3cSopenharmony_ci const resourceManager = context?.resourceManager; 36223b3eb3cSopenharmony_ci if (value === void 0 || value === null || resourceManager === void 0) { 36323b3eb3cSopenharmony_ci return false; 36423b3eb3cSopenharmony_ci } 36523b3eb3cSopenharmony_ci if (value.type !== o && value.type !== u && value.type !== t) { 36623b3eb3cSopenharmony_ci return false; 36723b3eb3cSopenharmony_ci } 36823b3eb3cSopenharmony_ci if (value.type === u || value.type === t) { 36923b3eb3cSopenharmony_ci if (resourceManager.getNumber(value.id) >= 0) { 37023b3eb3cSopenharmony_ci return true; 37123b3eb3cSopenharmony_ci } else { 37223b3eb3cSopenharmony_ci return false; 37323b3eb3cSopenharmony_ci } 37423b3eb3cSopenharmony_ci } 37523b3eb3cSopenharmony_ci if (value.type === o && !j(resourceManager.getStringSync(value.id))) { 37623b3eb3cSopenharmony_ci return false; 37723b3eb3cSopenharmony_ci } else { 37823b3eb3cSopenharmony_ci return true; 37923b3eb3cSopenharmony_ci } 38023b3eb3cSopenharmony_ci} 38123b3eb3cSopenharmony_ciexport class d1 extends ViewPU { 38223b3eb3cSopenharmony_ci constructor( 38323b3eb3cSopenharmony_ci parent, 38423b3eb3cSopenharmony_ci params, 38523b3eb3cSopenharmony_ci __localStorage, 38623b3eb3cSopenharmony_ci elmtId = -1, 38723b3eb3cSopenharmony_ci paramsLambda = undefined, 38823b3eb3cSopenharmony_ci extraInfo 38923b3eb3cSopenharmony_ci ) { 39023b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 39123b3eb3cSopenharmony_ci if (typeof paramsLambda === 'function') { 39223b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 39323b3eb3cSopenharmony_ci } 39423b3eb3cSopenharmony_ci this.theme = b1; 39523b3eb3cSopenharmony_ci this.n2 = new SynchedPropertyObjectOneWayPU( 39623b3eb3cSopenharmony_ci params.chipSize, 39723b3eb3cSopenharmony_ci this, 39823b3eb3cSopenharmony_ci 'chipSize' 39923b3eb3cSopenharmony_ci ); 40023b3eb3cSopenharmony_ci this.o2 = new SynchedPropertySimpleOneWayPU( 40123b3eb3cSopenharmony_ci params.allowClose, 40223b3eb3cSopenharmony_ci this, 40323b3eb3cSopenharmony_ci 'allowClose' 40423b3eb3cSopenharmony_ci ); 40523b3eb3cSopenharmony_ci this.q2 = new SynchedPropertyObjectOneWayPU( 40623b3eb3cSopenharmony_ci params.closeOptions, 40723b3eb3cSopenharmony_ci this, 40823b3eb3cSopenharmony_ci 'closeOptions' 40923b3eb3cSopenharmony_ci ); 41023b3eb3cSopenharmony_ci this.s2 = new SynchedPropertySimpleOneWayPU( 41123b3eb3cSopenharmony_ci params.chipDirection, 41223b3eb3cSopenharmony_ci this, 41323b3eb3cSopenharmony_ci 'chipDirection' 41423b3eb3cSopenharmony_ci ); 41523b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectOneWayPU( 41623b3eb3cSopenharmony_ci params.prefixIcon, 41723b3eb3cSopenharmony_ci this, 41823b3eb3cSopenharmony_ci 'prefixIcon' 41923b3eb3cSopenharmony_ci ); 42023b3eb3cSopenharmony_ci this.u2 = new SynchedPropertyObjectOneWayPU( 42123b3eb3cSopenharmony_ci params.prefixSymbol, 42223b3eb3cSopenharmony_ci this, 42323b3eb3cSopenharmony_ci 'prefixSymbol' 42423b3eb3cSopenharmony_ci ); 42523b3eb3cSopenharmony_ci this.v2 = new SynchedPropertyObjectOneWayPU(params.label, this, 'label'); 42623b3eb3cSopenharmony_ci this.w2 = new SynchedPropertyObjectOneWayPU( 42723b3eb3cSopenharmony_ci params.suffixIcon, 42823b3eb3cSopenharmony_ci this, 42923b3eb3cSopenharmony_ci 'suffixIcon' 43023b3eb3cSopenharmony_ci ); 43123b3eb3cSopenharmony_ci this.z2 = new SynchedPropertyObjectOneWayPU( 43223b3eb3cSopenharmony_ci params.suffixSymbol, 43323b3eb3cSopenharmony_ci this, 43423b3eb3cSopenharmony_ci 'suffixSymbol' 43523b3eb3cSopenharmony_ci ); 43623b3eb3cSopenharmony_ci this.a3 = new SynchedPropertyObjectOneWayPU( 43723b3eb3cSopenharmony_ci params.suffixSymbolOptions, 43823b3eb3cSopenharmony_ci this, 43923b3eb3cSopenharmony_ci 'suffixSymbolOptions' 44023b3eb3cSopenharmony_ci ); 44123b3eb3cSopenharmony_ci this.b3 = new SynchedPropertyObjectOneWayPU( 44223b3eb3cSopenharmony_ci params.chipNodeBackgroundColor, 44323b3eb3cSopenharmony_ci this, 44423b3eb3cSopenharmony_ci 'chipNodeBackgroundColor' 44523b3eb3cSopenharmony_ci ); 44623b3eb3cSopenharmony_ci this.c3 = new SynchedPropertyObjectOneWayPU( 44723b3eb3cSopenharmony_ci params.chipNodeActivatedBackgroundColor, 44823b3eb3cSopenharmony_ci this, 44923b3eb3cSopenharmony_ci 'chipNodeActivatedBackgroundColor' 45023b3eb3cSopenharmony_ci ); 45123b3eb3cSopenharmony_ci this.d3 = new SynchedPropertyObjectOneWayPU( 45223b3eb3cSopenharmony_ci params.chipNodeRadius, 45323b3eb3cSopenharmony_ci this, 45423b3eb3cSopenharmony_ci 'chipNodeRadius' 45523b3eb3cSopenharmony_ci ); 45623b3eb3cSopenharmony_ci this.e3 = new SynchedPropertySimpleOneWayPU( 45723b3eb3cSopenharmony_ci params.chipEnabled, 45823b3eb3cSopenharmony_ci this, 45923b3eb3cSopenharmony_ci 'chipEnabled' 46023b3eb3cSopenharmony_ci ); 46123b3eb3cSopenharmony_ci this.f3 = new SynchedPropertySimpleOneWayPU( 46223b3eb3cSopenharmony_ci params.chipActivated, 46323b3eb3cSopenharmony_ci this, 46423b3eb3cSopenharmony_ci 'chipActivated' 46523b3eb3cSopenharmony_ci ); 46623b3eb3cSopenharmony_ci this.g3 = new SynchedPropertySimpleOneWayPU( 46723b3eb3cSopenharmony_ci params.chipAccessibilitySelectedType, 46823b3eb3cSopenharmony_ci this, 46923b3eb3cSopenharmony_ci 'chipAccessibilitySelectedType' 47023b3eb3cSopenharmony_ci ); 47123b3eb3cSopenharmony_ci this.h3 = new SynchedPropertyObjectOneWayPU( 47223b3eb3cSopenharmony_ci params.chipAccessibilityDescription, 47323b3eb3cSopenharmony_ci this, 47423b3eb3cSopenharmony_ci 'chipAccessibilityDescription' 47523b3eb3cSopenharmony_ci ); 47623b3eb3cSopenharmony_ci this.i3 = new SynchedPropertySimpleOneWayPU( 47723b3eb3cSopenharmony_ci params.chipAccessibilityLevel, 47823b3eb3cSopenharmony_ci this, 47923b3eb3cSopenharmony_ci 'chipAccessibilityLevel' 48023b3eb3cSopenharmony_ci ); 48123b3eb3cSopenharmony_ci this.j3 = new ObservedPropertySimplePU(false, this, 'isHover'); 48223b3eb3cSopenharmony_ci this.l3 = new ObservedPropertyObjectPU({ x: 1, y: 1 }, this, 'chipScale'); 48323b3eb3cSopenharmony_ci this.m3 = new ObservedPropertySimplePU(1, this, 'chipOpacity'); 48423b3eb3cSopenharmony_ci this.n3 = new ObservedPropertyObjectPU( 48523b3eb3cSopenharmony_ci Color.Transparent, 48623b3eb3cSopenharmony_ci this, 48723b3eb3cSopenharmony_ci 'chipBlendColor' 48823b3eb3cSopenharmony_ci ); 48923b3eb3cSopenharmony_ci this.q3 = new ObservedPropertySimplePU(false, this, 'deleteChip'); 49023b3eb3cSopenharmony_ci this.r3 = new ObservedPropertySimplePU(false, this, 'chipNodeOnFocus'); 49123b3eb3cSopenharmony_ci this.s3 = new ObservedPropertySimplePU(false, this, 'useDefaultSuffixIcon'); 49223b3eb3cSopenharmony_ci this.chipNodeSize = {}; 49323b3eb3cSopenharmony_ci this.onClose = c1; 49423b3eb3cSopenharmony_ci this.onClicked = c1; 49523b3eb3cSopenharmony_ci this.t3 = new ObservedPropertySimplePU(false, this, 'suffixIconOnFocus'); 49623b3eb3cSopenharmony_ci this.u3 = new ObservedPropertySimplePU(a1.SM, this, 'chipBreakPoints'); 49723b3eb3cSopenharmony_ci this.smListener = mediaquery.matchMediaSync( 49823b3eb3cSopenharmony_ci '(0vp<width) and (width<600vp)' 49923b3eb3cSopenharmony_ci ); 50023b3eb3cSopenharmony_ci this.mdListener = mediaquery.matchMediaSync( 50123b3eb3cSopenharmony_ci '(600vp<=width) and (width<840vp)' 50223b3eb3cSopenharmony_ci ); 50323b3eb3cSopenharmony_ci this.lgListener = mediaquery.matchMediaSync('(840vp<=width)'); 50423b3eb3cSopenharmony_ci this.v3 = new ObservedPropertySimplePU( 50523b3eb3cSopenharmony_ci false, 50623b3eb3cSopenharmony_ci this, 50723b3eb3cSopenharmony_ci 'isShowPressedBackGroundColor' 50823b3eb3cSopenharmony_ci ); 50923b3eb3cSopenharmony_ci this.w3 = new ObservedPropertyObjectPU(0, this, 'fontSizeScale'); 51023b3eb3cSopenharmony_ci this.x3 = new ObservedPropertyObjectPU(0, this, 'fontWeightScale'); 51123b3eb3cSopenharmony_ci this.callbacks = { 51223b3eb3cSopenharmony_ci onConfigurationUpdated: (configuration) => { 51323b3eb3cSopenharmony_ci this.fontSizeScale = configuration.fontSizeScale; 51423b3eb3cSopenharmony_ci this.fontWeightScale = configuration.fontWeightScale; 51523b3eb3cSopenharmony_ci this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false; 51623b3eb3cSopenharmony_ci }, 51723b3eb3cSopenharmony_ci onMemoryLevel() {}, 51823b3eb3cSopenharmony_ci }; 51923b3eb3cSopenharmony_ci this.callbackId = undefined; 52023b3eb3cSopenharmony_ci this.y3 = new ObservedPropertyObjectPU( 52123b3eb3cSopenharmony_ci this.toVp( 52223b3eb3cSopenharmony_ci componentUtils.getRectangleById('PrefixSymbolGlyph')?.size?.width 52323b3eb3cSopenharmony_ci ), 52423b3eb3cSopenharmony_ci this, 52523b3eb3cSopenharmony_ci 'prefixSymbolWidth' 52623b3eb3cSopenharmony_ci ); 52723b3eb3cSopenharmony_ci this.z3 = new ObservedPropertyObjectPU( 52823b3eb3cSopenharmony_ci this.toVp( 52923b3eb3cSopenharmony_ci componentUtils.getRectangleById('SuffixSymbolGlyph')?.size?.width 53023b3eb3cSopenharmony_ci ), 53123b3eb3cSopenharmony_ci this, 53223b3eb3cSopenharmony_ci 'suffixSymbolWidth' 53323b3eb3cSopenharmony_ci ); 53423b3eb3cSopenharmony_ci this.a4 = new ObservedPropertyObjectPU( 53523b3eb3cSopenharmony_ci this.toVp( 53623b3eb3cSopenharmony_ci componentUtils.getRectangleById('AllowCloseSymbolGlyph')?.size?.width 53723b3eb3cSopenharmony_ci ), 53823b3eb3cSopenharmony_ci this, 53923b3eb3cSopenharmony_ci 'allowCloseSymbolWidth' 54023b3eb3cSopenharmony_ci ); 54123b3eb3cSopenharmony_ci this.b4 = new ObservedPropertyObjectPU( 54223b3eb3cSopenharmony_ci new SymbolEffect(), 54323b3eb3cSopenharmony_ci this, 54423b3eb3cSopenharmony_ci 'symbolEffect' 54523b3eb3cSopenharmony_ci ); 54623b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 54723b3eb3cSopenharmony_ci this.finalizeConstruction(); 54823b3eb3cSopenharmony_ci this.c4 = new ObservedPropertySimplePU(false, this, "isClipable"); 54923b3eb3cSopenharmony_ci } 55023b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 55123b3eb3cSopenharmony_ci if (params.theme !== undefined) { 55223b3eb3cSopenharmony_ci this.theme = params.theme; 55323b3eb3cSopenharmony_ci } 55423b3eb3cSopenharmony_ci if (params.chipSize === undefined) { 55523b3eb3cSopenharmony_ci this.n2.set(ChipSize.NORMAL); 55623b3eb3cSopenharmony_ci } 55723b3eb3cSopenharmony_ci if (params.allowClose === undefined) { 55823b3eb3cSopenharmony_ci this.o2.set(true); 55923b3eb3cSopenharmony_ci } 56023b3eb3cSopenharmony_ci if (params.chipDirection === undefined) { 56123b3eb3cSopenharmony_ci this.s2.set(Direction.Auto); 56223b3eb3cSopenharmony_ci } 56323b3eb3cSopenharmony_ci if (params.prefixIcon === undefined) { 56423b3eb3cSopenharmony_ci this.t2.set({ src: '' }); 56523b3eb3cSopenharmony_ci } 56623b3eb3cSopenharmony_ci if (params.label === undefined) { 56723b3eb3cSopenharmony_ci this.v2.set({ text: '' }); 56823b3eb3cSopenharmony_ci } 56923b3eb3cSopenharmony_ci if (params.suffixIcon === undefined) { 57023b3eb3cSopenharmony_ci this.w2.set({ src: '' }); 57123b3eb3cSopenharmony_ci } 57223b3eb3cSopenharmony_ci if (params.chipNodeBackgroundColor === undefined) { 57323b3eb3cSopenharmony_ci this.b3.set(this.theme.q1.backgroundColor); 57423b3eb3cSopenharmony_ci } 57523b3eb3cSopenharmony_ci if (params.chipNodeActivatedBackgroundColor === undefined) { 57623b3eb3cSopenharmony_ci this.c3.set(this.theme.q1.activatedBackgroundColor); 57723b3eb3cSopenharmony_ci } 57823b3eb3cSopenharmony_ci if (params.chipNodeRadius === undefined) { 57923b3eb3cSopenharmony_ci this.d3.set(void 0); 58023b3eb3cSopenharmony_ci } 58123b3eb3cSopenharmony_ci if (params.chipEnabled === undefined) { 58223b3eb3cSopenharmony_ci this.e3.set(true); 58323b3eb3cSopenharmony_ci } 58423b3eb3cSopenharmony_ci if (params.isHover !== undefined) { 58523b3eb3cSopenharmony_ci this.isHover = params.isHover; 58623b3eb3cSopenharmony_ci } 58723b3eb3cSopenharmony_ci if (params.chipScale !== undefined) { 58823b3eb3cSopenharmony_ci this.chipScale = params.chipScale; 58923b3eb3cSopenharmony_ci } 59023b3eb3cSopenharmony_ci if (params.chipOpacity !== undefined) { 59123b3eb3cSopenharmony_ci this.chipOpacity = params.chipOpacity; 59223b3eb3cSopenharmony_ci } 59323b3eb3cSopenharmony_ci if (params.chipBlendColor !== undefined) { 59423b3eb3cSopenharmony_ci this.chipBlendColor = params.chipBlendColor; 59523b3eb3cSopenharmony_ci } 59623b3eb3cSopenharmony_ci if (params.deleteChip !== undefined) { 59723b3eb3cSopenharmony_ci this.deleteChip = params.deleteChip; 59823b3eb3cSopenharmony_ci } 59923b3eb3cSopenharmony_ci if (params.chipNodeOnFocus !== undefined) { 60023b3eb3cSopenharmony_ci this.chipNodeOnFocus = params.chipNodeOnFocus; 60123b3eb3cSopenharmony_ci } 60223b3eb3cSopenharmony_ci if (params.useDefaultSuffixIcon !== undefined) { 60323b3eb3cSopenharmony_ci this.useDefaultSuffixIcon = params.useDefaultSuffixIcon; 60423b3eb3cSopenharmony_ci } 60523b3eb3cSopenharmony_ci if (params.chipNodeSize !== undefined) { 60623b3eb3cSopenharmony_ci this.chipNodeSize = params.chipNodeSize; 60723b3eb3cSopenharmony_ci } 60823b3eb3cSopenharmony_ci if (params.onClose !== undefined) { 60923b3eb3cSopenharmony_ci this.onClose = params.onClose; 61023b3eb3cSopenharmony_ci } 61123b3eb3cSopenharmony_ci if (params.onClicked !== undefined) { 61223b3eb3cSopenharmony_ci this.onClicked = params.onClicked; 61323b3eb3cSopenharmony_ci } 61423b3eb3cSopenharmony_ci if (params.suffixIconOnFocus !== undefined) { 61523b3eb3cSopenharmony_ci this.suffixIconOnFocus = params.suffixIconOnFocus; 61623b3eb3cSopenharmony_ci } 61723b3eb3cSopenharmony_ci if (params.chipBreakPoints !== undefined) { 61823b3eb3cSopenharmony_ci this.chipBreakPoints = params.chipBreakPoints; 61923b3eb3cSopenharmony_ci } 62023b3eb3cSopenharmony_ci if (params.smListener !== undefined) { 62123b3eb3cSopenharmony_ci this.smListener = params.smListener; 62223b3eb3cSopenharmony_ci } 62323b3eb3cSopenharmony_ci if (params.mdListener !== undefined) { 62423b3eb3cSopenharmony_ci this.mdListener = params.mdListener; 62523b3eb3cSopenharmony_ci } 62623b3eb3cSopenharmony_ci if (params.lgListener !== undefined) { 62723b3eb3cSopenharmony_ci this.lgListener = params.lgListener; 62823b3eb3cSopenharmony_ci } 62923b3eb3cSopenharmony_ci if (params.isShowPressedBackGroundColor !== undefined) { 63023b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = params.isShowPressedBackGroundColor; 63123b3eb3cSopenharmony_ci } 63223b3eb3cSopenharmony_ci if (params.fontSizeScale !== undefined) { 63323b3eb3cSopenharmony_ci this.fontSizeScale = params.fontSizeScale; 63423b3eb3cSopenharmony_ci } 63523b3eb3cSopenharmony_ci if (params.fontWeightScale !== undefined) { 63623b3eb3cSopenharmony_ci this.fontWeightScale = params.fontWeightScale; 63723b3eb3cSopenharmony_ci } 63823b3eb3cSopenharmony_ci if (params.callbacks !== undefined) { 63923b3eb3cSopenharmony_ci this.callbacks = params.callbacks; 64023b3eb3cSopenharmony_ci } 64123b3eb3cSopenharmony_ci if (params.callbackId !== undefined) { 64223b3eb3cSopenharmony_ci this.callbackId = params.callbackId; 64323b3eb3cSopenharmony_ci } 64423b3eb3cSopenharmony_ci if (params.prefixSymbolWidth !== undefined) { 64523b3eb3cSopenharmony_ci this.prefixSymbolWidth = params.prefixSymbolWidth; 64623b3eb3cSopenharmony_ci } 64723b3eb3cSopenharmony_ci if (params.suffixSymbolWidth !== undefined) { 64823b3eb3cSopenharmony_ci this.suffixSymbolWidth = params.suffixSymbolWidth; 64923b3eb3cSopenharmony_ci } 65023b3eb3cSopenharmony_ci if (params.allowCloseSymbolWidth !== undefined) { 65123b3eb3cSopenharmony_ci this.allowCloseSymbolWidth = params.allowCloseSymbolWidth; 65223b3eb3cSopenharmony_ci } 65323b3eb3cSopenharmony_ci if (params.symbolEffect !== undefined) { 65423b3eb3cSopenharmony_ci this.symbolEffect = params.symbolEffect; 65523b3eb3cSopenharmony_ci } 65623b3eb3cSopenharmony_ci if (params.isClipable !== undefined) { 65723b3eb3cSopenharmony_ci this.isClipable = params.isClipable; 65823b3eb3cSopenharmony_ci } 65923b3eb3cSopenharmony_ci } 66023b3eb3cSopenharmony_ci updateStateVars(params) { 66123b3eb3cSopenharmony_ci this.n2.reset(params.chipSize); 66223b3eb3cSopenharmony_ci this.o2.reset(params.allowClose); 66323b3eb3cSopenharmony_ci this.q2.reset(params.closeOptions); 66423b3eb3cSopenharmony_ci this.s2.reset(params.chipDirection); 66523b3eb3cSopenharmony_ci this.t2.reset(params.prefixIcon); 66623b3eb3cSopenharmony_ci this.u2.reset(params.prefixSymbol); 66723b3eb3cSopenharmony_ci this.v2.reset(params.label); 66823b3eb3cSopenharmony_ci this.w2.reset(params.suffixIcon); 66923b3eb3cSopenharmony_ci this.z2.reset(params.suffixSymbol); 67023b3eb3cSopenharmony_ci this.a3.reset(params.suffixSymbolOptions); 67123b3eb3cSopenharmony_ci this.b3.reset(params.chipNodeBackgroundColor); 67223b3eb3cSopenharmony_ci this.c3.reset(params.chipNodeActivatedBackgroundColor); 67323b3eb3cSopenharmony_ci this.d3.reset(params.chipNodeRadius); 67423b3eb3cSopenharmony_ci this.e3.reset(params.chipEnabled); 67523b3eb3cSopenharmony_ci this.f3.reset(params.chipActivated); 67623b3eb3cSopenharmony_ci this.g3.reset(params.chipAccessibilitySelectedType); 67723b3eb3cSopenharmony_ci this.h3.reset(params.chipAccessibilityDescription); 67823b3eb3cSopenharmony_ci this.i3.reset(params.chipAccessibilityLevel); 67923b3eb3cSopenharmony_ci } 68023b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 68123b3eb3cSopenharmony_ci this.n2.purgeDependencyOnElmtId(rmElmtId); 68223b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 68323b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 68423b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 68523b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 68623b3eb3cSopenharmony_ci this.u2.purgeDependencyOnElmtId(rmElmtId); 68723b3eb3cSopenharmony_ci this.v2.purgeDependencyOnElmtId(rmElmtId); 68823b3eb3cSopenharmony_ci this.w2.purgeDependencyOnElmtId(rmElmtId); 68923b3eb3cSopenharmony_ci this.z2.purgeDependencyOnElmtId(rmElmtId); 69023b3eb3cSopenharmony_ci this.a3.purgeDependencyOnElmtId(rmElmtId); 69123b3eb3cSopenharmony_ci this.b3.purgeDependencyOnElmtId(rmElmtId); 69223b3eb3cSopenharmony_ci this.c3.purgeDependencyOnElmtId(rmElmtId); 69323b3eb3cSopenharmony_ci this.d3.purgeDependencyOnElmtId(rmElmtId); 69423b3eb3cSopenharmony_ci this.e3.purgeDependencyOnElmtId(rmElmtId); 69523b3eb3cSopenharmony_ci this.f3.purgeDependencyOnElmtId(rmElmtId); 69623b3eb3cSopenharmony_ci this.g3.purgeDependencyOnElmtId(rmElmtId); 69723b3eb3cSopenharmony_ci this.h3.purgeDependencyOnElmtId(rmElmtId); 69823b3eb3cSopenharmony_ci this.i3.purgeDependencyOnElmtId(rmElmtId); 69923b3eb3cSopenharmony_ci this.j3.purgeDependencyOnElmtId(rmElmtId); 70023b3eb3cSopenharmony_ci this.l3.purgeDependencyOnElmtId(rmElmtId); 70123b3eb3cSopenharmony_ci this.m3.purgeDependencyOnElmtId(rmElmtId); 70223b3eb3cSopenharmony_ci this.n3.purgeDependencyOnElmtId(rmElmtId); 70323b3eb3cSopenharmony_ci this.q3.purgeDependencyOnElmtId(rmElmtId); 70423b3eb3cSopenharmony_ci this.r3.purgeDependencyOnElmtId(rmElmtId); 70523b3eb3cSopenharmony_ci this.s3.purgeDependencyOnElmtId(rmElmtId); 70623b3eb3cSopenharmony_ci this.t3.purgeDependencyOnElmtId(rmElmtId); 70723b3eb3cSopenharmony_ci this.u3.purgeDependencyOnElmtId(rmElmtId); 70823b3eb3cSopenharmony_ci this.v3.purgeDependencyOnElmtId(rmElmtId); 70923b3eb3cSopenharmony_ci this.w3.purgeDependencyOnElmtId(rmElmtId); 71023b3eb3cSopenharmony_ci this.x3.purgeDependencyOnElmtId(rmElmtId); 71123b3eb3cSopenharmony_ci this.y3.purgeDependencyOnElmtId(rmElmtId); 71223b3eb3cSopenharmony_ci this.z3.purgeDependencyOnElmtId(rmElmtId); 71323b3eb3cSopenharmony_ci this.a4.purgeDependencyOnElmtId(rmElmtId); 71423b3eb3cSopenharmony_ci this.b4.purgeDependencyOnElmtId(rmElmtId); 71523b3eb3cSopenharmony_ci this.c4.purgeDependencyOnElmtId(rmElmtId); 71623b3eb3cSopenharmony_ci } 71723b3eb3cSopenharmony_ci aboutToBeDeleted() { 71823b3eb3cSopenharmony_ci this.n2.aboutToBeDeleted(); 71923b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 72023b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 72123b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 72223b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 72323b3eb3cSopenharmony_ci this.u2.aboutToBeDeleted(); 72423b3eb3cSopenharmony_ci this.v2.aboutToBeDeleted(); 72523b3eb3cSopenharmony_ci this.w2.aboutToBeDeleted(); 72623b3eb3cSopenharmony_ci this.z2.aboutToBeDeleted(); 72723b3eb3cSopenharmony_ci this.a3.aboutToBeDeleted(); 72823b3eb3cSopenharmony_ci this.b3.aboutToBeDeleted(); 72923b3eb3cSopenharmony_ci this.c3.aboutToBeDeleted(); 73023b3eb3cSopenharmony_ci this.d3.aboutToBeDeleted(); 73123b3eb3cSopenharmony_ci this.e3.aboutToBeDeleted(); 73223b3eb3cSopenharmony_ci this.f3.aboutToBeDeleted(); 73323b3eb3cSopenharmony_ci this.g3.aboutToBeDeleted(); 73423b3eb3cSopenharmony_ci this.h3.aboutToBeDeleted(); 73523b3eb3cSopenharmony_ci this.i3.aboutToBeDeleted(); 73623b3eb3cSopenharmony_ci this.j3.aboutToBeDeleted(); 73723b3eb3cSopenharmony_ci this.l3.aboutToBeDeleted(); 73823b3eb3cSopenharmony_ci this.m3.aboutToBeDeleted(); 73923b3eb3cSopenharmony_ci this.n3.aboutToBeDeleted(); 74023b3eb3cSopenharmony_ci this.q3.aboutToBeDeleted(); 74123b3eb3cSopenharmony_ci this.r3.aboutToBeDeleted(); 74223b3eb3cSopenharmony_ci this.s3.aboutToBeDeleted(); 74323b3eb3cSopenharmony_ci this.t3.aboutToBeDeleted(); 74423b3eb3cSopenharmony_ci this.u3.aboutToBeDeleted(); 74523b3eb3cSopenharmony_ci this.v3.aboutToBeDeleted(); 74623b3eb3cSopenharmony_ci this.w3.aboutToBeDeleted(); 74723b3eb3cSopenharmony_ci this.x3.aboutToBeDeleted(); 74823b3eb3cSopenharmony_ci this.y3.aboutToBeDeleted(); 74923b3eb3cSopenharmony_ci this.z3.aboutToBeDeleted(); 75023b3eb3cSopenharmony_ci this.a4.aboutToBeDeleted(); 75123b3eb3cSopenharmony_ci this.b4.aboutToBeDeleted(); 75223b3eb3cSopenharmony_ci this.c4.aboutToBeDeleted(); 75323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 75423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 75523b3eb3cSopenharmony_ci } 75623b3eb3cSopenharmony_ci get chipSize() { 75723b3eb3cSopenharmony_ci return this.n2.get(); 75823b3eb3cSopenharmony_ci } 75923b3eb3cSopenharmony_ci set chipSize(newValue) { 76023b3eb3cSopenharmony_ci this.n2.set(newValue); 76123b3eb3cSopenharmony_ci } 76223b3eb3cSopenharmony_ci get allowClose() { 76323b3eb3cSopenharmony_ci return this.o2.get(); 76423b3eb3cSopenharmony_ci } 76523b3eb3cSopenharmony_ci set allowClose(newValue) { 76623b3eb3cSopenharmony_ci this.o2.set(newValue); 76723b3eb3cSopenharmony_ci } 76823b3eb3cSopenharmony_ci get closeOptions() { 76923b3eb3cSopenharmony_ci return this.q2.get(); 77023b3eb3cSopenharmony_ci } 77123b3eb3cSopenharmony_ci set closeOptions(newValue) { 77223b3eb3cSopenharmony_ci this.q2.set(newValue); 77323b3eb3cSopenharmony_ci } 77423b3eb3cSopenharmony_ci get chipDirection() { 77523b3eb3cSopenharmony_ci return this.s2.get(); 77623b3eb3cSopenharmony_ci } 77723b3eb3cSopenharmony_ci set chipDirection(newValue) { 77823b3eb3cSopenharmony_ci this.s2.set(newValue); 77923b3eb3cSopenharmony_ci } 78023b3eb3cSopenharmony_ci get prefixIcon() { 78123b3eb3cSopenharmony_ci return this.t2.get(); 78223b3eb3cSopenharmony_ci } 78323b3eb3cSopenharmony_ci set prefixIcon(newValue) { 78423b3eb3cSopenharmony_ci this.t2.set(newValue); 78523b3eb3cSopenharmony_ci } 78623b3eb3cSopenharmony_ci get prefixSymbol() { 78723b3eb3cSopenharmony_ci return this.u2.get(); 78823b3eb3cSopenharmony_ci } 78923b3eb3cSopenharmony_ci set prefixSymbol(newValue) { 79023b3eb3cSopenharmony_ci this.u2.set(newValue); 79123b3eb3cSopenharmony_ci } 79223b3eb3cSopenharmony_ci get label() { 79323b3eb3cSopenharmony_ci return this.v2.get(); 79423b3eb3cSopenharmony_ci } 79523b3eb3cSopenharmony_ci set label(newValue) { 79623b3eb3cSopenharmony_ci this.v2.set(newValue); 79723b3eb3cSopenharmony_ci } 79823b3eb3cSopenharmony_ci get suffixIcon() { 79923b3eb3cSopenharmony_ci return this.w2.get(); 80023b3eb3cSopenharmony_ci } 80123b3eb3cSopenharmony_ci set suffixIcon(newValue) { 80223b3eb3cSopenharmony_ci this.w2.set(newValue); 80323b3eb3cSopenharmony_ci } 80423b3eb3cSopenharmony_ci get suffixSymbol() { 80523b3eb3cSopenharmony_ci return this.z2.get(); 80623b3eb3cSopenharmony_ci } 80723b3eb3cSopenharmony_ci set suffixSymbol(newValue) { 80823b3eb3cSopenharmony_ci this.z2.set(newValue); 80923b3eb3cSopenharmony_ci } 81023b3eb3cSopenharmony_ci get suffixSymbolOptions() { 81123b3eb3cSopenharmony_ci return this.a3.get(); 81223b3eb3cSopenharmony_ci } 81323b3eb3cSopenharmony_ci set suffixSymbolOptions(newValue) { 81423b3eb3cSopenharmony_ci this.a3.set(newValue); 81523b3eb3cSopenharmony_ci } 81623b3eb3cSopenharmony_ci get chipNodeBackgroundColor() { 81723b3eb3cSopenharmony_ci return this.b3.get(); 81823b3eb3cSopenharmony_ci } 81923b3eb3cSopenharmony_ci set chipNodeBackgroundColor(newValue) { 82023b3eb3cSopenharmony_ci this.b3.set(newValue); 82123b3eb3cSopenharmony_ci } 82223b3eb3cSopenharmony_ci get chipNodeActivatedBackgroundColor() { 82323b3eb3cSopenharmony_ci return this.c3.get(); 82423b3eb3cSopenharmony_ci } 82523b3eb3cSopenharmony_ci set chipNodeActivatedBackgroundColor(newValue) { 82623b3eb3cSopenharmony_ci this.c3.set(newValue); 82723b3eb3cSopenharmony_ci } 82823b3eb3cSopenharmony_ci get chipNodeRadius() { 82923b3eb3cSopenharmony_ci return this.d3.get(); 83023b3eb3cSopenharmony_ci } 83123b3eb3cSopenharmony_ci set chipNodeRadius(newValue) { 83223b3eb3cSopenharmony_ci this.d3.set(newValue); 83323b3eb3cSopenharmony_ci } 83423b3eb3cSopenharmony_ci get chipEnabled() { 83523b3eb3cSopenharmony_ci return this.e3.get(); 83623b3eb3cSopenharmony_ci } 83723b3eb3cSopenharmony_ci set chipEnabled(newValue) { 83823b3eb3cSopenharmony_ci this.e3.set(newValue); 83923b3eb3cSopenharmony_ci } 84023b3eb3cSopenharmony_ci get chipActivated() { 84123b3eb3cSopenharmony_ci return this.f3.get(); 84223b3eb3cSopenharmony_ci } 84323b3eb3cSopenharmony_ci set chipActivated(newValue) { 84423b3eb3cSopenharmony_ci this.f3.set(newValue); 84523b3eb3cSopenharmony_ci } 84623b3eb3cSopenharmony_ci get chipAccessibilitySelectedType() { 84723b3eb3cSopenharmony_ci return this.g3.get(); 84823b3eb3cSopenharmony_ci } 84923b3eb3cSopenharmony_ci set chipAccessibilitySelectedType(newValue) { 85023b3eb3cSopenharmony_ci this.g3.set(newValue); 85123b3eb3cSopenharmony_ci } 85223b3eb3cSopenharmony_ci get chipAccessibilityDescription() { 85323b3eb3cSopenharmony_ci return this.h3.get(); 85423b3eb3cSopenharmony_ci } 85523b3eb3cSopenharmony_ci set chipAccessibilityDescription(newValue) { 85623b3eb3cSopenharmony_ci this.h3.set(newValue); 85723b3eb3cSopenharmony_ci } 85823b3eb3cSopenharmony_ci get chipAccessibilityLevel() { 85923b3eb3cSopenharmony_ci return this.i3.get(); 86023b3eb3cSopenharmony_ci } 86123b3eb3cSopenharmony_ci set chipAccessibilityLevel(newValue) { 86223b3eb3cSopenharmony_ci this.i3.set(newValue); 86323b3eb3cSopenharmony_ci } 86423b3eb3cSopenharmony_ci get isHover() { 86523b3eb3cSopenharmony_ci return this.j3.get(); 86623b3eb3cSopenharmony_ci } 86723b3eb3cSopenharmony_ci set isHover(newValue) { 86823b3eb3cSopenharmony_ci this.j3.set(newValue); 86923b3eb3cSopenharmony_ci } 87023b3eb3cSopenharmony_ci get chipScale() { 87123b3eb3cSopenharmony_ci return this.l3.get(); 87223b3eb3cSopenharmony_ci } 87323b3eb3cSopenharmony_ci set chipScale(newValue) { 87423b3eb3cSopenharmony_ci this.l3.set(newValue); 87523b3eb3cSopenharmony_ci } 87623b3eb3cSopenharmony_ci get chipOpacity() { 87723b3eb3cSopenharmony_ci return this.m3.get(); 87823b3eb3cSopenharmony_ci } 87923b3eb3cSopenharmony_ci set chipOpacity(newValue) { 88023b3eb3cSopenharmony_ci this.m3.set(newValue); 88123b3eb3cSopenharmony_ci } 88223b3eb3cSopenharmony_ci get chipBlendColor() { 88323b3eb3cSopenharmony_ci return this.n3.get(); 88423b3eb3cSopenharmony_ci } 88523b3eb3cSopenharmony_ci set chipBlendColor(newValue) { 88623b3eb3cSopenharmony_ci this.n3.set(newValue); 88723b3eb3cSopenharmony_ci } 88823b3eb3cSopenharmony_ci get deleteChip() { 88923b3eb3cSopenharmony_ci return this.q3.get(); 89023b3eb3cSopenharmony_ci } 89123b3eb3cSopenharmony_ci set deleteChip(newValue) { 89223b3eb3cSopenharmony_ci this.q3.set(newValue); 89323b3eb3cSopenharmony_ci } 89423b3eb3cSopenharmony_ci get chipNodeOnFocus() { 89523b3eb3cSopenharmony_ci return this.r3.get(); 89623b3eb3cSopenharmony_ci } 89723b3eb3cSopenharmony_ci set chipNodeOnFocus(newValue) { 89823b3eb3cSopenharmony_ci this.r3.set(newValue); 89923b3eb3cSopenharmony_ci } 90023b3eb3cSopenharmony_ci get useDefaultSuffixIcon() { 90123b3eb3cSopenharmony_ci return this.s3.get(); 90223b3eb3cSopenharmony_ci } 90323b3eb3cSopenharmony_ci set useDefaultSuffixIcon(newValue) { 90423b3eb3cSopenharmony_ci this.s3.set(newValue); 90523b3eb3cSopenharmony_ci } 90623b3eb3cSopenharmony_ci get suffixIconOnFocus() { 90723b3eb3cSopenharmony_ci return this.t3.get(); 90823b3eb3cSopenharmony_ci } 90923b3eb3cSopenharmony_ci set suffixIconOnFocus(newValue) { 91023b3eb3cSopenharmony_ci this.t3.set(newValue); 91123b3eb3cSopenharmony_ci } 91223b3eb3cSopenharmony_ci get chipBreakPoints() { 91323b3eb3cSopenharmony_ci return this.u3.get(); 91423b3eb3cSopenharmony_ci } 91523b3eb3cSopenharmony_ci set chipBreakPoints(newValue) { 91623b3eb3cSopenharmony_ci this.u3.set(newValue); 91723b3eb3cSopenharmony_ci } 91823b3eb3cSopenharmony_ci get isShowPressedBackGroundColor() { 91923b3eb3cSopenharmony_ci return this.v3.get(); 92023b3eb3cSopenharmony_ci } 92123b3eb3cSopenharmony_ci set isShowPressedBackGroundColor(newValue) { 92223b3eb3cSopenharmony_ci this.v3.set(newValue); 92323b3eb3cSopenharmony_ci } 92423b3eb3cSopenharmony_ci get fontSizeScale() { 92523b3eb3cSopenharmony_ci return this.w3.get(); 92623b3eb3cSopenharmony_ci } 92723b3eb3cSopenharmony_ci set fontSizeScale(newValue) { 92823b3eb3cSopenharmony_ci this.w3.set(newValue); 92923b3eb3cSopenharmony_ci } 93023b3eb3cSopenharmony_ci get fontWeightScale() { 93123b3eb3cSopenharmony_ci return this.x3.get(); 93223b3eb3cSopenharmony_ci } 93323b3eb3cSopenharmony_ci set fontWeightScale(newValue) { 93423b3eb3cSopenharmony_ci this.x3.set(newValue); 93523b3eb3cSopenharmony_ci } 93623b3eb3cSopenharmony_ci get prefixSymbolWidth() { 93723b3eb3cSopenharmony_ci return this.y3.get(); 93823b3eb3cSopenharmony_ci } 93923b3eb3cSopenharmony_ci set prefixSymbolWidth(newValue) { 94023b3eb3cSopenharmony_ci this.y3.set(newValue); 94123b3eb3cSopenharmony_ci } 94223b3eb3cSopenharmony_ci get suffixSymbolWidth() { 94323b3eb3cSopenharmony_ci return this.z3.get(); 94423b3eb3cSopenharmony_ci } 94523b3eb3cSopenharmony_ci set suffixSymbolWidth(newValue) { 94623b3eb3cSopenharmony_ci this.z3.set(newValue); 94723b3eb3cSopenharmony_ci } 94823b3eb3cSopenharmony_ci get allowCloseSymbolWidth() { 94923b3eb3cSopenharmony_ci return this.a4.get(); 95023b3eb3cSopenharmony_ci } 95123b3eb3cSopenharmony_ci set allowCloseSymbolWidth(newValue) { 95223b3eb3cSopenharmony_ci this.a4.set(newValue); 95323b3eb3cSopenharmony_ci } 95423b3eb3cSopenharmony_ci get symbolEffect() { 95523b3eb3cSopenharmony_ci return this.b4.get(); 95623b3eb3cSopenharmony_ci } 95723b3eb3cSopenharmony_ci set symbolEffect(newValue) { 95823b3eb3cSopenharmony_ci this.b4.set(newValue); 95923b3eb3cSopenharmony_ci } 96023b3eb3cSopenharmony_ci get isClipable() { 96123b3eb3cSopenharmony_ci return this.c4.get(); 96223b3eb3cSopenharmony_ci } 96323b3eb3cSopenharmony_ci set isClipable(newValue) { 96423b3eb3cSopenharmony_ci this.c4.set(newValue); 96523b3eb3cSopenharmony_ci } 96623b3eb3cSopenharmony_ci isChipSizeEnum() { 96723b3eb3cSopenharmony_ci return typeof this.chipSize === 'string'; 96823b3eb3cSopenharmony_ci } 96923b3eb3cSopenharmony_ci getLabelFontSize() { 97023b3eb3cSopenharmony_ci if ( 97123b3eb3cSopenharmony_ci this.label?.fontSize !== void 0 && 97223b3eb3cSopenharmony_ci this.toVp(this.label.fontSize) >= 0 97323b3eb3cSopenharmony_ci ) { 97423b3eb3cSopenharmony_ci return this.label.fontSize; 97523b3eb3cSopenharmony_ci } else { 97623b3eb3cSopenharmony_ci if (this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL) { 97723b3eb3cSopenharmony_ci try { 97823b3eb3cSopenharmony_ci resourceManager 97923b3eb3cSopenharmony_ci .getSystemResourceManager() 98023b3eb3cSopenharmony_ci .getNumberByName(this.theme.label.f1.params[0].split('.')[2]); 98123b3eb3cSopenharmony_ci return this.theme.label.f1; 98223b3eb3cSopenharmony_ci } catch (error) { 98323b3eb3cSopenharmony_ci return this.theme.label.defaultFontSize; 98423b3eb3cSopenharmony_ci } 98523b3eb3cSopenharmony_ci } else { 98623b3eb3cSopenharmony_ci try { 98723b3eb3cSopenharmony_ci resourceManager 98823b3eb3cSopenharmony_ci .getSystemResourceManager() 98923b3eb3cSopenharmony_ci .getNumberByName(this.theme.label.e1.params[0].split('.')[2]); 99023b3eb3cSopenharmony_ci return this.theme.label.e1; 99123b3eb3cSopenharmony_ci } catch (error) { 99223b3eb3cSopenharmony_ci return this.theme.label.defaultFontSize; 99323b3eb3cSopenharmony_ci } 99423b3eb3cSopenharmony_ci } 99523b3eb3cSopenharmony_ci } 99623b3eb3cSopenharmony_ci } 99723b3eb3cSopenharmony_ci getLabelFontColor() { 99823b3eb3cSopenharmony_ci if (this.getChipActive()) { 99923b3eb3cSopenharmony_ci return ( 100023b3eb3cSopenharmony_ci this.label?.activatedFontColor ?? this.theme.label.activatedFontColor 100123b3eb3cSopenharmony_ci ); 100223b3eb3cSopenharmony_ci } 100323b3eb3cSopenharmony_ci return this.label?.fontColor ?? this.theme.label.fontColor; 100423b3eb3cSopenharmony_ci } 100523b3eb3cSopenharmony_ci getLabelFontFamily() { 100623b3eb3cSopenharmony_ci return this.label?.fontFamily ?? this.theme.label.fontFamily; 100723b3eb3cSopenharmony_ci } 100823b3eb3cSopenharmony_ci getLabelFontWeight() { 100923b3eb3cSopenharmony_ci if (this.getChipActive()) { 101023b3eb3cSopenharmony_ci return FontWeight.Medium; 101123b3eb3cSopenharmony_ci } 101223b3eb3cSopenharmony_ci return FontWeight.Regular; 101323b3eb3cSopenharmony_ci } 101423b3eb3cSopenharmony_ci lengthMetricsToVp(s1) { 101523b3eb3cSopenharmony_ci let defaultValue = 0; 101623b3eb3cSopenharmony_ci if (s1) { 101723b3eb3cSopenharmony_ci switch (s1.unit) { 101823b3eb3cSopenharmony_ci case LengthUnit.PX: 101923b3eb3cSopenharmony_ci return px2vp(s1.value); 102023b3eb3cSopenharmony_ci case LengthUnit.VP: 102123b3eb3cSopenharmony_ci return s1.value; 102223b3eb3cSopenharmony_ci case LengthUnit.FP: 102323b3eb3cSopenharmony_ci px2vp(fp2px(s1.value)); 102423b3eb3cSopenharmony_ci break; 102523b3eb3cSopenharmony_ci case LengthUnit.PERCENT: 102623b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 102723b3eb3cSopenharmony_ci case LengthUnit.LPX: 102823b3eb3cSopenharmony_ci return px2vp(lpx2px(s1.value)); 102923b3eb3cSopenharmony_ci } 103023b3eb3cSopenharmony_ci } 103123b3eb3cSopenharmony_ci return defaultValue; 103223b3eb3cSopenharmony_ci } 103323b3eb3cSopenharmony_ci toVp(value) { 103423b3eb3cSopenharmony_ci if (value === void 0) { 103523b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 103623b3eb3cSopenharmony_ci } 103723b3eb3cSopenharmony_ci switch (typeof value) { 103823b3eb3cSopenharmony_ci case 'number': 103923b3eb3cSopenharmony_ci return value; 104023b3eb3cSopenharmony_ci case 'object': 104123b3eb3cSopenharmony_ci try { 104223b3eb3cSopenharmony_ci let q1 = this.lengthMetricsToVp(LengthMetrics.resource(value)); 104323b3eb3cSopenharmony_ci if (q1 === 0 && !m(getContext(this), value)) { 104423b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 104523b3eb3cSopenharmony_ci } 104623b3eb3cSopenharmony_ci return q1; 104723b3eb3cSopenharmony_ci } catch (error) { 104823b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 104923b3eb3cSopenharmony_ci } 105023b3eb3cSopenharmony_ci case 'string': 105123b3eb3cSopenharmony_ci let p1 = new RegExp('(-?\\d+(?:\\.\\d+)?)_?(fp|vp|px|lpx|%)?$', 'i'); 105223b3eb3cSopenharmony_ci let matches = value.match(p1); 105323b3eb3cSopenharmony_ci if (!matches) { 105423b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 105523b3eb3cSopenharmony_ci } 105623b3eb3cSopenharmony_ci let length = Number(matches?.[1] ?? 0); 105723b3eb3cSopenharmony_ci let unit = matches?.[2] ?? 'vp'; 105823b3eb3cSopenharmony_ci switch (unit.toLowerCase()) { 105923b3eb3cSopenharmony_ci case 'px': 106023b3eb3cSopenharmony_ci length = px2vp(length); 106123b3eb3cSopenharmony_ci break; 106223b3eb3cSopenharmony_ci case 'fp': 106323b3eb3cSopenharmony_ci length = px2vp(fp2px(length)); 106423b3eb3cSopenharmony_ci break; 106523b3eb3cSopenharmony_ci case 'lpx': 106623b3eb3cSopenharmony_ci length = px2vp(lpx2px(length)); 106723b3eb3cSopenharmony_ci break; 106823b3eb3cSopenharmony_ci case '%': 106923b3eb3cSopenharmony_ci length = Number.NEGATIVE_INFINITY; 107023b3eb3cSopenharmony_ci break; 107123b3eb3cSopenharmony_ci case 'vp': 107223b3eb3cSopenharmony_ci break; 107323b3eb3cSopenharmony_ci default: 107423b3eb3cSopenharmony_ci break; 107523b3eb3cSopenharmony_ci } 107623b3eb3cSopenharmony_ci return length; 107723b3eb3cSopenharmony_ci default: 107823b3eb3cSopenharmony_ci return Number.NEGATIVE_INFINITY; 107923b3eb3cSopenharmony_ci } 108023b3eb3cSopenharmony_ci } 108123b3eb3cSopenharmony_ci getLabelMargin() { 108223b3eb3cSopenharmony_ci let labelMargin = { left: 0, right: 0 }; 108323b3eb3cSopenharmony_ci if ( 108423b3eb3cSopenharmony_ci this.label?.labelMargin?.left !== void 0 && 108523b3eb3cSopenharmony_ci this.toVp(this.label.labelMargin.left) >= 0 108623b3eb3cSopenharmony_ci ) { 108723b3eb3cSopenharmony_ci labelMargin.left = this.label?.labelMargin?.left; 108823b3eb3cSopenharmony_ci } else if ( 108923b3eb3cSopenharmony_ci this.prefixSymbol?.normal || 109023b3eb3cSopenharmony_ci this.prefixSymbol?.activated || 109123b3eb3cSopenharmony_ci this.prefixIcon?.src 109223b3eb3cSopenharmony_ci ) { 109323b3eb3cSopenharmony_ci if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 109423b3eb3cSopenharmony_ci labelMargin.left = this.theme.label.h1.left; 109523b3eb3cSopenharmony_ci } else { 109623b3eb3cSopenharmony_ci labelMargin.left = this.theme.label.g1.left; 109723b3eb3cSopenharmony_ci } 109823b3eb3cSopenharmony_ci } 109923b3eb3cSopenharmony_ci if ( 110023b3eb3cSopenharmony_ci this.label?.labelMargin?.right !== void 0 && 110123b3eb3cSopenharmony_ci this.toVp(this.label.labelMargin.right) >= 0 110223b3eb3cSopenharmony_ci ) { 110323b3eb3cSopenharmony_ci labelMargin.right = this.label?.labelMargin?.right; 110423b3eb3cSopenharmony_ci } else if ( 110523b3eb3cSopenharmony_ci this.suffixSymbol?.normal || 110623b3eb3cSopenharmony_ci this.suffixSymbol?.activated || 110723b3eb3cSopenharmony_ci this.suffixIcon?.src || 110823b3eb3cSopenharmony_ci this.useDefaultSuffixIcon 110923b3eb3cSopenharmony_ci ) { 111023b3eb3cSopenharmony_ci if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 111123b3eb3cSopenharmony_ci labelMargin.right = this.theme.label.h1.right; 111223b3eb3cSopenharmony_ci } else { 111323b3eb3cSopenharmony_ci labelMargin.right = this.theme.label.g1.right; 111423b3eb3cSopenharmony_ci } 111523b3eb3cSopenharmony_ci } 111623b3eb3cSopenharmony_ci return labelMargin; 111723b3eb3cSopenharmony_ci } 111823b3eb3cSopenharmony_ci getLocalizedLabelMargin() { 111923b3eb3cSopenharmony_ci let localizedLabelMargin = { 112023b3eb3cSopenharmony_ci start: LengthMetrics.vp(0), 112123b3eb3cSopenharmony_ci end: LengthMetrics.vp(0), 112223b3eb3cSopenharmony_ci }; 112323b3eb3cSopenharmony_ci if ( 112423b3eb3cSopenharmony_ci this.label?.localizedLabelMargin?.start?.value !== void 0 && 112523b3eb3cSopenharmony_ci this.lengthMetricsToVp(this.label.localizedLabelMargin.start) >= 0 112623b3eb3cSopenharmony_ci ) { 112723b3eb3cSopenharmony_ci localizedLabelMargin.start = this.label?.localizedLabelMargin?.start; 112823b3eb3cSopenharmony_ci } else if ( 112923b3eb3cSopenharmony_ci this.prefixSymbol?.normal || 113023b3eb3cSopenharmony_ci this.prefixSymbol?.activated || 113123b3eb3cSopenharmony_ci this.prefixIcon?.src 113223b3eb3cSopenharmony_ci ) { 113323b3eb3cSopenharmony_ci if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 113423b3eb3cSopenharmony_ci localizedLabelMargin.start = this.theme.label.j1.start; 113523b3eb3cSopenharmony_ci } else { 113623b3eb3cSopenharmony_ci localizedLabelMargin.start = this.theme.label.i1.start; 113723b3eb3cSopenharmony_ci } 113823b3eb3cSopenharmony_ci } 113923b3eb3cSopenharmony_ci if ( 114023b3eb3cSopenharmony_ci this.label?.localizedLabelMargin?.end?.value !== void 0 && 114123b3eb3cSopenharmony_ci this.lengthMetricsToVp(this.label.localizedLabelMargin.end) >= 0 114223b3eb3cSopenharmony_ci ) { 114323b3eb3cSopenharmony_ci localizedLabelMargin.end = this.label?.localizedLabelMargin?.end; 114423b3eb3cSopenharmony_ci } else if ( 114523b3eb3cSopenharmony_ci this.suffixSymbol?.normal || 114623b3eb3cSopenharmony_ci this.suffixSymbol?.activated || 114723b3eb3cSopenharmony_ci this.suffixIcon?.src || 114823b3eb3cSopenharmony_ci this.useDefaultSuffixIcon 114923b3eb3cSopenharmony_ci ) { 115023b3eb3cSopenharmony_ci if (this.isChipSizeEnum() && this.chipSize == ChipSize.SMALL) { 115123b3eb3cSopenharmony_ci localizedLabelMargin.end = this.theme.label.j1.end; 115223b3eb3cSopenharmony_ci } else { 115323b3eb3cSopenharmony_ci localizedLabelMargin.end = this.theme.label.i1.end; 115423b3eb3cSopenharmony_ci } 115523b3eb3cSopenharmony_ci } 115623b3eb3cSopenharmony_ci return localizedLabelMargin; 115723b3eb3cSopenharmony_ci } 115823b3eb3cSopenharmony_ci getLabelStartEndVp() { 115923b3eb3cSopenharmony_ci let labelMargin = this.getLocalizedLabelMargin(); 116023b3eb3cSopenharmony_ci if ( 116123b3eb3cSopenharmony_ci this.label && 116223b3eb3cSopenharmony_ci this.label.labelMargin !== void 0 && 116323b3eb3cSopenharmony_ci this.label.localizedLabelMargin === void 0 116423b3eb3cSopenharmony_ci ) { 116523b3eb3cSopenharmony_ci let margin = this.getLabelMargin(); 116623b3eb3cSopenharmony_ci return { 116723b3eb3cSopenharmony_ci start: LengthMetrics.vp(this.toVp(margin.left)), 116823b3eb3cSopenharmony_ci end: LengthMetrics.vp(this.toVp(margin.right)), 116923b3eb3cSopenharmony_ci }; 117023b3eb3cSopenharmony_ci } 117123b3eb3cSopenharmony_ci return { 117223b3eb3cSopenharmony_ci start: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.start)), 117323b3eb3cSopenharmony_ci end: LengthMetrics.vp(this.lengthMetricsToVp(labelMargin.end)), 117423b3eb3cSopenharmony_ci }; 117523b3eb3cSopenharmony_ci } 117623b3eb3cSopenharmony_ci getActualLabelMargin() { 117723b3eb3cSopenharmony_ci let localizedLabelMargin = this.getLocalizedLabelMargin(); 117823b3eb3cSopenharmony_ci if (this.label && this.label.localizedLabelMargin !== void 0) { 117923b3eb3cSopenharmony_ci return localizedLabelMargin; 118023b3eb3cSopenharmony_ci } 118123b3eb3cSopenharmony_ci if (this.label && this.label.labelMargin !== void 0) { 118223b3eb3cSopenharmony_ci return this.getLabelMargin(); 118323b3eb3cSopenharmony_ci } 118423b3eb3cSopenharmony_ci return localizedLabelMargin; 118523b3eb3cSopenharmony_ci } 118623b3eb3cSopenharmony_ci getSuffixIconSize() { 118723b3eb3cSopenharmony_ci let o1 = { width: 0, height: 0 }; 118823b3eb3cSopenharmony_ci if ( 118923b3eb3cSopenharmony_ci this.suffixIcon?.size?.width !== void 0 && 119023b3eb3cSopenharmony_ci this.toVp(this.suffixIcon?.size?.width) >= 0 119123b3eb3cSopenharmony_ci ) { 119223b3eb3cSopenharmony_ci o1.width = this.suffixIcon?.size?.width; 119323b3eb3cSopenharmony_ci } else { 119423b3eb3cSopenharmony_ci if (this.getSuffixIconSrc()) { 119523b3eb3cSopenharmony_ci o1.width = this.theme.suffixIcon.size.width; 119623b3eb3cSopenharmony_ci } else { 119723b3eb3cSopenharmony_ci o1.width = 0; 119823b3eb3cSopenharmony_ci } 119923b3eb3cSopenharmony_ci } 120023b3eb3cSopenharmony_ci if ( 120123b3eb3cSopenharmony_ci this.suffixIcon?.size?.height !== void 0 && 120223b3eb3cSopenharmony_ci this.toVp(this.suffixIcon?.size?.height) >= 0 120323b3eb3cSopenharmony_ci ) { 120423b3eb3cSopenharmony_ci o1.height = this.suffixIcon?.size?.height; 120523b3eb3cSopenharmony_ci } else { 120623b3eb3cSopenharmony_ci if (this.getSuffixIconSrc()) { 120723b3eb3cSopenharmony_ci o1.height = this.theme.suffixIcon.size.height; 120823b3eb3cSopenharmony_ci } else { 120923b3eb3cSopenharmony_ci o1.height = 0; 121023b3eb3cSopenharmony_ci } 121123b3eb3cSopenharmony_ci } 121223b3eb3cSopenharmony_ci return o1; 121323b3eb3cSopenharmony_ci } 121423b3eb3cSopenharmony_ci getPrefixIconSize() { 121523b3eb3cSopenharmony_ci let n1 = { width: 0, height: 0 }; 121623b3eb3cSopenharmony_ci if ( 121723b3eb3cSopenharmony_ci this.prefixIcon?.size?.width !== void 0 && 121823b3eb3cSopenharmony_ci this.toVp(this.prefixIcon?.size?.width) >= 0 121923b3eb3cSopenharmony_ci ) { 122023b3eb3cSopenharmony_ci n1.width = this.prefixIcon?.size?.width; 122123b3eb3cSopenharmony_ci } else { 122223b3eb3cSopenharmony_ci if (this.prefixIcon?.src) { 122323b3eb3cSopenharmony_ci n1.width = this.theme.prefixIcon.size.width; 122423b3eb3cSopenharmony_ci } else { 122523b3eb3cSopenharmony_ci n1.width = 0; 122623b3eb3cSopenharmony_ci } 122723b3eb3cSopenharmony_ci } 122823b3eb3cSopenharmony_ci if ( 122923b3eb3cSopenharmony_ci this.prefixIcon?.size?.height !== void 0 && 123023b3eb3cSopenharmony_ci this.toVp(this.prefixIcon?.size?.height) >= 0 123123b3eb3cSopenharmony_ci ) { 123223b3eb3cSopenharmony_ci n1.height = this.prefixIcon?.size?.height; 123323b3eb3cSopenharmony_ci } else { 123423b3eb3cSopenharmony_ci if (this.prefixIcon?.src) { 123523b3eb3cSopenharmony_ci n1.height = this.theme.prefixIcon.size.height; 123623b3eb3cSopenharmony_ci } else { 123723b3eb3cSopenharmony_ci n1.height = 0; 123823b3eb3cSopenharmony_ci } 123923b3eb3cSopenharmony_ci } 124023b3eb3cSopenharmony_ci return n1; 124123b3eb3cSopenharmony_ci } 124223b3eb3cSopenharmony_ci getPrefixIconFilledColor() { 124323b3eb3cSopenharmony_ci if (this.getChipActive()) { 124423b3eb3cSopenharmony_ci return ( 124523b3eb3cSopenharmony_ci this.prefixIcon?.activatedFillColor ?? 124623b3eb3cSopenharmony_ci this.theme.prefixIcon.activatedFillColor 124723b3eb3cSopenharmony_ci ); 124823b3eb3cSopenharmony_ci } 124923b3eb3cSopenharmony_ci return this.prefixIcon?.fillColor ?? this.theme.prefixIcon.fillColor; 125023b3eb3cSopenharmony_ci } 125123b3eb3cSopenharmony_ci getSuffixIconFilledColor() { 125223b3eb3cSopenharmony_ci if (this.getChipActive()) { 125323b3eb3cSopenharmony_ci return ( 125423b3eb3cSopenharmony_ci this.suffixIcon?.activatedFillColor ?? 125523b3eb3cSopenharmony_ci this.theme.suffixIcon.activatedFillColor 125623b3eb3cSopenharmony_ci ); 125723b3eb3cSopenharmony_ci } 125823b3eb3cSopenharmony_ci return this.suffixIcon?.fillColor ?? this.theme.suffixIcon.fillColor; 125923b3eb3cSopenharmony_ci } 126023b3eb3cSopenharmony_ci getDefaultSymbolColor() { 126123b3eb3cSopenharmony_ci if (this.getChipActive()) { 126223b3eb3cSopenharmony_ci return this.theme.m1.activatedFontColor; 126323b3eb3cSopenharmony_ci } 126423b3eb3cSopenharmony_ci return this.theme.m1.n1; 126523b3eb3cSopenharmony_ci } 126623b3eb3cSopenharmony_ci getPrefixSymbolModifier() { 126723b3eb3cSopenharmony_ci if (this.getChipActive()) { 126823b3eb3cSopenharmony_ci return this.prefixSymbol?.activated; 126923b3eb3cSopenharmony_ci } 127023b3eb3cSopenharmony_ci return this.prefixSymbol?.normal; 127123b3eb3cSopenharmony_ci } 127223b3eb3cSopenharmony_ci getSuffixSymbolModifier() { 127323b3eb3cSopenharmony_ci if (this.getChipActive()) { 127423b3eb3cSopenharmony_ci return this.suffixSymbol?.activated; 127523b3eb3cSopenharmony_ci } 127623b3eb3cSopenharmony_ci return this.suffixSymbol?.normal; 127723b3eb3cSopenharmony_ci } 127823b3eb3cSopenharmony_ci getSuffixIconFocusable() { 127923b3eb3cSopenharmony_ci return ( 128023b3eb3cSopenharmony_ci (this.useDefaultSuffixIcon && (this.allowClose ?? true)) || 128123b3eb3cSopenharmony_ci this.suffixIcon?.action !== void 0 128223b3eb3cSopenharmony_ci ); 128323b3eb3cSopenharmony_ci } 128423b3eb3cSopenharmony_ci getChipNodePadding() { 128523b3eb3cSopenharmony_ci return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 128623b3eb3cSopenharmony_ci ? this.theme.q1.d2 128723b3eb3cSopenharmony_ci : this.theme.q1.c2; 128823b3eb3cSopenharmony_ci } 128923b3eb3cSopenharmony_ci getChipNodeRadius() { 129023b3eb3cSopenharmony_ci if (this.chipNodeRadius !== void 0 && this.toVp(this.chipNodeRadius) >= 0) { 129123b3eb3cSopenharmony_ci return this.chipNodeRadius; 129223b3eb3cSopenharmony_ci } else { 129323b3eb3cSopenharmony_ci return this.isChipSizeEnum() && this.chipSize === ChipSize.SMALL 129423b3eb3cSopenharmony_ci ? this.theme.q1.b2 129523b3eb3cSopenharmony_ci : this.theme.q1.a2; 129623b3eb3cSopenharmony_ci } 129723b3eb3cSopenharmony_ci } 129823b3eb3cSopenharmony_ci getChipNodeBackGroundColor() { 129923b3eb3cSopenharmony_ci let l1; 130023b3eb3cSopenharmony_ci if (this.getChipActive()) { 130123b3eb3cSopenharmony_ci l1 = 130223b3eb3cSopenharmony_ci this.chipNodeActivatedBackgroundColor ?? 130323b3eb3cSopenharmony_ci this.theme.q1.activatedBackgroundColor; 130423b3eb3cSopenharmony_ci } else { 130523b3eb3cSopenharmony_ci l1 = this.chipNodeBackgroundColor ?? this.theme.q1.backgroundColor; 130623b3eb3cSopenharmony_ci } 130723b3eb3cSopenharmony_ci let m1; 130823b3eb3cSopenharmony_ci try { 130923b3eb3cSopenharmony_ci m1 = ColorMetrics.resourceColor(l1); 131023b3eb3cSopenharmony_ci } catch (err) { 131123b3eb3cSopenharmony_ci hilog.error( 131223b3eb3cSopenharmony_ci 0x3900, 131323b3eb3cSopenharmony_ci 'Ace', 131423b3eb3cSopenharmony_ci `Chip resourceColor, error: ${err.toString()}` 131523b3eb3cSopenharmony_ci ); 131623b3eb3cSopenharmony_ci m1 = ColorMetrics.resourceColor(Color.Transparent); 131723b3eb3cSopenharmony_ci } 131823b3eb3cSopenharmony_ci if (!this.isShowPressedBackGroundColor) { 131923b3eb3cSopenharmony_ci return m1.color; 132023b3eb3cSopenharmony_ci } 132123b3eb3cSopenharmony_ci return m1.blendColor(ColorMetrics.resourceColor('#19000000')).color; 132223b3eb3cSopenharmony_ci } 132323b3eb3cSopenharmony_ci getChipNodeHeight() { 132423b3eb3cSopenharmony_ci if (this.isChipSizeEnum()) { 132523b3eb3cSopenharmony_ci return this.chipSize === ChipSize.SMALL 132623b3eb3cSopenharmony_ci ? this.theme.q1.v1 132723b3eb3cSopenharmony_ci : this.theme.q1.u1; 132823b3eb3cSopenharmony_ci } else { 132923b3eb3cSopenharmony_ci this.chipNodeSize = this.chipSize; 133023b3eb3cSopenharmony_ci return this.chipNodeSize?.height !== void 0 && 133123b3eb3cSopenharmony_ci this.toVp(this.chipNodeSize?.height) >= 0 133223b3eb3cSopenharmony_ci ? this.toVp(this.chipNodeSize?.height) 133323b3eb3cSopenharmony_ci : this.theme.q1.u1; 133423b3eb3cSopenharmony_ci } 133523b3eb3cSopenharmony_ci } 133623b3eb3cSopenharmony_ci getLabelWidth() { 133723b3eb3cSopenharmony_ci return px2vp( 133823b3eb3cSopenharmony_ci measure.measureText({ 133923b3eb3cSopenharmony_ci textContent: this.label?.text ?? '', 134023b3eb3cSopenharmony_ci fontSize: this.getLabelFontSize(), 134123b3eb3cSopenharmony_ci fontFamily: this.label?.fontFamily ?? this.theme.label.fontFamily, 134223b3eb3cSopenharmony_ci fontWeight: this.getLabelFontWeight(), 134323b3eb3cSopenharmony_ci maxLines: 1, 134423b3eb3cSopenharmony_ci overflow: TextOverflow.Ellipsis, 134523b3eb3cSopenharmony_ci textAlign: TextAlign.Center, 134623b3eb3cSopenharmony_ci }) 134723b3eb3cSopenharmony_ci ); 134823b3eb3cSopenharmony_ci } 134923b3eb3cSopenharmony_ci getCalculateChipNodeWidth() { 135023b3eb3cSopenharmony_ci let j1 = 0; 135123b3eb3cSopenharmony_ci let k1 = this.getLabelStartEndVp(); 135223b3eb3cSopenharmony_ci j1 += this.getChipNodePadding().start?.value ?? 0; 135323b3eb3cSopenharmony_ci j1 += this.toVp(this.getPrefixChipWidth()); 135423b3eb3cSopenharmony_ci j1 += this.toVp(k1.start?.value ?? 0); 135523b3eb3cSopenharmony_ci j1 += this.getLabelWidth(); 135623b3eb3cSopenharmony_ci j1 += this.toVp(k1.end?.value ?? 0); 135723b3eb3cSopenharmony_ci j1 += this.toVp(this.getSuffixChipWidth()); 135823b3eb3cSopenharmony_ci j1 += this.getChipNodePadding().end?.value ?? 0; 135923b3eb3cSopenharmony_ci return j1; 136023b3eb3cSopenharmony_ci } 136123b3eb3cSopenharmony_ci getPrefixChipWidth() { 136223b3eb3cSopenharmony_ci if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 136323b3eb3cSopenharmony_ci return this.prefixSymbolWidth; 136423b3eb3cSopenharmony_ci } else if (this.prefixIcon?.src) { 136523b3eb3cSopenharmony_ci return this.getPrefixIconSize().width; 136623b3eb3cSopenharmony_ci } else { 136723b3eb3cSopenharmony_ci return 0; 136823b3eb3cSopenharmony_ci } 136923b3eb3cSopenharmony_ci } 137023b3eb3cSopenharmony_ci getSuffixChipWidth() { 137123b3eb3cSopenharmony_ci if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 137223b3eb3cSopenharmony_ci return this.suffixSymbolWidth; 137323b3eb3cSopenharmony_ci } else if (this.suffixIcon?.src) { 137423b3eb3cSopenharmony_ci return this.getSuffixIconSize().width; 137523b3eb3cSopenharmony_ci } else if (!this.suffixIcon?.src && (this.allowClose ?? true)) { 137623b3eb3cSopenharmony_ci return this.allowCloseSymbolWidth; 137723b3eb3cSopenharmony_ci } else { 137823b3eb3cSopenharmony_ci return 0; 137923b3eb3cSopenharmony_ci } 138023b3eb3cSopenharmony_ci } 138123b3eb3cSopenharmony_ci getReserveChipNodeWidth() { 138223b3eb3cSopenharmony_ci return ( 138323b3eb3cSopenharmony_ci this.getCalculateChipNodeWidth() - this.getLabelWidth() + this.theme.q1.t1 138423b3eb3cSopenharmony_ci ); 138523b3eb3cSopenharmony_ci } 138623b3eb3cSopenharmony_ci getChipEnable() { 138723b3eb3cSopenharmony_ci return this.chipEnabled || this.chipEnabled === void 0; 138823b3eb3cSopenharmony_ci } 138923b3eb3cSopenharmony_ci getChipActive() { 139023b3eb3cSopenharmony_ci if (typeof this.chipActivated === 'undefined') { 139123b3eb3cSopenharmony_ci return false; 139223b3eb3cSopenharmony_ci } 139323b3eb3cSopenharmony_ci return this.chipActivated; 139423b3eb3cSopenharmony_ci } 139523b3eb3cSopenharmony_ci getChipNodeOpacity() { 139623b3eb3cSopenharmony_ci return this.chipOpacity; 139723b3eb3cSopenharmony_ci } 139823b3eb3cSopenharmony_ci handleTouch(event) { 139923b3eb3cSopenharmony_ci if (!this.getChipEnable()) { 140023b3eb3cSopenharmony_ci return; 140123b3eb3cSopenharmony_ci } 140223b3eb3cSopenharmony_ci if (this.isHover) { 140323b3eb3cSopenharmony_ci if (event.type === TouchType.Down || event.type === TouchType.Move) { 140423b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = true; 140523b3eb3cSopenharmony_ci } else if (event.type === TouchType.Up) { 140623b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 140723b3eb3cSopenharmony_ci } else { 140823b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 140923b3eb3cSopenharmony_ci } 141023b3eb3cSopenharmony_ci } else { 141123b3eb3cSopenharmony_ci if (event.type === TouchType.Down || event.type === TouchType.Move) { 141223b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = true; 141323b3eb3cSopenharmony_ci } else if (event.type === TouchType.Up) { 141423b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 141523b3eb3cSopenharmony_ci } else { 141623b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 141723b3eb3cSopenharmony_ci } 141823b3eb3cSopenharmony_ci } 141923b3eb3cSopenharmony_ci } 142023b3eb3cSopenharmony_ci hoverAnimate(isHover) { 142123b3eb3cSopenharmony_ci if (!this.getChipEnable()) { 142223b3eb3cSopenharmony_ci return; 142323b3eb3cSopenharmony_ci } 142423b3eb3cSopenharmony_ci this.isHover = isHover; 142523b3eb3cSopenharmony_ci if (this.isHover) { 142623b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = true; 142723b3eb3cSopenharmony_ci } else { 142823b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 142923b3eb3cSopenharmony_ci } 143023b3eb3cSopenharmony_ci } 143123b3eb3cSopenharmony_ci deleteChipNodeAnimate() { 143223b3eb3cSopenharmony_ci Context.animateTo({ duration: 150, curve: Curve.Sharp }, () => { 143323b3eb3cSopenharmony_ci this.chipOpacity = 0; 143423b3eb3cSopenharmony_ci this.chipBlendColor = Color.Transparent; 143523b3eb3cSopenharmony_ci }); 143623b3eb3cSopenharmony_ci Context.animateTo( 143723b3eb3cSopenharmony_ci { 143823b3eb3cSopenharmony_ci duration: 150, 143923b3eb3cSopenharmony_ci curve: Curve.FastOutLinearIn, 144023b3eb3cSopenharmony_ci onFinish: () => { 144123b3eb3cSopenharmony_ci this.deleteChip = true; 144223b3eb3cSopenharmony_ci }, 144323b3eb3cSopenharmony_ci }, 144423b3eb3cSopenharmony_ci () => { 144523b3eb3cSopenharmony_ci this.chipScale = { x: 0.85, y: 0.85 }; 144623b3eb3cSopenharmony_ci } 144723b3eb3cSopenharmony_ci ); 144823b3eb3cSopenharmony_ci } 144923b3eb3cSopenharmony_ci getSuffixIconSrc() { 145023b3eb3cSopenharmony_ci this.useDefaultSuffixIcon = 145123b3eb3cSopenharmony_ci !this.suffixIcon?.src && (this.allowClose ?? true); 145223b3eb3cSopenharmony_ci return this.useDefaultSuffixIcon 145323b3eb3cSopenharmony_ci ? this.theme.suffixIcon.l1 145423b3eb3cSopenharmony_ci : this.suffixIcon?.src ?? void 0; 145523b3eb3cSopenharmony_ci } 145623b3eb3cSopenharmony_ci getChipNodeWidth() { 145723b3eb3cSopenharmony_ci if (!this.isChipSizeEnum()) { 145823b3eb3cSopenharmony_ci this.chipNodeSize = this.chipSize; 145923b3eb3cSopenharmony_ci if ( 146023b3eb3cSopenharmony_ci this.chipNodeSize?.width !== void 0 && 146123b3eb3cSopenharmony_ci this.toVp(this.chipNodeSize.width) >= 0 146223b3eb3cSopenharmony_ci ) { 146323b3eb3cSopenharmony_ci return this.toVp(this.chipNodeSize.width); 146423b3eb3cSopenharmony_ci } 146523b3eb3cSopenharmony_ci } 146623b3eb3cSopenharmony_ci let constraintWidth = this.getChipConstraintWidth(); 146723b3eb3cSopenharmony_ci return Math.min( 146823b3eb3cSopenharmony_ci Math.max(this.getCalculateChipNodeWidth(), constraintWidth.minWidth), 146923b3eb3cSopenharmony_ci constraintWidth.maxWidth 147023b3eb3cSopenharmony_ci ); 147123b3eb3cSopenharmony_ci } 147223b3eb3cSopenharmony_ci getFocusOverlaySize() { 147323b3eb3cSopenharmony_ci return { 147423b3eb3cSopenharmony_ci width: 147523b3eb3cSopenharmony_ci Math.max( 147623b3eb3cSopenharmony_ci this.getChipNodeWidth(), 147723b3eb3cSopenharmony_ci this.getChipConstraintWidth().minWidth 147823b3eb3cSopenharmony_ci ) + 8, 147923b3eb3cSopenharmony_ci height: this.getChipNodeHeight() + 8, 148023b3eb3cSopenharmony_ci }; 148123b3eb3cSopenharmony_ci } 148223b3eb3cSopenharmony_ci getChipConstraintWidth() { 148323b3eb3cSopenharmony_ci let i1 = this.getReserveChipNodeWidth(); 148423b3eb3cSopenharmony_ci let constraintWidth = this.getCalculateChipNodeWidth(); 148523b3eb3cSopenharmony_ci let constraintSize; 148623b3eb3cSopenharmony_ci switch (this.chipBreakPoints) { 148723b3eb3cSopenharmony_ci case a1.SM: 148823b3eb3cSopenharmony_ci constraintSize = { 148923b3eb3cSopenharmony_ci minWidth: i1, 149023b3eb3cSopenharmony_ci maxWidth: Math.min(constraintWidth, this.theme.q1.g2.i2), 149123b3eb3cSopenharmony_ci }; 149223b3eb3cSopenharmony_ci break; 149323b3eb3cSopenharmony_ci case a1.MD: 149423b3eb3cSopenharmony_ci constraintSize = { 149523b3eb3cSopenharmony_ci minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 149623b3eb3cSopenharmony_ci maxWidth: Math.min(constraintWidth, this.theme.q1.g2.j2), 149723b3eb3cSopenharmony_ci }; 149823b3eb3cSopenharmony_ci break; 149923b3eb3cSopenharmony_ci case a1.LG: 150023b3eb3cSopenharmony_ci constraintSize = { 150123b3eb3cSopenharmony_ci minWidth: Math.max(constraintWidth, this.theme.q1.g2.h2), 150223b3eb3cSopenharmony_ci maxWidth: Math.min(constraintWidth, this.theme.q1.g2.l2), 150323b3eb3cSopenharmony_ci }; 150423b3eb3cSopenharmony_ci break; 150523b3eb3cSopenharmony_ci default: 150623b3eb3cSopenharmony_ci constraintSize = { minWidth: i1, maxWidth: constraintWidth }; 150723b3eb3cSopenharmony_ci break; 150823b3eb3cSopenharmony_ci } 150923b3eb3cSopenharmony_ci constraintSize.minWidth = Math.min( 151023b3eb3cSopenharmony_ci Math.max(this.getCalculateChipNodeWidth(), constraintSize.minWidth), 151123b3eb3cSopenharmony_ci constraintSize.maxWidth 151223b3eb3cSopenharmony_ci ); 151323b3eb3cSopenharmony_ci constraintSize.minHeight = this.getChipNodeHeight(); 151423b3eb3cSopenharmony_ci if ( 151523b3eb3cSopenharmony_ci !this.isChipSizeEnum() && 151623b3eb3cSopenharmony_ci this.chipNodeSize?.height !== void 0 && 151723b3eb3cSopenharmony_ci this.toVp(this.chipNodeSize?.height) >= 0 151823b3eb3cSopenharmony_ci ) { 151923b3eb3cSopenharmony_ci constraintSize.maxHeight = this.toVp(this.chipNodeSize.height); 152023b3eb3cSopenharmony_ci constraintSize.minHeight = this.toVp(this.chipNodeSize.height); 152123b3eb3cSopenharmony_ci } 152223b3eb3cSopenharmony_ci if ( 152323b3eb3cSopenharmony_ci !this.isChipSizeEnum() && 152423b3eb3cSopenharmony_ci this.chipNodeSize?.width !== void 0 && 152523b3eb3cSopenharmony_ci this.toVp(this.chipNodeSize?.width) >= 0 152623b3eb3cSopenharmony_ci ) { 152723b3eb3cSopenharmony_ci constraintSize.minWidth = this.toVp(this.chipNodeSize.width); 152823b3eb3cSopenharmony_ci constraintSize.maxWidth = this.toVp(this.chipNodeSize.width); 152923b3eb3cSopenharmony_ci } else if (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) { 153023b3eb3cSopenharmony_ci constraintSize.minWidth = void 0; 153123b3eb3cSopenharmony_ci constraintSize.maxWidth = void 0; 153223b3eb3cSopenharmony_ci } 153323b3eb3cSopenharmony_ci return constraintSize; 153423b3eb3cSopenharmony_ci } 153523b3eb3cSopenharmony_ci 153623b3eb3cSopenharmony_ci focusOverlay(parent = null) { 153723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 153823b3eb3cSopenharmony_ci Stack.create(); 153923b3eb3cSopenharmony_ci Stack.direction(this.chipDirection); 154023b3eb3cSopenharmony_ci Stack.size({ width: 1, height: 1 }); 154123b3eb3cSopenharmony_ci Stack.align(Alignment.Center); 154223b3eb3cSopenharmony_ci }, Stack); 154323b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 154423b3eb3cSopenharmony_ci If.create(); 154523b3eb3cSopenharmony_ci if (this.chipNodeOnFocus && !this.suffixIconOnFocus) { 154623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 154723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 154823b3eb3cSopenharmony_ci Stack.create(); 154923b3eb3cSopenharmony_ci Stack.direction(this.chipDirection); 155023b3eb3cSopenharmony_ci Stack.borderRadius(this.toVp(this.getChipNodeRadius()) + 4); 155123b3eb3cSopenharmony_ci Stack.size(this.getFocusOverlaySize()); 155223b3eb3cSopenharmony_ci Stack.borderColor(this.theme.q1.w1); 155323b3eb3cSopenharmony_ci Stack.borderWidth(this.theme.q1.borderWidth); 155423b3eb3cSopenharmony_ci }, Stack); 155523b3eb3cSopenharmony_ci Stack.pop(); 155623b3eb3cSopenharmony_ci }); 155723b3eb3cSopenharmony_ci } else { 155823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => {}); 155923b3eb3cSopenharmony_ci } 156023b3eb3cSopenharmony_ci }, If); 156123b3eb3cSopenharmony_ci If.pop(); 156223b3eb3cSopenharmony_ci Stack.pop(); 156323b3eb3cSopenharmony_ci } 156423b3eb3cSopenharmony_ci aboutToAppear() { 156523b3eb3cSopenharmony_ci let e1 = this.getUIContext(); 156623b3eb3cSopenharmony_ci this.fontSizeScale = e1.getHostContext()?.config?.fontSizeScale ?? 1; 156723b3eb3cSopenharmony_ci this.isClipable = (this.toVp(this.fontSizeScale) >= this.theme.q1.s1) ? true : false; 156823b3eb3cSopenharmony_ci this.smListener.on('change', (h1) => { 156923b3eb3cSopenharmony_ci if (h1.matches) { 157023b3eb3cSopenharmony_ci this.chipBreakPoints = a1.SM; 157123b3eb3cSopenharmony_ci } 157223b3eb3cSopenharmony_ci }); 157323b3eb3cSopenharmony_ci this.mdListener.on('change', (g1) => { 157423b3eb3cSopenharmony_ci if (g1.matches) { 157523b3eb3cSopenharmony_ci this.chipBreakPoints = a1.MD; 157623b3eb3cSopenharmony_ci } 157723b3eb3cSopenharmony_ci }); 157823b3eb3cSopenharmony_ci this.lgListener.on('change', (f1) => { 157923b3eb3cSopenharmony_ci if (f1.matches) { 158023b3eb3cSopenharmony_ci this.chipBreakPoints = a1.LG; 158123b3eb3cSopenharmony_ci } 158223b3eb3cSopenharmony_ci }); 158323b3eb3cSopenharmony_ci this.callbackId = this.getUIContext() 158423b3eb3cSopenharmony_ci .getHostContext() 158523b3eb3cSopenharmony_ci ?.getApplicationContext() 158623b3eb3cSopenharmony_ci ?.on('environment', this.callbacks); 158723b3eb3cSopenharmony_ci } 158823b3eb3cSopenharmony_ci getVisibility() { 158923b3eb3cSopenharmony_ci if (this.toVp(this.getChipNodeHeight()) > 0) { 159023b3eb3cSopenharmony_ci return Visibility.Visible; 159123b3eb3cSopenharmony_ci } else { 159223b3eb3cSopenharmony_ci return Visibility.None; 159323b3eb3cSopenharmony_ci } 159423b3eb3cSopenharmony_ci } 159523b3eb3cSopenharmony_ci aboutToDisappear() { 159623b3eb3cSopenharmony_ci this.smListener.off('change'); 159723b3eb3cSopenharmony_ci this.mdListener.off('change'); 159823b3eb3cSopenharmony_ci this.lgListener.off('change'); 159923b3eb3cSopenharmony_ci if (this.callbackId) { 160023b3eb3cSopenharmony_ci this.getUIContext() 160123b3eb3cSopenharmony_ci .getHostContext() 160223b3eb3cSopenharmony_ci ?.getApplicationContext() 160323b3eb3cSopenharmony_ci ?.off('environment', this.callbackId); 160423b3eb3cSopenharmony_ci this.callbackId = void 0; 160523b3eb3cSopenharmony_ci } 160623b3eb3cSopenharmony_ci } 160723b3eb3cSopenharmony_ci chipBuilder(parent = null) { 160823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 160923b3eb3cSopenharmony_ci Button.createWithChild(); 161023b3eb3cSopenharmony_ci Button.constraintSize(this.getChipConstraintWidth()); 161123b3eb3cSopenharmony_ci Button.direction(this.chipDirection); 161223b3eb3cSopenharmony_ci Button.type(ButtonType.Normal); 161323b3eb3cSopenharmony_ci Button.clip(this.isClipable); 161423b3eb3cSopenharmony_ci Button.backgroundColor(this.getChipNodeBackGroundColor()); 161523b3eb3cSopenharmony_ci Button.borderRadius(this.getChipNodeRadius()); 161623b3eb3cSopenharmony_ci Button.enabled(this.getChipEnable()); 161723b3eb3cSopenharmony_ci Button.scale(ObservedObject.GetRawObject(this.chipScale)); 161823b3eb3cSopenharmony_ci Button.focusable(true); 161923b3eb3cSopenharmony_ci Button.opacity(this.getChipNodeOpacity()); 162023b3eb3cSopenharmony_ci Button.padding(0); 162123b3eb3cSopenharmony_ci Button.accessibilityGroup(true); 162223b3eb3cSopenharmony_ci Button.accessibilityDescription(this.getAccessibilityDescription()); 162323b3eb3cSopenharmony_ci Button.accessibilityLevel(this.getAccessibilityLevel()); 162423b3eb3cSopenharmony_ci Button.accessibilityChecked(this.getAccessibilityChecked()); 162523b3eb3cSopenharmony_ci Button.accessibilitySelected(this.getAccessibilitySelected()); 162623b3eb3cSopenharmony_ci Button.onFocus(() => { 162723b3eb3cSopenharmony_ci this.chipNodeOnFocus = true; 162823b3eb3cSopenharmony_ci }); 162923b3eb3cSopenharmony_ci Button.onBlur(() => { 163023b3eb3cSopenharmony_ci this.chipNodeOnFocus = false; 163123b3eb3cSopenharmony_ci }); 163223b3eb3cSopenharmony_ci Button.onTouch((event) => { 163323b3eb3cSopenharmony_ci this.handleTouch(event); 163423b3eb3cSopenharmony_ci }); 163523b3eb3cSopenharmony_ci Button.onHover((isHover) => { 163623b3eb3cSopenharmony_ci if (isHover) { 163723b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = true; 163823b3eb3cSopenharmony_ci } else { 163923b3eb3cSopenharmony_ci if (!this.isShowPressedBackGroundColor && isHover) { 164023b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = true; 164123b3eb3cSopenharmony_ci } else { 164223b3eb3cSopenharmony_ci this.isShowPressedBackGroundColor = false; 164323b3eb3cSopenharmony_ci } 164423b3eb3cSopenharmony_ci } 164523b3eb3cSopenharmony_ci }); 164623b3eb3cSopenharmony_ci Button.onKeyEvent((event) => { 164723b3eb3cSopenharmony_ci if ( 164823b3eb3cSopenharmony_ci event.type === KeyType.Down && 164923b3eb3cSopenharmony_ci event.keyCode === KeyCode.KEYCODE_FORWARD_DEL && 165023b3eb3cSopenharmony_ci !this.suffixIconOnFocus 165123b3eb3cSopenharmony_ci ) { 165223b3eb3cSopenharmony_ci this.deleteChipNodeAnimate(); 165323b3eb3cSopenharmony_ci } 165423b3eb3cSopenharmony_ci }); 165523b3eb3cSopenharmony_ci Button.onClick( 165623b3eb3cSopenharmony_ci this.onClicked === c1 ? undefined : this.onClicked.bind(this) 165723b3eb3cSopenharmony_ci ); 165823b3eb3cSopenharmony_ci }, Button); 165923b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 166023b3eb3cSopenharmony_ci Row.create(); 166123b3eb3cSopenharmony_ci Row.direction(this.chipDirection); 166223b3eb3cSopenharmony_ci Row.alignItems(VerticalAlign.Center); 166323b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Center); 166423b3eb3cSopenharmony_ci Row.padding(this.getChipNodePadding()); 166523b3eb3cSopenharmony_ci Row.constraintSize(this.getChipConstraintWidth()); 166623b3eb3cSopenharmony_ci }, Row); 166723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 166823b3eb3cSopenharmony_ci If.create(); 166923b3eb3cSopenharmony_ci if (this.prefixSymbol?.normal || this.prefixSymbol?.activated) { 167023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 167123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 167223b3eb3cSopenharmony_ci SymbolGlyph.create(); 167323b3eb3cSopenharmony_ci SymbolGlyph.fontSize(this.theme.m1.fontSize); 167423b3eb3cSopenharmony_ci SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 167523b3eb3cSopenharmony_ci SymbolGlyph.attributeModifier.bind(this)( 167623b3eb3cSopenharmony_ci this.getPrefixSymbolModifier() 167723b3eb3cSopenharmony_ci ); 167823b3eb3cSopenharmony_ci SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 167923b3eb3cSopenharmony_ci SymbolGlyph.symbolEffect( 168023b3eb3cSopenharmony_ci ObservedObject.GetRawObject(this.symbolEffect), 168123b3eb3cSopenharmony_ci false 168223b3eb3cSopenharmony_ci ); 168323b3eb3cSopenharmony_ci SymbolGlyph.symbolEffect( 168423b3eb3cSopenharmony_ci ObservedObject.GetRawObject(this.symbolEffect), 168523b3eb3cSopenharmony_ci this.theme.m1.o1 168623b3eb3cSopenharmony_ci ); 168723b3eb3cSopenharmony_ci SymbolGlyph.onSizeChange((oldValue, newValue) => { 168823b3eb3cSopenharmony_ci this.prefixSymbolWidth = newValue?.width; 168923b3eb3cSopenharmony_ci }); 169023b3eb3cSopenharmony_ci SymbolGlyph.key('PrefixSymbolGlyph'); 169123b3eb3cSopenharmony_ci }, SymbolGlyph); 169223b3eb3cSopenharmony_ci }); 169323b3eb3cSopenharmony_ci } else if (this.prefixIcon?.src !== '') { 169423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 169523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 169623b3eb3cSopenharmony_ci Image.create(this.prefixIcon?.src); 169723b3eb3cSopenharmony_ci Image.direction(this.chipDirection); 169823b3eb3cSopenharmony_ci Image.opacity(this.getChipNodeOpacity()); 169923b3eb3cSopenharmony_ci Image.size(this.getPrefixIconSize()); 170023b3eb3cSopenharmony_ci Image.fillColor(this.getPrefixIconFilledColor()); 170123b3eb3cSopenharmony_ci Image.enabled(this.getChipEnable()); 170223b3eb3cSopenharmony_ci Image.objectFit(ImageFit.Cover); 170323b3eb3cSopenharmony_ci Image.focusable(false); 170423b3eb3cSopenharmony_ci Image.flexShrink(0); 170523b3eb3cSopenharmony_ci Image.visibility(this.getVisibility()); 170623b3eb3cSopenharmony_ci Image.draggable(false); 170723b3eb3cSopenharmony_ci }, Image); 170823b3eb3cSopenharmony_ci }); 170923b3eb3cSopenharmony_ci } else { 171023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(2, () => {}); 171123b3eb3cSopenharmony_ci } 171223b3eb3cSopenharmony_ci }, If); 171323b3eb3cSopenharmony_ci If.pop(); 171423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 171523b3eb3cSopenharmony_ci Text.create(this.label?.text ?? ''); 171623b3eb3cSopenharmony_ci Text.direction(this.chipDirection); 171723b3eb3cSopenharmony_ci Text.opacity(this.getChipNodeOpacity()); 171823b3eb3cSopenharmony_ci Text.fontSize(this.getLabelFontSize()); 171923b3eb3cSopenharmony_ci Text.fontColor(this.getLabelFontColor()); 172023b3eb3cSopenharmony_ci Text.fontFamily(this.getLabelFontFamily()); 172123b3eb3cSopenharmony_ci Text.fontWeight(this.getLabelFontWeight()); 172223b3eb3cSopenharmony_ci Text.margin(this.getActualLabelMargin()); 172323b3eb3cSopenharmony_ci Text.enabled(this.getChipEnable()); 172423b3eb3cSopenharmony_ci Text.maxLines(1); 172523b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 172623b3eb3cSopenharmony_ci Text.flexShrink(1); 172723b3eb3cSopenharmony_ci Text.focusable(true); 172823b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Center); 172923b3eb3cSopenharmony_ci Text.visibility(this.getVisibility()); 173023b3eb3cSopenharmony_ci Text.draggable(false); 173123b3eb3cSopenharmony_ci }, Text); 173223b3eb3cSopenharmony_ci Text.pop(); 173323b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 173423b3eb3cSopenharmony_ci If.create(); 173523b3eb3cSopenharmony_ci if (this.suffixSymbol?.normal || this.suffixSymbol?.activated) { 173623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 173723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 173823b3eb3cSopenharmony_ci Button.createWithChild({ type: ButtonType.Normal }); 173923b3eb3cSopenharmony_ci Button.onClick(this.getSuffixSymbolAction()); 174023b3eb3cSopenharmony_ci Button.accessibilityText(this.getSuffixSymbolAccessibilityText()); 174123b3eb3cSopenharmony_ci Button.accessibilityDescription( 174223b3eb3cSopenharmony_ci this.getSuffixSymbolAccessibilityDescription() 174323b3eb3cSopenharmony_ci ); 174423b3eb3cSopenharmony_ci Button.accessibilityLevel(this.getSuffixSymbolAccessibilityLevel()); 174523b3eb3cSopenharmony_ci Button.backgroundColor(Color.Transparent); 174623b3eb3cSopenharmony_ci Button.borderRadius(0); 174723b3eb3cSopenharmony_ci Button.padding(0); 174823b3eb3cSopenharmony_ci Button.stateEffect(false); 174923b3eb3cSopenharmony_ci }, Button); 175023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 175123b3eb3cSopenharmony_ci SymbolGlyph.create(); 175223b3eb3cSopenharmony_ci SymbolGlyph.fontSize(this.theme.m1.fontSize); 175323b3eb3cSopenharmony_ci SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 175423b3eb3cSopenharmony_ci SymbolGlyph.attributeModifier.bind(this)( 175523b3eb3cSopenharmony_ci this.getSuffixSymbolModifier() 175623b3eb3cSopenharmony_ci ); 175723b3eb3cSopenharmony_ci SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 175823b3eb3cSopenharmony_ci SymbolGlyph.symbolEffect( 175923b3eb3cSopenharmony_ci ObservedObject.GetRawObject(this.symbolEffect), 176023b3eb3cSopenharmony_ci false 176123b3eb3cSopenharmony_ci ); 176223b3eb3cSopenharmony_ci SymbolGlyph.symbolEffect( 176323b3eb3cSopenharmony_ci ObservedObject.GetRawObject(this.symbolEffect), 176423b3eb3cSopenharmony_ci this.theme.m1.o1 176523b3eb3cSopenharmony_ci ); 176623b3eb3cSopenharmony_ci SymbolGlyph.onSizeChange((oldValue, newValue) => { 176723b3eb3cSopenharmony_ci this.suffixSymbolWidth = newValue?.width; 176823b3eb3cSopenharmony_ci }); 176923b3eb3cSopenharmony_ci SymbolGlyph.key('SuffixSymbolGlyph'); 177023b3eb3cSopenharmony_ci }, SymbolGlyph); 177123b3eb3cSopenharmony_ci Button.pop(); 177223b3eb3cSopenharmony_ci }); 177323b3eb3cSopenharmony_ci } else if (this.suffixIcon?.src !== '') { 177423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 177523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 177623b3eb3cSopenharmony_ci Button.createWithChild({ type: ButtonType.Normal }); 177723b3eb3cSopenharmony_ci Button.backgroundColor(Color.Transparent); 177823b3eb3cSopenharmony_ci Button.borderRadius(0); 177923b3eb3cSopenharmony_ci Button.padding(0); 178023b3eb3cSopenharmony_ci Button.accessibilityText(this.getSuffixIconAccessibilityText()); 178123b3eb3cSopenharmony_ci Button.accessibilityDescription( 178223b3eb3cSopenharmony_ci this.getSuffixIconAccessibilityDescription() 178323b3eb3cSopenharmony_ci ); 178423b3eb3cSopenharmony_ci Button.accessibilityLevel(this.getSuffixIconAccessibilityLevel()); 178523b3eb3cSopenharmony_ci Button.onClick(() => { 178623b3eb3cSopenharmony_ci if (!this.getChipEnable()) { 178723b3eb3cSopenharmony_ci return; 178823b3eb3cSopenharmony_ci } 178923b3eb3cSopenharmony_ci if (this.suffixIcon?.action) { 179023b3eb3cSopenharmony_ci this.suffixIcon.action(); 179123b3eb3cSopenharmony_ci return; 179223b3eb3cSopenharmony_ci } 179323b3eb3cSopenharmony_ci if ((this.allowClose ?? true) && this.useDefaultSuffixIcon) { 179423b3eb3cSopenharmony_ci this.onClose(); 179523b3eb3cSopenharmony_ci this.deleteChipNodeAnimate(); 179623b3eb3cSopenharmony_ci return; 179723b3eb3cSopenharmony_ci } 179823b3eb3cSopenharmony_ci this.onClicked(); 179923b3eb3cSopenharmony_ci }); 180023b3eb3cSopenharmony_ci Button.focusable(this.getSuffixIconFocusable()); 180123b3eb3cSopenharmony_ci }, Button); 180223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 180323b3eb3cSopenharmony_ci Image.create(this.getSuffixIconSrc()); 180423b3eb3cSopenharmony_ci Image.direction(this.chipDirection); 180523b3eb3cSopenharmony_ci Image.opacity(this.getChipNodeOpacity()); 180623b3eb3cSopenharmony_ci Image.size(this.getSuffixIconSize()); 180723b3eb3cSopenharmony_ci Image.fillColor(this.getSuffixIconFilledColor()); 180823b3eb3cSopenharmony_ci Image.enabled(this.getChipEnable()); 180923b3eb3cSopenharmony_ci Image.objectFit(ImageFit.Cover); 181023b3eb3cSopenharmony_ci Image.flexShrink(0); 181123b3eb3cSopenharmony_ci Image.visibility(this.getVisibility()); 181223b3eb3cSopenharmony_ci Image.draggable(false); 181323b3eb3cSopenharmony_ci Image.onFocus(() => { 181423b3eb3cSopenharmony_ci this.suffixIconOnFocus = true; 181523b3eb3cSopenharmony_ci }); 181623b3eb3cSopenharmony_ci Image.onBlur(() => { 181723b3eb3cSopenharmony_ci this.suffixIconOnFocus = false; 181823b3eb3cSopenharmony_ci }); 181923b3eb3cSopenharmony_ci }, Image); 182023b3eb3cSopenharmony_ci Button.pop(); 182123b3eb3cSopenharmony_ci }); 182223b3eb3cSopenharmony_ci } else if (this.allowClose ?? true) { 182323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(2, () => { 182423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 182523b3eb3cSopenharmony_ci Button.createWithChild({ type: ButtonType.Normal }); 182623b3eb3cSopenharmony_ci Button.backgroundColor(Color.Transparent); 182723b3eb3cSopenharmony_ci Button.borderRadius(0); 182823b3eb3cSopenharmony_ci Button.padding(0); 182923b3eb3cSopenharmony_ci Button.accessibilityText(this.getCloseIconAccessibilityText()); 183023b3eb3cSopenharmony_ci Button.accessibilityDescription( 183123b3eb3cSopenharmony_ci this.getCloseIconAccessibilityDescription() 183223b3eb3cSopenharmony_ci ); 183323b3eb3cSopenharmony_ci Button.accessibilityLevel(this.getCloseIconAccessibilityLevel()); 183423b3eb3cSopenharmony_ci Button.onClick(() => { 183523b3eb3cSopenharmony_ci if (!this.getChipEnable()) { 183623b3eb3cSopenharmony_ci return; 183723b3eb3cSopenharmony_ci } 183823b3eb3cSopenharmony_ci this.onClose(); 183923b3eb3cSopenharmony_ci this.deleteChipNodeAnimate(); 184023b3eb3cSopenharmony_ci }); 184123b3eb3cSopenharmony_ci }, Button); 184223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 184323b3eb3cSopenharmony_ci SymbolGlyph.create({ 184423b3eb3cSopenharmony_ci id: -1, 184523b3eb3cSopenharmony_ci type: 40000, 184623b3eb3cSopenharmony_ci params: ['sys.symbol.xmark'], 184723b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 184823b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 184923b3eb3cSopenharmony_ci }); 185023b3eb3cSopenharmony_ci SymbolGlyph.fontSize(this.theme.m1.fontSize); 185123b3eb3cSopenharmony_ci SymbolGlyph.fontColor(this.getDefaultSymbolColor()); 185223b3eb3cSopenharmony_ci SymbolGlyph.onSizeChange((oldValue, newValue) => { 185323b3eb3cSopenharmony_ci this.allowCloseSymbolWidth = newValue?.width; 185423b3eb3cSopenharmony_ci }); 185523b3eb3cSopenharmony_ci SymbolGlyph.key('AllowCloseSymbolGlyph'); 185623b3eb3cSopenharmony_ci }, SymbolGlyph); 185723b3eb3cSopenharmony_ci Button.pop(); 185823b3eb3cSopenharmony_ci }); 185923b3eb3cSopenharmony_ci } else { 186023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(3, () => {}); 186123b3eb3cSopenharmony_ci } 186223b3eb3cSopenharmony_ci }, If); 186323b3eb3cSopenharmony_ci If.pop(); 186423b3eb3cSopenharmony_ci Row.pop(); 186523b3eb3cSopenharmony_ci Button.pop(); 186623b3eb3cSopenharmony_ci } 186723b3eb3cSopenharmony_ci getSuffixSymbolAccessibilityLevel() { 186823b3eb3cSopenharmony_ci if (this.getChipActive()) { 186923b3eb3cSopenharmony_ci if ( 187023b3eb3cSopenharmony_ci !this.suffixSymbolOptions?.activatedAccessibility?.accessibilityLevel 187123b3eb3cSopenharmony_ci ) { 187223b3eb3cSopenharmony_ci return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 187323b3eb3cSopenharmony_ci } 187423b3eb3cSopenharmony_ci return this.suffixSymbolOptions.activatedAccessibility.accessibilityLevel; 187523b3eb3cSopenharmony_ci } 187623b3eb3cSopenharmony_ci if (!this.suffixSymbolOptions?.normalAccessibility?.accessibilityLevel) { 187723b3eb3cSopenharmony_ci return this.suffixSymbolOptions?.action ? 'yes' : 'no'; 187823b3eb3cSopenharmony_ci } 187923b3eb3cSopenharmony_ci return this.suffixSymbolOptions.normalAccessibility.accessibilityLevel; 188023b3eb3cSopenharmony_ci } 188123b3eb3cSopenharmony_ci getSuffixSymbolAccessibilityDescription() { 188223b3eb3cSopenharmony_ci if (this.getChipActive()) { 188323b3eb3cSopenharmony_ci if ( 188423b3eb3cSopenharmony_ci typeof this.suffixSymbolOptions?.activatedAccessibility 188523b3eb3cSopenharmony_ci ?.accessibilityDescription !== 'undefined' 188623b3eb3cSopenharmony_ci ) { 188723b3eb3cSopenharmony_ci return this.suffixSymbolOptions.activatedAccessibility 188823b3eb3cSopenharmony_ci .accessibilityDescription; 188923b3eb3cSopenharmony_ci } 189023b3eb3cSopenharmony_ci return undefined; 189123b3eb3cSopenharmony_ci } 189223b3eb3cSopenharmony_ci if ( 189323b3eb3cSopenharmony_ci typeof this.suffixSymbolOptions?.normalAccessibility 189423b3eb3cSopenharmony_ci ?.accessibilityDescription !== 'undefined' 189523b3eb3cSopenharmony_ci ) { 189623b3eb3cSopenharmony_ci return this.suffixSymbolOptions.normalAccessibility 189723b3eb3cSopenharmony_ci .accessibilityDescription; 189823b3eb3cSopenharmony_ci } 189923b3eb3cSopenharmony_ci return undefined; 190023b3eb3cSopenharmony_ci } 190123b3eb3cSopenharmony_ci getSuffixSymbolAccessibilityText() { 190223b3eb3cSopenharmony_ci if (this.getChipActive()) { 190323b3eb3cSopenharmony_ci if ( 190423b3eb3cSopenharmony_ci typeof this.suffixSymbolOptions?.activatedAccessibility 190523b3eb3cSopenharmony_ci ?.accessibilityText !== 'undefined' 190623b3eb3cSopenharmony_ci ) { 190723b3eb3cSopenharmony_ci return this.suffixSymbolOptions.activatedAccessibility 190823b3eb3cSopenharmony_ci .accessibilityText; 190923b3eb3cSopenharmony_ci } 191023b3eb3cSopenharmony_ci return undefined; 191123b3eb3cSopenharmony_ci } 191223b3eb3cSopenharmony_ci if ( 191323b3eb3cSopenharmony_ci typeof this.suffixSymbolOptions?.normalAccessibility 191423b3eb3cSopenharmony_ci ?.accessibilityText !== 'undefined' 191523b3eb3cSopenharmony_ci ) { 191623b3eb3cSopenharmony_ci return this.suffixSymbolOptions.normalAccessibility.accessibilityText; 191723b3eb3cSopenharmony_ci } 191823b3eb3cSopenharmony_ci return undefined; 191923b3eb3cSopenharmony_ci } 192023b3eb3cSopenharmony_ci getSuffixSymbolAction() { 192123b3eb3cSopenharmony_ci if (typeof this.suffixSymbolOptions?.action === 'undefined') { 192223b3eb3cSopenharmony_ci return undefined; 192323b3eb3cSopenharmony_ci } 192423b3eb3cSopenharmony_ci return () => { 192523b3eb3cSopenharmony_ci if (!this.getChipEnable()) { 192623b3eb3cSopenharmony_ci return; 192723b3eb3cSopenharmony_ci } 192823b3eb3cSopenharmony_ci this.suffixSymbolOptions?.action?.(); 192923b3eb3cSopenharmony_ci }; 193023b3eb3cSopenharmony_ci } 193123b3eb3cSopenharmony_ci getAccessibilitySelected() { 193223b3eb3cSopenharmony_ci if ( 193323b3eb3cSopenharmony_ci this.getChipAccessibilitySelectedType() === 193423b3eb3cSopenharmony_ci AccessibilitySelectedType.SELECTED 193523b3eb3cSopenharmony_ci ) { 193623b3eb3cSopenharmony_ci return this.getChipActive(); 193723b3eb3cSopenharmony_ci } 193823b3eb3cSopenharmony_ci return undefined; 193923b3eb3cSopenharmony_ci } 194023b3eb3cSopenharmony_ci getAccessibilityChecked() { 194123b3eb3cSopenharmony_ci if ( 194223b3eb3cSopenharmony_ci this.getChipAccessibilitySelectedType() === 194323b3eb3cSopenharmony_ci AccessibilitySelectedType.CHECKED 194423b3eb3cSopenharmony_ci ) { 194523b3eb3cSopenharmony_ci return this.getChipActive(); 194623b3eb3cSopenharmony_ci } 194723b3eb3cSopenharmony_ci return undefined; 194823b3eb3cSopenharmony_ci } 194923b3eb3cSopenharmony_ci getChipAccessibilitySelectedType() { 195023b3eb3cSopenharmony_ci if (typeof this.chipActivated === 'undefined') { 195123b3eb3cSopenharmony_ci return AccessibilitySelectedType.CLICKED; 195223b3eb3cSopenharmony_ci } 195323b3eb3cSopenharmony_ci return ( 195423b3eb3cSopenharmony_ci this.chipAccessibilitySelectedType ?? AccessibilitySelectedType.CHECKED 195523b3eb3cSopenharmony_ci ); 195623b3eb3cSopenharmony_ci } 195723b3eb3cSopenharmony_ci getCloseIconAccessibilityLevel() { 195823b3eb3cSopenharmony_ci if (this.closeOptions?.accessibilityLevel) { 195923b3eb3cSopenharmony_ci return this.closeOptions.accessibilityLevel; 196023b3eb3cSopenharmony_ci } 196123b3eb3cSopenharmony_ci return 'yes'; 196223b3eb3cSopenharmony_ci } 196323b3eb3cSopenharmony_ci getCloseIconAccessibilityDescription() { 196423b3eb3cSopenharmony_ci if (typeof this.closeOptions?.accessibilityDescription === 'undefined') { 196523b3eb3cSopenharmony_ci return undefined; 196623b3eb3cSopenharmony_ci } 196723b3eb3cSopenharmony_ci return this.closeOptions.accessibilityDescription; 196823b3eb3cSopenharmony_ci } 196923b3eb3cSopenharmony_ci getCloseIconAccessibilityText() { 197023b3eb3cSopenharmony_ci if (typeof this.closeOptions?.accessibilityText === 'undefined') { 197123b3eb3cSopenharmony_ci return { 197223b3eb3cSopenharmony_ci id: -1, 197323b3eb3cSopenharmony_ci type: 10003, 197423b3eb3cSopenharmony_ci params: ['sys.string.delete_used_for_accessibility_text'], 197523b3eb3cSopenharmony_ci bundleName: '__harDefaultBundleName__', 197623b3eb3cSopenharmony_ci moduleName: '__harDefaultModuleName__', 197723b3eb3cSopenharmony_ci }; 197823b3eb3cSopenharmony_ci } 197923b3eb3cSopenharmony_ci return this.closeOptions.accessibilityText; 198023b3eb3cSopenharmony_ci } 198123b3eb3cSopenharmony_ci getSuffixIconAccessibilityLevel() { 198223b3eb3cSopenharmony_ci if (!this.suffixIcon?.accessibilityLevel) { 198323b3eb3cSopenharmony_ci return !this.suffixIcon?.action ? 'no' : 'yes'; 198423b3eb3cSopenharmony_ci } 198523b3eb3cSopenharmony_ci return this.suffixIcon.accessibilityLevel; 198623b3eb3cSopenharmony_ci } 198723b3eb3cSopenharmony_ci getSuffixIconAccessibilityDescription() { 198823b3eb3cSopenharmony_ci if (typeof this.suffixIcon?.accessibilityDescription === 'undefined') { 198923b3eb3cSopenharmony_ci return undefined; 199023b3eb3cSopenharmony_ci } 199123b3eb3cSopenharmony_ci return this.suffixIcon.accessibilityDescription; 199223b3eb3cSopenharmony_ci } 199323b3eb3cSopenharmony_ci getSuffixIconAccessibilityText() { 199423b3eb3cSopenharmony_ci if (typeof this.suffixIcon?.accessibilityText === 'undefined') { 199523b3eb3cSopenharmony_ci return undefined; 199623b3eb3cSopenharmony_ci } 199723b3eb3cSopenharmony_ci return this.suffixIcon.accessibilityText; 199823b3eb3cSopenharmony_ci } 199923b3eb3cSopenharmony_ci getAccessibilityLevel() { 200023b3eb3cSopenharmony_ci return this.chipAccessibilityLevel; 200123b3eb3cSopenharmony_ci } 200223b3eb3cSopenharmony_ci getAccessibilityDescription() { 200323b3eb3cSopenharmony_ci if (typeof this.chipAccessibilityDescription === 'undefined') { 200423b3eb3cSopenharmony_ci return undefined; 200523b3eb3cSopenharmony_ci } 200623b3eb3cSopenharmony_ci return this.chipAccessibilityDescription; 200723b3eb3cSopenharmony_ci } 200823b3eb3cSopenharmony_ci initialRender() { 200923b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 201023b3eb3cSopenharmony_ci If.create(); 201123b3eb3cSopenharmony_ci if (!this.deleteChip) { 201223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 201323b3eb3cSopenharmony_ci this.chipBuilder.bind(this)(); 201423b3eb3cSopenharmony_ci }); 201523b3eb3cSopenharmony_ci } else { 201623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => {}); 201723b3eb3cSopenharmony_ci } 201823b3eb3cSopenharmony_ci }, If); 201923b3eb3cSopenharmony_ci If.pop(); 202023b3eb3cSopenharmony_ci } 202123b3eb3cSopenharmony_ci rerender() { 202223b3eb3cSopenharmony_ci this.updateDirtyElements(); 202323b3eb3cSopenharmony_ci } 202423b3eb3cSopenharmony_ci} 202523b3eb3cSopenharmony_ci 202623b3eb3cSopenharmony_ciexport default { 202723b3eb3cSopenharmony_ci Chip, 202823b3eb3cSopenharmony_ci ChipSize, 202923b3eb3cSopenharmony_ci AccessibilitySelectedType, 203023b3eb3cSopenharmony_ci}; 2031