123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2023 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_civar j = (this && this.j) || function (t3, target, key, desc) { 1723b3eb3cSopenharmony_ci var c = arguments.length, 1823b3eb3cSopenharmony_ci r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; 1923b3eb3cSopenharmony_ci if (typeof Reflect === "object" && typeof Reflect.o1 === "function") { 2023b3eb3cSopenharmony_ci r = Reflect.o1(t3, target, key, desc); 2123b3eb3cSopenharmony_ci } else { 2223b3eb3cSopenharmony_ci for (var u3 = t3.length - 1; u3 >= 0; u3--) { 2323b3eb3cSopenharmony_ci if (d = t3[u3]) { 2423b3eb3cSopenharmony_ci r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; 2523b3eb3cSopenharmony_ci } 2623b3eb3cSopenharmony_ci } 2723b3eb3cSopenharmony_ci } 2823b3eb3cSopenharmony_ci return c > 3 && r && Object.defineProperty(target, key, r), r; 2923b3eb3cSopenharmony_ci}; 3023b3eb3cSopenharmony_civar m, o; 3123b3eb3cSopenharmony_ciif (!("finalizeConstruction" in ViewPU.prototype)) { 3223b3eb3cSopenharmony_ci Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { 3323b3eb3cSopenharmony_ci }); 3423b3eb3cSopenharmony_ci} 3523b3eb3cSopenharmony_ciconst curves = globalThis.requireNativeModule('ohos.curves'); 3623b3eb3cSopenharmony_ciconst KeyCode = globalThis.requireNapi('multimodalInput.keyCode').KeyCode; 3723b3eb3cSopenharmony_ciconst util = globalThis.requireNapi('util'); 3823b3eb3cSopenharmony_ciconst LengthMetrics = requireNapi('arkui.node').LengthMetrics; 3923b3eb3cSopenharmony_ciconst t = requireNapi('i18n'); 4023b3eb3cSopenharmony_ci 4123b3eb3cSopenharmony_ciconst u = 2; 4223b3eb3cSopenharmony_ciconst a1 = 5; 4323b3eb3cSopenharmony_ciconst b1 = 1; 4423b3eb3cSopenharmony_ciconst c1 = 2; 4523b3eb3cSopenharmony_ciconst d1 = 1; 4623b3eb3cSopenharmony_ciconst e1 = { 4723b3eb3cSopenharmony_ci q1: { 4823b3eb3cSopenharmony_ci "id": -1, 4923b3eb3cSopenharmony_ci "type": 10001, 5023b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_secondary'], 5123b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 5223b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 5323b3eb3cSopenharmony_ci }, 5423b3eb3cSopenharmony_ci s1: { 5523b3eb3cSopenharmony_ci "id": -1, 5623b3eb3cSopenharmony_ci "type": 10001, 5723b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_text_primary'], 5823b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 5923b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 6023b3eb3cSopenharmony_ci }, 6123b3eb3cSopenharmony_ci t1: { 6223b3eb3cSopenharmony_ci "id": -1, 6323b3eb3cSopenharmony_ci "type": 10001, 6423b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_foreground_contrary'], 6523b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 6623b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 6723b3eb3cSopenharmony_ci }, 6823b3eb3cSopenharmony_ci u1: { 6923b3eb3cSopenharmony_ci "id": -1, 7023b3eb3cSopenharmony_ci "type": 10002, 7123b3eb3cSopenharmony_ci params: ['sys.float.ohos_id_text_size_body2'], 7223b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 7323b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 7423b3eb3cSopenharmony_ci }, 7523b3eb3cSopenharmony_ci v1: { 7623b3eb3cSopenharmony_ci "id": -1, 7723b3eb3cSopenharmony_ci "type": 10002, 7823b3eb3cSopenharmony_ci params: ['sys.float.ohos_id_text_size_body2'], 7923b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 8023b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 8123b3eb3cSopenharmony_ci }, 8223b3eb3cSopenharmony_ci BACKGROUND_COLOR: { 8323b3eb3cSopenharmony_ci "id": -1, 8423b3eb3cSopenharmony_ci "type": 10001, 8523b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_button_normal'], 8623b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 8723b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 8823b3eb3cSopenharmony_ci }, 8923b3eb3cSopenharmony_ci w1: { 9023b3eb3cSopenharmony_ci "id": -1, 9123b3eb3cSopenharmony_ci "type": 10001, 9223b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_foreground_contrary'], 9323b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 9423b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 9523b3eb3cSopenharmony_ci }, 9623b3eb3cSopenharmony_ci z1: { 9723b3eb3cSopenharmony_ci "id": -1, 9823b3eb3cSopenharmony_ci "type": 10001, 9923b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_emphasize'], 10023b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 10123b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 10223b3eb3cSopenharmony_ci }, 10323b3eb3cSopenharmony_ci a2: { 10423b3eb3cSopenharmony_ci "id": -1, 10523b3eb3cSopenharmony_ci "type": 10001, 10623b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_focused_outline'], 10723b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 10823b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 10923b3eb3cSopenharmony_ci }, 11023b3eb3cSopenharmony_ci b2: { 11123b3eb3cSopenharmony_ci "id": -1, 11223b3eb3cSopenharmony_ci "type": 10001, 11323b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_hover'], 11423b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 11523b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 11623b3eb3cSopenharmony_ci }, 11723b3eb3cSopenharmony_ci c2: { 11823b3eb3cSopenharmony_ci "id": -1, 11923b3eb3cSopenharmony_ci "type": 10001, 12023b3eb3cSopenharmony_ci params: ['sys.color.ohos_id_color_click_effect'], 12123b3eb3cSopenharmony_ci "bundleName": "__harDefaultBundleName__", 12223b3eb3cSopenharmony_ci "moduleName": "__harDefaultModuleName__" 12323b3eb3cSopenharmony_ci }, 12423b3eb3cSopenharmony_ci d2: BlurStyle.NONE 12523b3eb3cSopenharmony_ci}; 12623b3eb3cSopenharmony_ci 12723b3eb3cSopenharmony_cifunction i(first, second) { 12823b3eb3cSopenharmony_ci return Math.abs(first - second) < 0.001; 12923b3eb3cSopenharmony_ci} 13023b3eb3cSopenharmony_ci 13123b3eb3cSopenharmony_cilet SegmentButtonItemOptions = class SegmentButtonItemOptions { 13223b3eb3cSopenharmony_ci constructor(options) { 13323b3eb3cSopenharmony_ci this.icon = options.icon; 13423b3eb3cSopenharmony_ci this.selectedIcon = options.selectedIcon; 13523b3eb3cSopenharmony_ci this.text = options.text; 13623b3eb3cSopenharmony_ci this.iconAccessibilityText = options.iconAccessibilityText; 13723b3eb3cSopenharmony_ci this.selectedIconAccessibilityText = options.selectedIconAccessibilityText; 13823b3eb3cSopenharmony_ci this.accessibilityLevel = options.accessibilityLevel; 13923b3eb3cSopenharmony_ci this.accessibilityDescription = options.accessibilityDescription; 14023b3eb3cSopenharmony_ci } 14123b3eb3cSopenharmony_ci}; 14223b3eb3cSopenharmony_ciSegmentButtonItemOptions = j([ 14323b3eb3cSopenharmony_ci Observed 14423b3eb3cSopenharmony_ci], SegmentButtonItemOptions); 14523b3eb3cSopenharmony_cilet SegmentButtonItemOptionsArray = m = class SegmentButtonItemOptionsArray extends Array { 14623b3eb3cSopenharmony_ci constructor(s3) { 14723b3eb3cSopenharmony_ci super(typeof s3 === 'number' ? s3 : 0); 14823b3eb3cSopenharmony_ci this.e2 = void 0; 14923b3eb3cSopenharmony_ci this.deleteCount = void 0; 15023b3eb3cSopenharmony_ci this.f2 = void 0; 15123b3eb3cSopenharmony_ci if (typeof s3 !== 'number' && s3 !== void 0) { 15223b3eb3cSopenharmony_ci super.push(...s3.map((element) => new SegmentButtonItemOptions(element))); 15323b3eb3cSopenharmony_ci } 15423b3eb3cSopenharmony_ci } 15523b3eb3cSopenharmony_ci 15623b3eb3cSopenharmony_ci push(...items) { 15723b3eb3cSopenharmony_ci if (this.length + items.length > a1) { 15823b3eb3cSopenharmony_ci console.warn('Exceeded the maximum number of elements (5).'); 15923b3eb3cSopenharmony_ci return this.length; 16023b3eb3cSopenharmony_ci } 16123b3eb3cSopenharmony_ci this.e2 = this.length; 16223b3eb3cSopenharmony_ci this.deleteCount = 0; 16323b3eb3cSopenharmony_ci this.f2 = items.length; 16423b3eb3cSopenharmony_ci return super.push(...items.map((element) => new SegmentButtonItemOptions(element))); 16523b3eb3cSopenharmony_ci } 16623b3eb3cSopenharmony_ci 16723b3eb3cSopenharmony_ci pop() { 16823b3eb3cSopenharmony_ci if (this.length <= u) { 16923b3eb3cSopenharmony_ci console.warn('Below the minimum number of elements (2).'); 17023b3eb3cSopenharmony_ci return void 0; 17123b3eb3cSopenharmony_ci } 17223b3eb3cSopenharmony_ci this.e2 = this.length - 1; 17323b3eb3cSopenharmony_ci this.deleteCount = 1; 17423b3eb3cSopenharmony_ci this.f2 = 0; 17523b3eb3cSopenharmony_ci return super.pop(); 17623b3eb3cSopenharmony_ci } 17723b3eb3cSopenharmony_ci 17823b3eb3cSopenharmony_ci shift() { 17923b3eb3cSopenharmony_ci if (this.length <= u) { 18023b3eb3cSopenharmony_ci console.warn('Below the minimum number of elements (2).'); 18123b3eb3cSopenharmony_ci return void 0; 18223b3eb3cSopenharmony_ci } 18323b3eb3cSopenharmony_ci this.e2 = 0; 18423b3eb3cSopenharmony_ci this.deleteCount = 1; 18523b3eb3cSopenharmony_ci this.f2 = 0; 18623b3eb3cSopenharmony_ci return super.shift(); 18723b3eb3cSopenharmony_ci } 18823b3eb3cSopenharmony_ci 18923b3eb3cSopenharmony_ci unshift(...items) { 19023b3eb3cSopenharmony_ci if (this.length + items.length > a1) { 19123b3eb3cSopenharmony_ci console.warn('Exceeded the maximum number of elements (5).'); 19223b3eb3cSopenharmony_ci return this.length; 19323b3eb3cSopenharmony_ci } 19423b3eb3cSopenharmony_ci if (items.length > 0) { 19523b3eb3cSopenharmony_ci this.e2 = 0; 19623b3eb3cSopenharmony_ci this.deleteCount = 0; 19723b3eb3cSopenharmony_ci this.f2 = items.length; 19823b3eb3cSopenharmony_ci } 19923b3eb3cSopenharmony_ci return super.unshift(...items.map((element) => new SegmentButtonItemOptions(element))); 20023b3eb3cSopenharmony_ci } 20123b3eb3cSopenharmony_ci 20223b3eb3cSopenharmony_ci splice(start, deleteCount, ...items) { 20323b3eb3cSopenharmony_ci let length = (this.length - deleteCount) < 0 ? 0 : (this.length - deleteCount); 20423b3eb3cSopenharmony_ci length += items.length; 20523b3eb3cSopenharmony_ci if (length < u) { 20623b3eb3cSopenharmony_ci console.warn('Below the minimum number of elements (2).'); 20723b3eb3cSopenharmony_ci return []; 20823b3eb3cSopenharmony_ci } 20923b3eb3cSopenharmony_ci if (length > a1) { 21023b3eb3cSopenharmony_ci console.warn('Exceeded the maximum number of elements (5).'); 21123b3eb3cSopenharmony_ci return []; 21223b3eb3cSopenharmony_ci } 21323b3eb3cSopenharmony_ci this.e2 = start; 21423b3eb3cSopenharmony_ci this.deleteCount = deleteCount; 21523b3eb3cSopenharmony_ci this.f2 = items.length; 21623b3eb3cSopenharmony_ci return super.splice(start, deleteCount, ...items); 21723b3eb3cSopenharmony_ci } 21823b3eb3cSopenharmony_ci 21923b3eb3cSopenharmony_ci static create(elements) { 22023b3eb3cSopenharmony_ci return new m(elements); 22123b3eb3cSopenharmony_ci } 22223b3eb3cSopenharmony_ci}; 22323b3eb3cSopenharmony_ciSegmentButtonItemOptionsArray = m = j([ 22423b3eb3cSopenharmony_ci Observed 22523b3eb3cSopenharmony_ci], SegmentButtonItemOptionsArray); 22623b3eb3cSopenharmony_ci 22723b3eb3cSopenharmony_ciexport { SegmentButtonItemOptionsArray }; 22823b3eb3cSopenharmony_cilet SegmentButtonOptions = o = class SegmentButtonOptions { 22923b3eb3cSopenharmony_ci get buttons() { 23023b3eb3cSopenharmony_ci return this.g2; 23123b3eb3cSopenharmony_ci } 23223b3eb3cSopenharmony_ci 23323b3eb3cSopenharmony_ci set buttons(val) { 23423b3eb3cSopenharmony_ci if (this.g2 !== void 0 && this.g2 !== val) { 23523b3eb3cSopenharmony_ci this.h2?.(); 23623b3eb3cSopenharmony_ci } 23723b3eb3cSopenharmony_ci this.g2 = val; 23823b3eb3cSopenharmony_ci } 23923b3eb3cSopenharmony_ci 24023b3eb3cSopenharmony_ci constructor(options) { 24123b3eb3cSopenharmony_ci this.multiply = false; 24223b3eb3cSopenharmony_ci this.i2 = false; 24323b3eb3cSopenharmony_ci this.showIcon = false; 24423b3eb3cSopenharmony_ci this.g2 = void 0; 24523b3eb3cSopenharmony_ci this.fontColor = options.fontColor ?? e1.q1; 24623b3eb3cSopenharmony_ci this.selectedFontColor = options.selectedFontColor ?? e1.s1; 24723b3eb3cSopenharmony_ci this.fontSize = options.fontSize ?? e1.u1; 24823b3eb3cSopenharmony_ci this.selectedFontSize = options.selectedFontSize ?? e1.v1; 24923b3eb3cSopenharmony_ci this.fontWeight = options.fontWeight ?? FontWeight.Regular; 25023b3eb3cSopenharmony_ci this.selectedFontWeight = options.selectedFontWeight ?? FontWeight.Medium; 25123b3eb3cSopenharmony_ci this.backgroundColor = options.backgroundColor ?? e1.BACKGROUND_COLOR; 25223b3eb3cSopenharmony_ci this.selectedBackgroundColor = options.selectedBackgroundColor ?? e1.w1; 25323b3eb3cSopenharmony_ci this.imageSize = options.imageSize ?? { width: 24, height: 24 }; 25423b3eb3cSopenharmony_ci this.buttonPadding = options.buttonPadding; 25523b3eb3cSopenharmony_ci this.textPadding = options.textPadding; 25623b3eb3cSopenharmony_ci this.type = options.type; 25723b3eb3cSopenharmony_ci this.backgroundBlurStyle = options.backgroundBlurStyle ?? e1.d2; 25823b3eb3cSopenharmony_ci this.localizedTextPadding = options.localizedTextPadding; 25923b3eb3cSopenharmony_ci this.localizedButtonPadding = options.localizedButtonPadding; 26023b3eb3cSopenharmony_ci this.direction = options.direction ?? Direction.Auto; 26123b3eb3cSopenharmony_ci this.buttons = new SegmentButtonItemOptionsArray(options.buttons); 26223b3eb3cSopenharmony_ci if (this.type === 'capsule') { 26323b3eb3cSopenharmony_ci this.multiply = options.multiply ?? false; 26423b3eb3cSopenharmony_ci this.buttons.forEach(button => { 26523b3eb3cSopenharmony_ci this.i2 ||= button.text !== void 0; 26623b3eb3cSopenharmony_ci this.showIcon ||= button.icon !== void 0 || button.selectedIcon !== void 0; 26723b3eb3cSopenharmony_ci }); 26823b3eb3cSopenharmony_ci if (this.i2 && this.showIcon) { 26923b3eb3cSopenharmony_ci this.j2 = 12; 27023b3eb3cSopenharmony_ci this.l2 = 14; 27123b3eb3cSopenharmony_ci } 27223b3eb3cSopenharmony_ci this.selectedFontColor = options.selectedFontColor ?? e1.t1; 27323b3eb3cSopenharmony_ci this.selectedBackgroundColor = options.selectedBackgroundColor ?? 27423b3eb3cSopenharmony_ci e1.z1; 27523b3eb3cSopenharmony_ci } else { 27623b3eb3cSopenharmony_ci this.i2 = true; 27723b3eb3cSopenharmony_ci } 27823b3eb3cSopenharmony_ci this.m2 = this.multiply ? 0 : 2; 27923b3eb3cSopenharmony_ci } 28023b3eb3cSopenharmony_ci 28123b3eb3cSopenharmony_ci static tab(options) { 28223b3eb3cSopenharmony_ci return new o({ 28323b3eb3cSopenharmony_ci type: 'tab', 28423b3eb3cSopenharmony_ci buttons: options.buttons, 28523b3eb3cSopenharmony_ci fontColor: options.fontColor, 28623b3eb3cSopenharmony_ci selectedFontColor: options.selectedFontColor, 28723b3eb3cSopenharmony_ci fontSize: options.fontSize, 28823b3eb3cSopenharmony_ci selectedFontSize: options.selectedFontSize, 28923b3eb3cSopenharmony_ci fontWeight: options.fontWeight, 29023b3eb3cSopenharmony_ci selectedFontWeight: options.selectedFontWeight, 29123b3eb3cSopenharmony_ci backgroundColor: options.backgroundColor, 29223b3eb3cSopenharmony_ci selectedBackgroundColor: options.selectedBackgroundColor, 29323b3eb3cSopenharmony_ci imageSize: options.imageSize, 29423b3eb3cSopenharmony_ci buttonPadding: options.buttonPadding, 29523b3eb3cSopenharmony_ci textPadding: options.textPadding, 29623b3eb3cSopenharmony_ci localizedTextPadding: options.localizedTextPadding, 29723b3eb3cSopenharmony_ci localizedButtonPadding: options.localizedButtonPadding, 29823b3eb3cSopenharmony_ci backgroundBlurStyle: options.backgroundBlurStyle, 29923b3eb3cSopenharmony_ci direction: options.direction 30023b3eb3cSopenharmony_ci }); 30123b3eb3cSopenharmony_ci } 30223b3eb3cSopenharmony_ci 30323b3eb3cSopenharmony_ci static capsule(options) { 30423b3eb3cSopenharmony_ci return new o({ 30523b3eb3cSopenharmony_ci type: 'capsule', 30623b3eb3cSopenharmony_ci buttons: options.buttons, 30723b3eb3cSopenharmony_ci multiply: options.multiply, 30823b3eb3cSopenharmony_ci fontColor: options.fontColor, 30923b3eb3cSopenharmony_ci selectedFontColor: options.selectedFontColor, 31023b3eb3cSopenharmony_ci fontSize: options.fontSize, 31123b3eb3cSopenharmony_ci selectedFontSize: options.selectedFontSize, 31223b3eb3cSopenharmony_ci fontWeight: options.fontWeight, 31323b3eb3cSopenharmony_ci selectedFontWeight: options.selectedFontWeight, 31423b3eb3cSopenharmony_ci backgroundColor: options.backgroundColor, 31523b3eb3cSopenharmony_ci selectedBackgroundColor: options.selectedBackgroundColor, 31623b3eb3cSopenharmony_ci imageSize: options.imageSize, 31723b3eb3cSopenharmony_ci buttonPadding: options.buttonPadding, 31823b3eb3cSopenharmony_ci textPadding: options.textPadding, 31923b3eb3cSopenharmony_ci localizedTextPadding: options.localizedTextPadding, 32023b3eb3cSopenharmony_ci localizedButtonPadding: options.localizedButtonPadding, 32123b3eb3cSopenharmony_ci backgroundBlurStyle: options.backgroundBlurStyle, 32223b3eb3cSopenharmony_ci direction: options.direction 32323b3eb3cSopenharmony_ci }); 32423b3eb3cSopenharmony_ci } 32523b3eb3cSopenharmony_ci}; 32623b3eb3cSopenharmony_ciSegmentButtonOptions = o = j([ 32723b3eb3cSopenharmony_ci Observed 32823b3eb3cSopenharmony_ci], SegmentButtonOptions); 32923b3eb3cSopenharmony_ci 33023b3eb3cSopenharmony_ciexport { SegmentButtonOptions }; 33123b3eb3cSopenharmony_ci 33223b3eb3cSopenharmony_ciclass f1 extends ViewPU { 33323b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 33423b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 33523b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 33623b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 33723b3eb3cSopenharmony_ci } 33823b3eb3cSopenharmony_ci this.n2 = new SynchedPropertyNesedObjectPU(params.optionsArray, this, "optionsArray"); 33923b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 34023b3eb3cSopenharmony_ci this.q2 = this.initializeConsume("buttonBorderRadius", "buttonBorderRadius"); 34123b3eb3cSopenharmony_ci this.s2 = this.initializeConsume("buttonItemsSize", "buttonItemsSize"); 34223b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 34323b3eb3cSopenharmony_ci this.finalizeConstruction(); 34423b3eb3cSopenharmony_ci } 34523b3eb3cSopenharmony_ci 34623b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 34723b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 34823b3eb3cSopenharmony_ci this.o2.set(params.options); 34923b3eb3cSopenharmony_ci } 35023b3eb3cSopenharmony_ci 35123b3eb3cSopenharmony_ci updateStateVars(params) { 35223b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 35323b3eb3cSopenharmony_ci this.o2.set(params.options); 35423b3eb3cSopenharmony_ci } 35523b3eb3cSopenharmony_ci 35623b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 35723b3eb3cSopenharmony_ci this.n2.purgeDependencyOnElmtId(rmElmtId); 35823b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 35923b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 36023b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 36123b3eb3cSopenharmony_ci } 36223b3eb3cSopenharmony_ci 36323b3eb3cSopenharmony_ci aboutToBeDeleted() { 36423b3eb3cSopenharmony_ci this.n2.aboutToBeDeleted(); 36523b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 36623b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 36723b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 36823b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 36923b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 37023b3eb3cSopenharmony_ci } 37123b3eb3cSopenharmony_ci 37223b3eb3cSopenharmony_ci get optionsArray() { 37323b3eb3cSopenharmony_ci return this.n2.get(); 37423b3eb3cSopenharmony_ci } 37523b3eb3cSopenharmony_ci 37623b3eb3cSopenharmony_ci get options() { 37723b3eb3cSopenharmony_ci return this.o2.get(); 37823b3eb3cSopenharmony_ci } 37923b3eb3cSopenharmony_ci 38023b3eb3cSopenharmony_ci get buttonBorderRadius() { 38123b3eb3cSopenharmony_ci return this.q2.get(); 38223b3eb3cSopenharmony_ci } 38323b3eb3cSopenharmony_ci 38423b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 38523b3eb3cSopenharmony_ci this.q2.set(newValue); 38623b3eb3cSopenharmony_ci } 38723b3eb3cSopenharmony_ci 38823b3eb3cSopenharmony_ci get buttonItemsSize() { 38923b3eb3cSopenharmony_ci return this.s2.get(); 39023b3eb3cSopenharmony_ci } 39123b3eb3cSopenharmony_ci 39223b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 39323b3eb3cSopenharmony_ci this.s2.set(newValue); 39423b3eb3cSopenharmony_ci } 39523b3eb3cSopenharmony_ci 39623b3eb3cSopenharmony_ci initialRender() { 39723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 39823b3eb3cSopenharmony_ci Row.create({ space: 1 }); 39923b3eb3cSopenharmony_ci Row.direction(this.options.direction); 40023b3eb3cSopenharmony_ci Row.padding(this.options.m2); 40123b3eb3cSopenharmony_ci }, Row); 40223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 40323b3eb3cSopenharmony_ci ForEach.create(); 40423b3eb3cSopenharmony_ci const forEachItemGenFunction = (_item, index) => { 40523b3eb3cSopenharmony_ci const r3 = _item; 40623b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 40723b3eb3cSopenharmony_ci If.create(); 40823b3eb3cSopenharmony_ci if (index < a1) { 40923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 41023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 41123b3eb3cSopenharmony_ci Stack.create(); 41223b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 41323b3eb3cSopenharmony_ci Stack.layoutWeight(1); 41423b3eb3cSopenharmony_ci Stack.height(this.buttonItemsSize[index].height); 41523b3eb3cSopenharmony_ci Stack.backgroundColor(this.options.backgroundColor ?? e1.BACKGROUND_COLOR); 41623b3eb3cSopenharmony_ci Stack.borderRadius(this.buttonBorderRadius[index]); 41723b3eb3cSopenharmony_ci Stack.backgroundBlurStyle(this.options.backgroundBlurStyle); 41823b3eb3cSopenharmony_ci }, Stack); 41923b3eb3cSopenharmony_ci Stack.pop(); 42023b3eb3cSopenharmony_ci }); 42123b3eb3cSopenharmony_ci } else { 42223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 42323b3eb3cSopenharmony_ci }); 42423b3eb3cSopenharmony_ci } 42523b3eb3cSopenharmony_ci }, If); 42623b3eb3cSopenharmony_ci If.pop(); 42723b3eb3cSopenharmony_ci }; 42823b3eb3cSopenharmony_ci this.forEachUpdateFunction(elmtId, this.optionsArray, forEachItemGenFunction, undefined, true, false); 42923b3eb3cSopenharmony_ci }, ForEach); 43023b3eb3cSopenharmony_ci ForEach.pop(); 43123b3eb3cSopenharmony_ci Row.pop(); 43223b3eb3cSopenharmony_ci } 43323b3eb3cSopenharmony_ci 43423b3eb3cSopenharmony_ci rerender() { 43523b3eb3cSopenharmony_ci this.updateDirtyElements(); 43623b3eb3cSopenharmony_ci } 43723b3eb3cSopenharmony_ci} 43823b3eb3cSopenharmony_ci 43923b3eb3cSopenharmony_ciclass g1 extends ViewPU { 44023b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 44123b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 44223b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 44323b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 44423b3eb3cSopenharmony_ci } 44523b3eb3cSopenharmony_ci this.n2 = new SynchedPropertyNesedObjectPU(params.optionsArray, this, "optionsArray"); 44623b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 44723b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectTwoWayPU(params.selectedIndexes, this, "selectedIndexes"); 44823b3eb3cSopenharmony_ci this.s2 = this.initializeConsume("buttonItemsSize", "buttonItemsSize"); 44923b3eb3cSopenharmony_ci this.u2 = this.initializeConsume("selectedItemPosition", "selectedItemPosition"); 45023b3eb3cSopenharmony_ci this.v2 = this.initializeConsume("zoomScaleArray", "zoomScaleArray"); 45123b3eb3cSopenharmony_ci this.q2 = this.initializeConsume("buttonBorderRadius", "buttonBorderRadius"); 45223b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 45323b3eb3cSopenharmony_ci this.finalizeConstruction(); 45423b3eb3cSopenharmony_ci } 45523b3eb3cSopenharmony_ci 45623b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 45723b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 45823b3eb3cSopenharmony_ci this.o2.set(params.options); 45923b3eb3cSopenharmony_ci } 46023b3eb3cSopenharmony_ci 46123b3eb3cSopenharmony_ci updateStateVars(params) { 46223b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 46323b3eb3cSopenharmony_ci this.o2.set(params.options); 46423b3eb3cSopenharmony_ci } 46523b3eb3cSopenharmony_ci 46623b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 46723b3eb3cSopenharmony_ci this.n2.purgeDependencyOnElmtId(rmElmtId); 46823b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 46923b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 47023b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 47123b3eb3cSopenharmony_ci this.u2.purgeDependencyOnElmtId(rmElmtId); 47223b3eb3cSopenharmony_ci this.v2.purgeDependencyOnElmtId(rmElmtId); 47323b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 47423b3eb3cSopenharmony_ci } 47523b3eb3cSopenharmony_ci 47623b3eb3cSopenharmony_ci aboutToBeDeleted() { 47723b3eb3cSopenharmony_ci this.n2.aboutToBeDeleted(); 47823b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 47923b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 48023b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 48123b3eb3cSopenharmony_ci this.u2.aboutToBeDeleted(); 48223b3eb3cSopenharmony_ci this.v2.aboutToBeDeleted(); 48323b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 48423b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 48523b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 48623b3eb3cSopenharmony_ci } 48723b3eb3cSopenharmony_ci 48823b3eb3cSopenharmony_ci get optionsArray() { 48923b3eb3cSopenharmony_ci return this.n2.get(); 49023b3eb3cSopenharmony_ci } 49123b3eb3cSopenharmony_ci 49223b3eb3cSopenharmony_ci get options() { 49323b3eb3cSopenharmony_ci return this.o2.get(); 49423b3eb3cSopenharmony_ci } 49523b3eb3cSopenharmony_ci 49623b3eb3cSopenharmony_ci get selectedIndexes() { 49723b3eb3cSopenharmony_ci return this.t2.get(); 49823b3eb3cSopenharmony_ci } 49923b3eb3cSopenharmony_ci 50023b3eb3cSopenharmony_ci set selectedIndexes(newValue) { 50123b3eb3cSopenharmony_ci this.t2.set(newValue); 50223b3eb3cSopenharmony_ci } 50323b3eb3cSopenharmony_ci 50423b3eb3cSopenharmony_ci get buttonItemsSize() { 50523b3eb3cSopenharmony_ci return this.s2.get(); 50623b3eb3cSopenharmony_ci } 50723b3eb3cSopenharmony_ci 50823b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 50923b3eb3cSopenharmony_ci this.s2.set(newValue); 51023b3eb3cSopenharmony_ci } 51123b3eb3cSopenharmony_ci 51223b3eb3cSopenharmony_ci get selectedItemPosition() { 51323b3eb3cSopenharmony_ci return this.u2.get(); 51423b3eb3cSopenharmony_ci } 51523b3eb3cSopenharmony_ci 51623b3eb3cSopenharmony_ci set selectedItemPosition(newValue) { 51723b3eb3cSopenharmony_ci this.u2.set(newValue); 51823b3eb3cSopenharmony_ci } 51923b3eb3cSopenharmony_ci 52023b3eb3cSopenharmony_ci get zoomScaleArray() { 52123b3eb3cSopenharmony_ci return this.v2.get(); 52223b3eb3cSopenharmony_ci } 52323b3eb3cSopenharmony_ci 52423b3eb3cSopenharmony_ci set zoomScaleArray(newValue) { 52523b3eb3cSopenharmony_ci this.v2.set(newValue); 52623b3eb3cSopenharmony_ci } 52723b3eb3cSopenharmony_ci 52823b3eb3cSopenharmony_ci get buttonBorderRadius() { 52923b3eb3cSopenharmony_ci return this.q2.get(); 53023b3eb3cSopenharmony_ci } 53123b3eb3cSopenharmony_ci 53223b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 53323b3eb3cSopenharmony_ci this.q2.set(newValue); 53423b3eb3cSopenharmony_ci } 53523b3eb3cSopenharmony_ci 53623b3eb3cSopenharmony_ci initialRender() { 53723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 53823b3eb3cSopenharmony_ci If.create(); 53923b3eb3cSopenharmony_ci if (this.selectedIndexes !== void 0 && this.selectedIndexes.length !== 0) { 54023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 54123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 54223b3eb3cSopenharmony_ci Stack.create(); 54323b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 54423b3eb3cSopenharmony_ci Stack.borderRadius(this.buttonBorderRadius[this.selectedIndexes[0]]); 54523b3eb3cSopenharmony_ci Stack.size(this.buttonItemsSize[this.selectedIndexes[0]]); 54623b3eb3cSopenharmony_ci Stack.backgroundColor(this.options.selectedBackgroundColor ?? 54723b3eb3cSopenharmony_ci (this.options.type === 'tab' ? e1.w1 : 54823b3eb3cSopenharmony_ci e1.z1)); 54923b3eb3cSopenharmony_ci Stack.position(ObservedObject.GetRawObject(this.selectedItemPosition)); 55023b3eb3cSopenharmony_ci Stack.scale({ 55123b3eb3cSopenharmony_ci x: this.zoomScaleArray[this.selectedIndexes[0]], 55223b3eb3cSopenharmony_ci y: this.zoomScaleArray[this.selectedIndexes[0]] 55323b3eb3cSopenharmony_ci }); 55423b3eb3cSopenharmony_ci Stack.shadow(ShadowStyle.OUTER_DEFAULT_XS); 55523b3eb3cSopenharmony_ci }, Stack); 55623b3eb3cSopenharmony_ci Stack.pop(); 55723b3eb3cSopenharmony_ci }); 55823b3eb3cSopenharmony_ci } else { 55923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 56023b3eb3cSopenharmony_ci }); 56123b3eb3cSopenharmony_ci } 56223b3eb3cSopenharmony_ci }, If); 56323b3eb3cSopenharmony_ci If.pop(); 56423b3eb3cSopenharmony_ci } 56523b3eb3cSopenharmony_ci 56623b3eb3cSopenharmony_ci rerender() { 56723b3eb3cSopenharmony_ci this.updateDirtyElements(); 56823b3eb3cSopenharmony_ci } 56923b3eb3cSopenharmony_ci} 57023b3eb3cSopenharmony_ci 57123b3eb3cSopenharmony_ciclass h1 extends ViewPU { 57223b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 57323b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 57423b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 57523b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 57623b3eb3cSopenharmony_ci } 57723b3eb3cSopenharmony_ci this.n2 = new SynchedPropertyNesedObjectPU(params.optionsArray, this, "optionsArray"); 57823b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 57923b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectTwoWayPU(params.selectedIndexes, this, "selectedIndexes"); 58023b3eb3cSopenharmony_ci this.s2 = this.initializeConsume("buttonItemsSize", "buttonItemsSize"); 58123b3eb3cSopenharmony_ci this.v2 = this.initializeConsume("zoomScaleArray", "zoomScaleArray"); 58223b3eb3cSopenharmony_ci this.q2 = this.initializeConsume("buttonBorderRadius", "buttonBorderRadius"); 58323b3eb3cSopenharmony_ci this.w2 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (q3, index) => Color.Transparent), this, 58423b3eb3cSopenharmony_ci "multiColor"); 58523b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 58623b3eb3cSopenharmony_ci this.declareWatch("options", this.onOptionsChange); 58723b3eb3cSopenharmony_ci this.declareWatch("selectedIndexes", this.onSelectedChange); 58823b3eb3cSopenharmony_ci this.finalizeConstruction(); 58923b3eb3cSopenharmony_ci } 59023b3eb3cSopenharmony_ci 59123b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 59223b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 59323b3eb3cSopenharmony_ci this.o2.set(params.options); 59423b3eb3cSopenharmony_ci if (params.multiColor !== undefined) { 59523b3eb3cSopenharmony_ci this.multiColor = params.multiColor; 59623b3eb3cSopenharmony_ci } 59723b3eb3cSopenharmony_ci } 59823b3eb3cSopenharmony_ci 59923b3eb3cSopenharmony_ci updateStateVars(params) { 60023b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 60123b3eb3cSopenharmony_ci this.o2.set(params.options); 60223b3eb3cSopenharmony_ci } 60323b3eb3cSopenharmony_ci 60423b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 60523b3eb3cSopenharmony_ci this.n2.purgeDependencyOnElmtId(rmElmtId); 60623b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 60723b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 60823b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 60923b3eb3cSopenharmony_ci this.v2.purgeDependencyOnElmtId(rmElmtId); 61023b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 61123b3eb3cSopenharmony_ci this.w2.purgeDependencyOnElmtId(rmElmtId); 61223b3eb3cSopenharmony_ci } 61323b3eb3cSopenharmony_ci 61423b3eb3cSopenharmony_ci aboutToBeDeleted() { 61523b3eb3cSopenharmony_ci this.n2.aboutToBeDeleted(); 61623b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 61723b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 61823b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 61923b3eb3cSopenharmony_ci this.v2.aboutToBeDeleted(); 62023b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 62123b3eb3cSopenharmony_ci this.w2.aboutToBeDeleted(); 62223b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 62323b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 62423b3eb3cSopenharmony_ci } 62523b3eb3cSopenharmony_ci 62623b3eb3cSopenharmony_ci get optionsArray() { 62723b3eb3cSopenharmony_ci return this.n2.get(); 62823b3eb3cSopenharmony_ci } 62923b3eb3cSopenharmony_ci 63023b3eb3cSopenharmony_ci get options() { 63123b3eb3cSopenharmony_ci return this.o2.get(); 63223b3eb3cSopenharmony_ci } 63323b3eb3cSopenharmony_ci 63423b3eb3cSopenharmony_ci get selectedIndexes() { 63523b3eb3cSopenharmony_ci return this.t2.get(); 63623b3eb3cSopenharmony_ci } 63723b3eb3cSopenharmony_ci 63823b3eb3cSopenharmony_ci set selectedIndexes(newValue) { 63923b3eb3cSopenharmony_ci this.t2.set(newValue); 64023b3eb3cSopenharmony_ci } 64123b3eb3cSopenharmony_ci 64223b3eb3cSopenharmony_ci get buttonItemsSize() { 64323b3eb3cSopenharmony_ci return this.s2.get(); 64423b3eb3cSopenharmony_ci } 64523b3eb3cSopenharmony_ci 64623b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 64723b3eb3cSopenharmony_ci this.s2.set(newValue); 64823b3eb3cSopenharmony_ci } 64923b3eb3cSopenharmony_ci 65023b3eb3cSopenharmony_ci get zoomScaleArray() { 65123b3eb3cSopenharmony_ci return this.v2.get(); 65223b3eb3cSopenharmony_ci } 65323b3eb3cSopenharmony_ci 65423b3eb3cSopenharmony_ci set zoomScaleArray(newValue) { 65523b3eb3cSopenharmony_ci this.v2.set(newValue); 65623b3eb3cSopenharmony_ci } 65723b3eb3cSopenharmony_ci 65823b3eb3cSopenharmony_ci get buttonBorderRadius() { 65923b3eb3cSopenharmony_ci return this.q2.get(); 66023b3eb3cSopenharmony_ci } 66123b3eb3cSopenharmony_ci 66223b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 66323b3eb3cSopenharmony_ci this.q2.set(newValue); 66423b3eb3cSopenharmony_ci } 66523b3eb3cSopenharmony_ci 66623b3eb3cSopenharmony_ci get multiColor() { 66723b3eb3cSopenharmony_ci return this.w2.get(); 66823b3eb3cSopenharmony_ci } 66923b3eb3cSopenharmony_ci 67023b3eb3cSopenharmony_ci set multiColor(newValue) { 67123b3eb3cSopenharmony_ci this.w2.set(newValue); 67223b3eb3cSopenharmony_ci } 67323b3eb3cSopenharmony_ci 67423b3eb3cSopenharmony_ci onOptionsChange() { 67523b3eb3cSopenharmony_ci for (let p3 = 0; p3 < this.selectedIndexes.length; p3++) { 67623b3eb3cSopenharmony_ci this.multiColor[this.selectedIndexes[p3]] = this.options.selectedBackgroundColor ?? 67723b3eb3cSopenharmony_ci e1.z1; 67823b3eb3cSopenharmony_ci } 67923b3eb3cSopenharmony_ci } 68023b3eb3cSopenharmony_ci 68123b3eb3cSopenharmony_ci onSelectedChange() { 68223b3eb3cSopenharmony_ci for (let n3 = 0; n3 < a1; n3++) { 68323b3eb3cSopenharmony_ci this.multiColor[n3] = Color.Transparent; 68423b3eb3cSopenharmony_ci } 68523b3eb3cSopenharmony_ci for (let m3 = 0; m3 < this.selectedIndexes.length; m3++) { 68623b3eb3cSopenharmony_ci this.multiColor[this.selectedIndexes[m3]] = this.options.selectedBackgroundColor ?? 68723b3eb3cSopenharmony_ci e1.z1; 68823b3eb3cSopenharmony_ci } 68923b3eb3cSopenharmony_ci } 69023b3eb3cSopenharmony_ci 69123b3eb3cSopenharmony_ci aboutToAppear() { 69223b3eb3cSopenharmony_ci for (let l3 = 0; l3 < this.selectedIndexes.length; l3++) { 69323b3eb3cSopenharmony_ci this.multiColor[this.selectedIndexes[l3]] = this.options.selectedBackgroundColor ?? 69423b3eb3cSopenharmony_ci e1.z1; 69523b3eb3cSopenharmony_ci } 69623b3eb3cSopenharmony_ci } 69723b3eb3cSopenharmony_ci 69823b3eb3cSopenharmony_ci initialRender() { 69923b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 70023b3eb3cSopenharmony_ci Row.create({ space: 1 }); 70123b3eb3cSopenharmony_ci Row.direction(this.options.direction); 70223b3eb3cSopenharmony_ci Row.padding(this.options.m2); 70323b3eb3cSopenharmony_ci }, Row); 70423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 70523b3eb3cSopenharmony_ci ForEach.create(); 70623b3eb3cSopenharmony_ci const forEachItemGenFunction = (_item, index) => { 70723b3eb3cSopenharmony_ci const k3 = _item; 70823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 70923b3eb3cSopenharmony_ci If.create(); 71023b3eb3cSopenharmony_ci if (index < a1) { 71123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 71223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 71323b3eb3cSopenharmony_ci Stack.create(); 71423b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 71523b3eb3cSopenharmony_ci Stack.width(this.buttonItemsSize[index].width); 71623b3eb3cSopenharmony_ci Stack.height(this.buttonItemsSize[index].height); 71723b3eb3cSopenharmony_ci Stack.backgroundColor(this.multiColor[index]); 71823b3eb3cSopenharmony_ci Stack.borderRadius(this.buttonBorderRadius[index]); 71923b3eb3cSopenharmony_ci }, Stack); 72023b3eb3cSopenharmony_ci Stack.pop(); 72123b3eb3cSopenharmony_ci }); 72223b3eb3cSopenharmony_ci } else { 72323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 72423b3eb3cSopenharmony_ci }); 72523b3eb3cSopenharmony_ci } 72623b3eb3cSopenharmony_ci }, If); 72723b3eb3cSopenharmony_ci If.pop(); 72823b3eb3cSopenharmony_ci }; 72923b3eb3cSopenharmony_ci this.forEachUpdateFunction(elmtId, this.optionsArray, forEachItemGenFunction, undefined, true, false); 73023b3eb3cSopenharmony_ci }, ForEach); 73123b3eb3cSopenharmony_ci ForEach.pop(); 73223b3eb3cSopenharmony_ci Row.pop(); 73323b3eb3cSopenharmony_ci } 73423b3eb3cSopenharmony_ci 73523b3eb3cSopenharmony_ci rerender() { 73623b3eb3cSopenharmony_ci this.updateDirtyElements(); 73723b3eb3cSopenharmony_ci } 73823b3eb3cSopenharmony_ci} 73923b3eb3cSopenharmony_ci 74023b3eb3cSopenharmony_ciclass i1 extends ViewPU { 74123b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 74223b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 74323b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 74423b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 74523b3eb3cSopenharmony_ci } 74623b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectTwoWayPU(params.selectedIndexes, this, "selectedIndexes"); 74723b3eb3cSopenharmony_ci this.z2 = new SynchedPropertySimpleTwoWayPU(params.focusIndex, this, "focusIndex"); 74823b3eb3cSopenharmony_ci this.a3 = new SynchedPropertyObjectOneWayPU(params.maxFontScale, this, "maxFontScale"); 74923b3eb3cSopenharmony_ci this.b3 = new SynchedPropertyNesedObjectPU(params.itemOptions, this, "itemOptions"); 75023b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 75123b3eb3cSopenharmony_ci this.c3 = new SynchedPropertyNesedObjectPU(params.property, this, "property"); 75223b3eb3cSopenharmony_ci this.d3 = new SynchedPropertySimpleOneWayPU(params.index, this, "index"); 75323b3eb3cSopenharmony_ci this.groupId = ''; 75423b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 75523b3eb3cSopenharmony_ci this.finalizeConstruction(); 75623b3eb3cSopenharmony_ci } 75723b3eb3cSopenharmony_ci 75823b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 75923b3eb3cSopenharmony_ci this.b3.set(params.itemOptions); 76023b3eb3cSopenharmony_ci this.o2.set(params.options); 76123b3eb3cSopenharmony_ci this.c3.set(params.property); 76223b3eb3cSopenharmony_ci if (params.groupId !== undefined) { 76323b3eb3cSopenharmony_ci this.groupId = params.groupId; 76423b3eb3cSopenharmony_ci } 76523b3eb3cSopenharmony_ci } 76623b3eb3cSopenharmony_ci 76723b3eb3cSopenharmony_ci updateStateVars(params) { 76823b3eb3cSopenharmony_ci this.a3.reset(params.maxFontScale); 76923b3eb3cSopenharmony_ci this.b3.set(params.itemOptions); 77023b3eb3cSopenharmony_ci this.o2.set(params.options); 77123b3eb3cSopenharmony_ci this.c3.set(params.property); 77223b3eb3cSopenharmony_ci this.d3.reset(params.index); 77323b3eb3cSopenharmony_ci } 77423b3eb3cSopenharmony_ci 77523b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 77623b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 77723b3eb3cSopenharmony_ci this.z2.purgeDependencyOnElmtId(rmElmtId); 77823b3eb3cSopenharmony_ci this.a3.purgeDependencyOnElmtId(rmElmtId); 77923b3eb3cSopenharmony_ci this.b3.purgeDependencyOnElmtId(rmElmtId); 78023b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 78123b3eb3cSopenharmony_ci this.c3.purgeDependencyOnElmtId(rmElmtId); 78223b3eb3cSopenharmony_ci this.d3.purgeDependencyOnElmtId(rmElmtId); 78323b3eb3cSopenharmony_ci } 78423b3eb3cSopenharmony_ci 78523b3eb3cSopenharmony_ci aboutToBeDeleted() { 78623b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 78723b3eb3cSopenharmony_ci this.z2.aboutToBeDeleted(); 78823b3eb3cSopenharmony_ci this.a3.aboutToBeDeleted(); 78923b3eb3cSopenharmony_ci this.b3.aboutToBeDeleted(); 79023b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 79123b3eb3cSopenharmony_ci this.c3.aboutToBeDeleted(); 79223b3eb3cSopenharmony_ci this.d3.aboutToBeDeleted(); 79323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 79423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 79523b3eb3cSopenharmony_ci } 79623b3eb3cSopenharmony_ci 79723b3eb3cSopenharmony_ci get selectedIndexes() { 79823b3eb3cSopenharmony_ci return this.t2.get(); 79923b3eb3cSopenharmony_ci } 80023b3eb3cSopenharmony_ci 80123b3eb3cSopenharmony_ci set selectedIndexes(newValue) { 80223b3eb3cSopenharmony_ci this.t2.set(newValue); 80323b3eb3cSopenharmony_ci } 80423b3eb3cSopenharmony_ci 80523b3eb3cSopenharmony_ci get focusIndex() { 80623b3eb3cSopenharmony_ci return this.z2.get(); 80723b3eb3cSopenharmony_ci } 80823b3eb3cSopenharmony_ci 80923b3eb3cSopenharmony_ci set focusIndex(newValue) { 81023b3eb3cSopenharmony_ci this.z2.set(newValue); 81123b3eb3cSopenharmony_ci } 81223b3eb3cSopenharmony_ci 81323b3eb3cSopenharmony_ci get maxFontScale() { 81423b3eb3cSopenharmony_ci return this.a3.get(); 81523b3eb3cSopenharmony_ci } 81623b3eb3cSopenharmony_ci 81723b3eb3cSopenharmony_ci set maxFontScale(newValue) { 81823b3eb3cSopenharmony_ci this.a3.set(newValue); 81923b3eb3cSopenharmony_ci } 82023b3eb3cSopenharmony_ci 82123b3eb3cSopenharmony_ci get itemOptions() { 82223b3eb3cSopenharmony_ci return this.b3.get(); 82323b3eb3cSopenharmony_ci } 82423b3eb3cSopenharmony_ci 82523b3eb3cSopenharmony_ci get options() { 82623b3eb3cSopenharmony_ci return this.o2.get(); 82723b3eb3cSopenharmony_ci } 82823b3eb3cSopenharmony_ci 82923b3eb3cSopenharmony_ci get property() { 83023b3eb3cSopenharmony_ci return this.c3.get(); 83123b3eb3cSopenharmony_ci } 83223b3eb3cSopenharmony_ci 83323b3eb3cSopenharmony_ci get index() { 83423b3eb3cSopenharmony_ci return this.d3.get(); 83523b3eb3cSopenharmony_ci } 83623b3eb3cSopenharmony_ci 83723b3eb3cSopenharmony_ci set index(newValue) { 83823b3eb3cSopenharmony_ci this.d3.set(newValue); 83923b3eb3cSopenharmony_ci } 84023b3eb3cSopenharmony_ci 84123b3eb3cSopenharmony_ci getTextPadding() { 84223b3eb3cSopenharmony_ci if (this.options.localizedTextPadding) { 84323b3eb3cSopenharmony_ci return this.options.localizedTextPadding; 84423b3eb3cSopenharmony_ci } 84523b3eb3cSopenharmony_ci if (this.options.textPadding !== void (0)) { 84623b3eb3cSopenharmony_ci return this.options.textPadding; 84723b3eb3cSopenharmony_ci } 84823b3eb3cSopenharmony_ci return 0; 84923b3eb3cSopenharmony_ci } 85023b3eb3cSopenharmony_ci 85123b3eb3cSopenharmony_ci getButtonPadding() { 85223b3eb3cSopenharmony_ci if (this.options.localizedButtonPadding) { 85323b3eb3cSopenharmony_ci return this.options.localizedButtonPadding; 85423b3eb3cSopenharmony_ci } 85523b3eb3cSopenharmony_ci if (this.options.buttonPadding !== void (0)) { 85623b3eb3cSopenharmony_ci return this.options.buttonPadding; 85723b3eb3cSopenharmony_ci } 85823b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && this.options.i2 && this.options.showIcon) { 85923b3eb3cSopenharmony_ci return { 86023b3eb3cSopenharmony_ci top: LengthMetrics.vp(6), 86123b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(6), 86223b3eb3cSopenharmony_ci start: LengthMetrics.vp(8), 86323b3eb3cSopenharmony_ci end: LengthMetrics.vp(8) 86423b3eb3cSopenharmony_ci }; 86523b3eb3cSopenharmony_ci } 86623b3eb3cSopenharmony_ci return { 86723b3eb3cSopenharmony_ci top: LengthMetrics.vp(4), 86823b3eb3cSopenharmony_ci bottom: LengthMetrics.vp(4), 86923b3eb3cSopenharmony_ci start: LengthMetrics.vp(8), 87023b3eb3cSopenharmony_ci end: LengthMetrics.vp(8) 87123b3eb3cSopenharmony_ci }; 87223b3eb3cSopenharmony_ci } 87323b3eb3cSopenharmony_ci 87423b3eb3cSopenharmony_ci getAccessibilityText() { 87523b3eb3cSopenharmony_ci try { 87623b3eb3cSopenharmony_ci if (this.selectedIndexes.includes(this.index) && this.itemOptions.selectedIconAccessibilityText) { 87723b3eb3cSopenharmony_ci return (typeof this.itemOptions.selectedIconAccessibilityText === 'string') ? 87823b3eb3cSopenharmony_ci this.itemOptions.selectedIconAccessibilityText : 87923b3eb3cSopenharmony_ci getContext(this).resourceManager.getStringSync(this.itemOptions.selectedIconAccessibilityText.id); 88023b3eb3cSopenharmony_ci } else if (this.itemOptions.iconAccessibilityText) { 88123b3eb3cSopenharmony_ci return (typeof this.itemOptions.iconAccessibilityText === 'string') ? 88223b3eb3cSopenharmony_ci this.itemOptions.iconAccessibilityText : 88323b3eb3cSopenharmony_ci getContext(this).resourceManager.getStringSync(this.itemOptions.iconAccessibilityText.id); 88423b3eb3cSopenharmony_ci } 88523b3eb3cSopenharmony_ci } catch (error) { 88623b3eb3cSopenharmony_ci console.error(`Ace SegmentButton getAccessibilityText, error: ${error.toString()}`); 88723b3eb3cSopenharmony_ci } 88823b3eb3cSopenharmony_ci return ''; 88923b3eb3cSopenharmony_ci } 89023b3eb3cSopenharmony_ci 89123b3eb3cSopenharmony_ci initialRender() { 89223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 89323b3eb3cSopenharmony_ci Column.create({ space: 2 }); 89423b3eb3cSopenharmony_ci Column.direction(this.options.direction); 89523b3eb3cSopenharmony_ci Column.focusScopePriority(this.groupId, 89623b3eb3cSopenharmony_ci Math.min(...this.selectedIndexes) === this.index ? FocusPriority.PREVIOUS : FocusPriority.AUTO); 89723b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 89823b3eb3cSopenharmony_ci Column.padding(this.getButtonPadding()); 89923b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: 28 }); 90023b3eb3cSopenharmony_ci }, Column); 90123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 90223b3eb3cSopenharmony_ci If.create(); 90323b3eb3cSopenharmony_ci if (this.options.showIcon) { 90423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 90523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 90623b3eb3cSopenharmony_ci Image.create(this.property.isSelected ? this.itemOptions.selectedIcon : this.itemOptions.icon); 90723b3eb3cSopenharmony_ci Image.direction(this.options.direction); 90823b3eb3cSopenharmony_ci Image.size(this.options.imageSize ?? { width: 24, height: 24 }); 90923b3eb3cSopenharmony_ci Image.focusable(!this.options.i2); 91023b3eb3cSopenharmony_ci Image.draggable(false); 91123b3eb3cSopenharmony_ci Image.fillColor(this.property.isSelected ? (this.options.selectedFontColor ?? 91223b3eb3cSopenharmony_ci e1.t1) : (this.options.fontColor ?? 91323b3eb3cSopenharmony_ci e1.q1)); 91423b3eb3cSopenharmony_ci Image.accessibilityText(this.getAccessibilityText()); 91523b3eb3cSopenharmony_ci }, Image); 91623b3eb3cSopenharmony_ci }); 91723b3eb3cSopenharmony_ci } else { 91823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 91923b3eb3cSopenharmony_ci }); 92023b3eb3cSopenharmony_ci } 92123b3eb3cSopenharmony_ci }, If); 92223b3eb3cSopenharmony_ci If.pop(); 92323b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 92423b3eb3cSopenharmony_ci If.create(); 92523b3eb3cSopenharmony_ci if (this.options.i2) { 92623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 92723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 92823b3eb3cSopenharmony_ci Text.create(this.itemOptions.text); 92923b3eb3cSopenharmony_ci Text.direction(this.options.direction); 93023b3eb3cSopenharmony_ci Text.fontColor(this.property.fontColor); 93123b3eb3cSopenharmony_ci Text.fontWeight(this.property.fontWeight); 93223b3eb3cSopenharmony_ci Text.fontSize(this.property.fontSize); 93323b3eb3cSopenharmony_ci Text.minFontSize(9); 93423b3eb3cSopenharmony_ci Text.maxFontSize(this.property.fontSize); 93523b3eb3cSopenharmony_ci Text.maxFontScale(ObservedObject.GetRawObject(this.maxFontScale)); 93623b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 93723b3eb3cSopenharmony_ci Text.maxLines(1); 93823b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Center); 93923b3eb3cSopenharmony_ci Text.focusable(true); 94023b3eb3cSopenharmony_ci Text.padding(this.getTextPadding()); 94123b3eb3cSopenharmony_ci }, Text); 94223b3eb3cSopenharmony_ci Text.pop(); 94323b3eb3cSopenharmony_ci }); 94423b3eb3cSopenharmony_ci } else { 94523b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 94623b3eb3cSopenharmony_ci }); 94723b3eb3cSopenharmony_ci } 94823b3eb3cSopenharmony_ci }, If); 94923b3eb3cSopenharmony_ci If.pop(); 95023b3eb3cSopenharmony_ci Column.pop(); 95123b3eb3cSopenharmony_ci } 95223b3eb3cSopenharmony_ci 95323b3eb3cSopenharmony_ci rerender() { 95423b3eb3cSopenharmony_ci this.updateDirtyElements(); 95523b3eb3cSopenharmony_ci } 95623b3eb3cSopenharmony_ci} 95723b3eb3cSopenharmony_ci 95823b3eb3cSopenharmony_cilet j1 = class HoverColorProperty { 95923b3eb3cSopenharmony_ci constructor() { 96023b3eb3cSopenharmony_ci this.e3 = Color.Transparent; 96123b3eb3cSopenharmony_ci } 96223b3eb3cSopenharmony_ci}; 96323b3eb3cSopenharmony_cij1 = j([ 96423b3eb3cSopenharmony_ci Observed 96523b3eb3cSopenharmony_ci], j1); 96623b3eb3cSopenharmony_ci 96723b3eb3cSopenharmony_ciclass l1 extends ViewPU { 96823b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 96923b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 97023b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 97123b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 97223b3eb3cSopenharmony_ci } 97323b3eb3cSopenharmony_ci this.s2 = this.initializeConsume("buttonItemsSize", "buttonItemsSize"); 97423b3eb3cSopenharmony_ci this.f3 = new SynchedPropertySimpleOneWayPU(params.press, this, "press"); 97523b3eb3cSopenharmony_ci this.g3 = new SynchedPropertySimpleOneWayPU(params.hover, this, "hover"); 97623b3eb3cSopenharmony_ci this.h3 = new SynchedPropertyNesedObjectPU(params.colorProperty, this, "colorProperty"); 97723b3eb3cSopenharmony_ci this.q2 = this.initializeConsume("buttonBorderRadius", "buttonBorderRadius"); 97823b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 97923b3eb3cSopenharmony_ci this.pressIndex = 0; 98023b3eb3cSopenharmony_ci this.pressColor = e1.c2; 98123b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 98223b3eb3cSopenharmony_ci this.finalizeConstruction(); 98323b3eb3cSopenharmony_ci } 98423b3eb3cSopenharmony_ci 98523b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 98623b3eb3cSopenharmony_ci this.h3.set(params.colorProperty); 98723b3eb3cSopenharmony_ci this.o2.set(params.options); 98823b3eb3cSopenharmony_ci if (params.pressIndex !== undefined) { 98923b3eb3cSopenharmony_ci this.pressIndex = params.pressIndex; 99023b3eb3cSopenharmony_ci } 99123b3eb3cSopenharmony_ci if (params.pressColor !== undefined) { 99223b3eb3cSopenharmony_ci this.pressColor = params.pressColor; 99323b3eb3cSopenharmony_ci } 99423b3eb3cSopenharmony_ci } 99523b3eb3cSopenharmony_ci 99623b3eb3cSopenharmony_ci updateStateVars(params) { 99723b3eb3cSopenharmony_ci this.f3.reset(params.press); 99823b3eb3cSopenharmony_ci this.g3.reset(params.hover); 99923b3eb3cSopenharmony_ci this.h3.set(params.colorProperty); 100023b3eb3cSopenharmony_ci this.o2.set(params.options); 100123b3eb3cSopenharmony_ci } 100223b3eb3cSopenharmony_ci 100323b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 100423b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 100523b3eb3cSopenharmony_ci this.f3.purgeDependencyOnElmtId(rmElmtId); 100623b3eb3cSopenharmony_ci this.g3.purgeDependencyOnElmtId(rmElmtId); 100723b3eb3cSopenharmony_ci this.h3.purgeDependencyOnElmtId(rmElmtId); 100823b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 100923b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 101023b3eb3cSopenharmony_ci } 101123b3eb3cSopenharmony_ci 101223b3eb3cSopenharmony_ci aboutToBeDeleted() { 101323b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 101423b3eb3cSopenharmony_ci this.f3.aboutToBeDeleted(); 101523b3eb3cSopenharmony_ci this.g3.aboutToBeDeleted(); 101623b3eb3cSopenharmony_ci this.h3.aboutToBeDeleted(); 101723b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 101823b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 101923b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 102023b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 102123b3eb3cSopenharmony_ci } 102223b3eb3cSopenharmony_ci 102323b3eb3cSopenharmony_ci get buttonItemsSize() { 102423b3eb3cSopenharmony_ci return this.s2.get(); 102523b3eb3cSopenharmony_ci } 102623b3eb3cSopenharmony_ci 102723b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 102823b3eb3cSopenharmony_ci this.s2.set(newValue); 102923b3eb3cSopenharmony_ci } 103023b3eb3cSopenharmony_ci 103123b3eb3cSopenharmony_ci get press() { 103223b3eb3cSopenharmony_ci return this.f3.get(); 103323b3eb3cSopenharmony_ci } 103423b3eb3cSopenharmony_ci 103523b3eb3cSopenharmony_ci set press(newValue) { 103623b3eb3cSopenharmony_ci this.f3.set(newValue); 103723b3eb3cSopenharmony_ci } 103823b3eb3cSopenharmony_ci 103923b3eb3cSopenharmony_ci get hover() { 104023b3eb3cSopenharmony_ci return this.g3.get(); 104123b3eb3cSopenharmony_ci } 104223b3eb3cSopenharmony_ci 104323b3eb3cSopenharmony_ci set hover(newValue) { 104423b3eb3cSopenharmony_ci this.g3.set(newValue); 104523b3eb3cSopenharmony_ci } 104623b3eb3cSopenharmony_ci 104723b3eb3cSopenharmony_ci get colorProperty() { 104823b3eb3cSopenharmony_ci return this.h3.get(); 104923b3eb3cSopenharmony_ci } 105023b3eb3cSopenharmony_ci 105123b3eb3cSopenharmony_ci get buttonBorderRadius() { 105223b3eb3cSopenharmony_ci return this.q2.get(); 105323b3eb3cSopenharmony_ci } 105423b3eb3cSopenharmony_ci 105523b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 105623b3eb3cSopenharmony_ci this.q2.set(newValue); 105723b3eb3cSopenharmony_ci } 105823b3eb3cSopenharmony_ci 105923b3eb3cSopenharmony_ci get options() { 106023b3eb3cSopenharmony_ci return this.o2.get(); 106123b3eb3cSopenharmony_ci } 106223b3eb3cSopenharmony_ci 106323b3eb3cSopenharmony_ci initialRender() { 106423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 106523b3eb3cSopenharmony_ci Stack.create(); 106623b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 106723b3eb3cSopenharmony_ci Stack.size(this.buttonItemsSize[this.pressIndex]); 106823b3eb3cSopenharmony_ci Stack.backgroundColor(this.press && this.hover ? this.pressColor : this.colorProperty.e3); 106923b3eb3cSopenharmony_ci Stack.borderRadius(this.buttonBorderRadius[this.pressIndex]); 107023b3eb3cSopenharmony_ci }, Stack); 107123b3eb3cSopenharmony_ci Stack.pop(); 107223b3eb3cSopenharmony_ci } 107323b3eb3cSopenharmony_ci 107423b3eb3cSopenharmony_ci rerender() { 107523b3eb3cSopenharmony_ci this.updateDirtyElements(); 107623b3eb3cSopenharmony_ci } 107723b3eb3cSopenharmony_ci} 107823b3eb3cSopenharmony_ci 107923b3eb3cSopenharmony_ciclass m1 extends ViewPU { 108023b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 108123b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 108223b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 108323b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 108423b3eb3cSopenharmony_ci } 108523b3eb3cSopenharmony_ci this.n2 = new SynchedPropertyNesedObjectPU(params.optionsArray, this, "optionsArray"); 108623b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 108723b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectTwoWayPU(params.selectedIndexes, this, "selectedIndexes"); 108823b3eb3cSopenharmony_ci this.i3 = this.initializeConsume("componentSize", "componentSize"); 108923b3eb3cSopenharmony_ci this.q2 = this.initializeConsume("buttonBorderRadius", "buttonBorderRadius"); 109023b3eb3cSopenharmony_ci this.s2 = this.initializeConsume("buttonItemsSize", "buttonItemsSize"); 109123b3eb3cSopenharmony_ci this.j3 = this.initializeConsume("buttonItemsPosition", "buttonItemsPosition"); 109223b3eb3cSopenharmony_ci this.z2 = this.initializeConsume("focusIndex", "focusIndex"); 109323b3eb3cSopenharmony_ci this.v2 = this.initializeConsume("zoomScaleArray", "zoomScaleArray"); 109423b3eb3cSopenharmony_ci this.l3 = this.initializeConsume("buttonItemProperty", "buttonItemProperty"); 109523b3eb3cSopenharmony_ci this.m3 = this.initializeConsume("buttonItemsSelected", "buttonItemsSelected"); 109623b3eb3cSopenharmony_ci this.n3 = new SynchedPropertyObjectTwoWayPU(params.pressArray, this, "pressArray"); 109723b3eb3cSopenharmony_ci this.q3 = new SynchedPropertyObjectTwoWayPU(params.hoverArray, this, "hoverArray"); 109823b3eb3cSopenharmony_ci this.r3 = new SynchedPropertyObjectTwoWayPU(params.hoverColorArray, this, "hoverColorArray"); 109923b3eb3cSopenharmony_ci this.a3 = new SynchedPropertyObjectOneWayPU(params.maxFontScale, this, "maxFontScale"); 110023b3eb3cSopenharmony_ci this.s3 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (j3, index) => 0), this, "buttonWidth"); 110123b3eb3cSopenharmony_ci this.t3 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (i3, index) => 0), this, "buttonHeight"); 110223b3eb3cSopenharmony_ci this.buttonItemsRealHeight = Array.from({ length: a1 }, (h3, index) => 0); 110323b3eb3cSopenharmony_ci this.groupId = util.generateRandomUUID(true); 110423b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 110523b3eb3cSopenharmony_ci this.declareWatch("optionsArray", this.onOptionsArrayChange); 110623b3eb3cSopenharmony_ci this.declareWatch("options", this.onOptionsChange); 110723b3eb3cSopenharmony_ci this.declareWatch("buttonItemsSize", this.onButtonItemsSizeChange); 110823b3eb3cSopenharmony_ci this.finalizeConstruction(); 110923b3eb3cSopenharmony_ci } 111023b3eb3cSopenharmony_ci 111123b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 111223b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 111323b3eb3cSopenharmony_ci this.o2.set(params.options); 111423b3eb3cSopenharmony_ci if (params.buttonWidth !== undefined) { 111523b3eb3cSopenharmony_ci this.buttonWidth = params.buttonWidth; 111623b3eb3cSopenharmony_ci } 111723b3eb3cSopenharmony_ci if (params.buttonHeight !== undefined) { 111823b3eb3cSopenharmony_ci this.buttonHeight = params.buttonHeight; 111923b3eb3cSopenharmony_ci } 112023b3eb3cSopenharmony_ci if (params.buttonItemsRealHeight !== undefined) { 112123b3eb3cSopenharmony_ci this.buttonItemsRealHeight = params.buttonItemsRealHeight; 112223b3eb3cSopenharmony_ci } 112323b3eb3cSopenharmony_ci if (params.groupId !== undefined) { 112423b3eb3cSopenharmony_ci this.groupId = params.groupId; 112523b3eb3cSopenharmony_ci } 112623b3eb3cSopenharmony_ci } 112723b3eb3cSopenharmony_ci 112823b3eb3cSopenharmony_ci updateStateVars(params) { 112923b3eb3cSopenharmony_ci this.n2.set(params.optionsArray); 113023b3eb3cSopenharmony_ci this.o2.set(params.options); 113123b3eb3cSopenharmony_ci this.a3.reset(params.maxFontScale); 113223b3eb3cSopenharmony_ci } 113323b3eb3cSopenharmony_ci 113423b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 113523b3eb3cSopenharmony_ci this.n2.purgeDependencyOnElmtId(rmElmtId); 113623b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 113723b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 113823b3eb3cSopenharmony_ci this.i3.purgeDependencyOnElmtId(rmElmtId); 113923b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 114023b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 114123b3eb3cSopenharmony_ci this.j3.purgeDependencyOnElmtId(rmElmtId); 114223b3eb3cSopenharmony_ci this.z2.purgeDependencyOnElmtId(rmElmtId); 114323b3eb3cSopenharmony_ci this.v2.purgeDependencyOnElmtId(rmElmtId); 114423b3eb3cSopenharmony_ci this.l3.purgeDependencyOnElmtId(rmElmtId); 114523b3eb3cSopenharmony_ci this.m3.purgeDependencyOnElmtId(rmElmtId); 114623b3eb3cSopenharmony_ci this.n3.purgeDependencyOnElmtId(rmElmtId); 114723b3eb3cSopenharmony_ci this.q3.purgeDependencyOnElmtId(rmElmtId); 114823b3eb3cSopenharmony_ci this.r3.purgeDependencyOnElmtId(rmElmtId); 114923b3eb3cSopenharmony_ci this.a3.purgeDependencyOnElmtId(rmElmtId); 115023b3eb3cSopenharmony_ci this.s3.purgeDependencyOnElmtId(rmElmtId); 115123b3eb3cSopenharmony_ci this.t3.purgeDependencyOnElmtId(rmElmtId); 115223b3eb3cSopenharmony_ci } 115323b3eb3cSopenharmony_ci 115423b3eb3cSopenharmony_ci aboutToBeDeleted() { 115523b3eb3cSopenharmony_ci this.n2.aboutToBeDeleted(); 115623b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 115723b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 115823b3eb3cSopenharmony_ci this.i3.aboutToBeDeleted(); 115923b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 116023b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 116123b3eb3cSopenharmony_ci this.j3.aboutToBeDeleted(); 116223b3eb3cSopenharmony_ci this.z2.aboutToBeDeleted(); 116323b3eb3cSopenharmony_ci this.v2.aboutToBeDeleted(); 116423b3eb3cSopenharmony_ci this.l3.aboutToBeDeleted(); 116523b3eb3cSopenharmony_ci this.m3.aboutToBeDeleted(); 116623b3eb3cSopenharmony_ci this.n3.aboutToBeDeleted(); 116723b3eb3cSopenharmony_ci this.q3.aboutToBeDeleted(); 116823b3eb3cSopenharmony_ci this.r3.aboutToBeDeleted(); 116923b3eb3cSopenharmony_ci this.a3.aboutToBeDeleted(); 117023b3eb3cSopenharmony_ci this.s3.aboutToBeDeleted(); 117123b3eb3cSopenharmony_ci this.t3.aboutToBeDeleted(); 117223b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 117323b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 117423b3eb3cSopenharmony_ci } 117523b3eb3cSopenharmony_ci 117623b3eb3cSopenharmony_ci get optionsArray() { 117723b3eb3cSopenharmony_ci return this.n2.get(); 117823b3eb3cSopenharmony_ci } 117923b3eb3cSopenharmony_ci 118023b3eb3cSopenharmony_ci get options() { 118123b3eb3cSopenharmony_ci return this.o2.get(); 118223b3eb3cSopenharmony_ci } 118323b3eb3cSopenharmony_ci 118423b3eb3cSopenharmony_ci get selectedIndexes() { 118523b3eb3cSopenharmony_ci return this.t2.get(); 118623b3eb3cSopenharmony_ci } 118723b3eb3cSopenharmony_ci 118823b3eb3cSopenharmony_ci set selectedIndexes(newValue) { 118923b3eb3cSopenharmony_ci this.t2.set(newValue); 119023b3eb3cSopenharmony_ci } 119123b3eb3cSopenharmony_ci 119223b3eb3cSopenharmony_ci get componentSize() { 119323b3eb3cSopenharmony_ci return this.i3.get(); 119423b3eb3cSopenharmony_ci } 119523b3eb3cSopenharmony_ci 119623b3eb3cSopenharmony_ci set componentSize(newValue) { 119723b3eb3cSopenharmony_ci this.i3.set(newValue); 119823b3eb3cSopenharmony_ci } 119923b3eb3cSopenharmony_ci 120023b3eb3cSopenharmony_ci get buttonBorderRadius() { 120123b3eb3cSopenharmony_ci return this.q2.get(); 120223b3eb3cSopenharmony_ci } 120323b3eb3cSopenharmony_ci 120423b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 120523b3eb3cSopenharmony_ci this.q2.set(newValue); 120623b3eb3cSopenharmony_ci } 120723b3eb3cSopenharmony_ci 120823b3eb3cSopenharmony_ci get buttonItemsSize() { 120923b3eb3cSopenharmony_ci return this.s2.get(); 121023b3eb3cSopenharmony_ci } 121123b3eb3cSopenharmony_ci 121223b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 121323b3eb3cSopenharmony_ci this.s2.set(newValue); 121423b3eb3cSopenharmony_ci } 121523b3eb3cSopenharmony_ci 121623b3eb3cSopenharmony_ci get buttonItemsPosition() { 121723b3eb3cSopenharmony_ci return this.j3.get(); 121823b3eb3cSopenharmony_ci } 121923b3eb3cSopenharmony_ci 122023b3eb3cSopenharmony_ci set buttonItemsPosition(newValue) { 122123b3eb3cSopenharmony_ci this.j3.set(newValue); 122223b3eb3cSopenharmony_ci } 122323b3eb3cSopenharmony_ci 122423b3eb3cSopenharmony_ci get focusIndex() { 122523b3eb3cSopenharmony_ci return this.z2.get(); 122623b3eb3cSopenharmony_ci } 122723b3eb3cSopenharmony_ci 122823b3eb3cSopenharmony_ci set focusIndex(newValue) { 122923b3eb3cSopenharmony_ci this.z2.set(newValue); 123023b3eb3cSopenharmony_ci } 123123b3eb3cSopenharmony_ci 123223b3eb3cSopenharmony_ci get zoomScaleArray() { 123323b3eb3cSopenharmony_ci return this.v2.get(); 123423b3eb3cSopenharmony_ci } 123523b3eb3cSopenharmony_ci 123623b3eb3cSopenharmony_ci set zoomScaleArray(newValue) { 123723b3eb3cSopenharmony_ci this.v2.set(newValue); 123823b3eb3cSopenharmony_ci } 123923b3eb3cSopenharmony_ci 124023b3eb3cSopenharmony_ci get buttonItemProperty() { 124123b3eb3cSopenharmony_ci return this.l3.get(); 124223b3eb3cSopenharmony_ci } 124323b3eb3cSopenharmony_ci 124423b3eb3cSopenharmony_ci set buttonItemProperty(newValue) { 124523b3eb3cSopenharmony_ci this.l3.set(newValue); 124623b3eb3cSopenharmony_ci } 124723b3eb3cSopenharmony_ci 124823b3eb3cSopenharmony_ci get buttonItemsSelected() { 124923b3eb3cSopenharmony_ci return this.m3.get(); 125023b3eb3cSopenharmony_ci } 125123b3eb3cSopenharmony_ci 125223b3eb3cSopenharmony_ci set buttonItemsSelected(newValue) { 125323b3eb3cSopenharmony_ci this.m3.set(newValue); 125423b3eb3cSopenharmony_ci } 125523b3eb3cSopenharmony_ci 125623b3eb3cSopenharmony_ci get pressArray() { 125723b3eb3cSopenharmony_ci return this.n3.get(); 125823b3eb3cSopenharmony_ci } 125923b3eb3cSopenharmony_ci 126023b3eb3cSopenharmony_ci set pressArray(newValue) { 126123b3eb3cSopenharmony_ci this.n3.set(newValue); 126223b3eb3cSopenharmony_ci } 126323b3eb3cSopenharmony_ci 126423b3eb3cSopenharmony_ci get hoverArray() { 126523b3eb3cSopenharmony_ci return this.q3.get(); 126623b3eb3cSopenharmony_ci } 126723b3eb3cSopenharmony_ci 126823b3eb3cSopenharmony_ci set hoverArray(newValue) { 126923b3eb3cSopenharmony_ci this.q3.set(newValue); 127023b3eb3cSopenharmony_ci } 127123b3eb3cSopenharmony_ci 127223b3eb3cSopenharmony_ci get hoverColorArray() { 127323b3eb3cSopenharmony_ci return this.r3.get(); 127423b3eb3cSopenharmony_ci } 127523b3eb3cSopenharmony_ci 127623b3eb3cSopenharmony_ci set hoverColorArray(newValue) { 127723b3eb3cSopenharmony_ci this.r3.set(newValue); 127823b3eb3cSopenharmony_ci } 127923b3eb3cSopenharmony_ci 128023b3eb3cSopenharmony_ci get maxFontScale() { 128123b3eb3cSopenharmony_ci return this.a3.get(); 128223b3eb3cSopenharmony_ci } 128323b3eb3cSopenharmony_ci 128423b3eb3cSopenharmony_ci set maxFontScale(newValue) { 128523b3eb3cSopenharmony_ci this.a3.set(newValue); 128623b3eb3cSopenharmony_ci } 128723b3eb3cSopenharmony_ci 128823b3eb3cSopenharmony_ci get buttonWidth() { 128923b3eb3cSopenharmony_ci return this.s3.get(); 129023b3eb3cSopenharmony_ci } 129123b3eb3cSopenharmony_ci 129223b3eb3cSopenharmony_ci set buttonWidth(newValue) { 129323b3eb3cSopenharmony_ci this.s3.set(newValue); 129423b3eb3cSopenharmony_ci } 129523b3eb3cSopenharmony_ci 129623b3eb3cSopenharmony_ci get buttonHeight() { 129723b3eb3cSopenharmony_ci return this.t3.get(); 129823b3eb3cSopenharmony_ci } 129923b3eb3cSopenharmony_ci 130023b3eb3cSopenharmony_ci set buttonHeight(newValue) { 130123b3eb3cSopenharmony_ci this.t3.set(newValue); 130223b3eb3cSopenharmony_ci } 130323b3eb3cSopenharmony_ci 130423b3eb3cSopenharmony_ci onButtonItemsSizeChange() { 130523b3eb3cSopenharmony_ci this.buttonItemsSize.forEach((value, index) => { 130623b3eb3cSopenharmony_ci this.buttonWidth[index] = value.width; 130723b3eb3cSopenharmony_ci this.buttonHeight[index] = value.height; 130823b3eb3cSopenharmony_ci }); 130923b3eb3cSopenharmony_ci } 131023b3eb3cSopenharmony_ci 131123b3eb3cSopenharmony_ci changeSelectedIndexes(c3) { 131223b3eb3cSopenharmony_ci if (this.optionsArray.e2 === void 0 || this.optionsArray.deleteCount === void 0 || 131323b3eb3cSopenharmony_ci this.optionsArray.f2 === void 0) { 131423b3eb3cSopenharmony_ci return; 131523b3eb3cSopenharmony_ci } 131623b3eb3cSopenharmony_ci if (!(this.options.multiply ?? false)) { 131723b3eb3cSopenharmony_ci if (this.selectedIndexes[0] === void 0) { 131823b3eb3cSopenharmony_ci return; 131923b3eb3cSopenharmony_ci } 132023b3eb3cSopenharmony_ci if (this.selectedIndexes[0] < this.optionsArray.e2) { 132123b3eb3cSopenharmony_ci return; 132223b3eb3cSopenharmony_ci } 132323b3eb3cSopenharmony_ci if (this.optionsArray.e2 + this.optionsArray.deleteCount > this.selectedIndexes[0]) { 132423b3eb3cSopenharmony_ci if (this.options.type === 'tab') { 132523b3eb3cSopenharmony_ci this.selectedIndexes[0] = 0; 132623b3eb3cSopenharmony_ci } else if (this.options.type === 'capsule') { 132723b3eb3cSopenharmony_ci this.selectedIndexes = []; 132823b3eb3cSopenharmony_ci } 132923b3eb3cSopenharmony_ci } else { 133023b3eb3cSopenharmony_ci this.selectedIndexes[0] = 133123b3eb3cSopenharmony_ci this.selectedIndexes[0] - this.optionsArray.deleteCount + this.optionsArray.f2; 133223b3eb3cSopenharmony_ci } 133323b3eb3cSopenharmony_ci } else { 133423b3eb3cSopenharmony_ci let d3 = this.selectedIndexes; 133523b3eb3cSopenharmony_ci for (let f3 = 0; f3 < this.optionsArray.deleteCount; f3++) { 133623b3eb3cSopenharmony_ci let g3 = d3.indexOf(this.optionsArray.e2); 133723b3eb3cSopenharmony_ci let indexes = d3.map(value => this.optionsArray.e2 && 133823b3eb3cSopenharmony_ci (value > this.optionsArray.e2) ? value - 1 : value); 133923b3eb3cSopenharmony_ci if (g3 !== -1) { 134023b3eb3cSopenharmony_ci indexes.splice(g3, 1); 134123b3eb3cSopenharmony_ci } 134223b3eb3cSopenharmony_ci d3 = indexes; 134323b3eb3cSopenharmony_ci } 134423b3eb3cSopenharmony_ci for (let e3 = 0; e3 < this.optionsArray.f2; e3++) { 134523b3eb3cSopenharmony_ci let indexes = d3.map(value => this.optionsArray.e2 && 134623b3eb3cSopenharmony_ci (value >= this.optionsArray.e2) ? value + 1 : value); 134723b3eb3cSopenharmony_ci d3 = indexes; 134823b3eb3cSopenharmony_ci } 134923b3eb3cSopenharmony_ci this.selectedIndexes = d3; 135023b3eb3cSopenharmony_ci } 135123b3eb3cSopenharmony_ci } 135223b3eb3cSopenharmony_ci 135323b3eb3cSopenharmony_ci changeFocusIndex(b3) { 135423b3eb3cSopenharmony_ci if (this.optionsArray.e2 === void 0 || this.optionsArray.deleteCount === void 0 || 135523b3eb3cSopenharmony_ci this.optionsArray.f2 === void 0) { 135623b3eb3cSopenharmony_ci return; 135723b3eb3cSopenharmony_ci } 135823b3eb3cSopenharmony_ci if (this.focusIndex === -1) { 135923b3eb3cSopenharmony_ci return; 136023b3eb3cSopenharmony_ci } 136123b3eb3cSopenharmony_ci if (this.focusIndex < this.optionsArray.e2) { 136223b3eb3cSopenharmony_ci return; 136323b3eb3cSopenharmony_ci } 136423b3eb3cSopenharmony_ci if (this.optionsArray.e2 + this.optionsArray.deleteCount > this.focusIndex) { 136523b3eb3cSopenharmony_ci this.focusIndex = 0; 136623b3eb3cSopenharmony_ci } else { 136723b3eb3cSopenharmony_ci this.focusIndex = this.focusIndex - this.optionsArray.deleteCount + this.optionsArray.f2; 136823b3eb3cSopenharmony_ci } 136923b3eb3cSopenharmony_ci } 137023b3eb3cSopenharmony_ci 137123b3eb3cSopenharmony_ci onOptionsArrayChange() { 137223b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 137323b3eb3cSopenharmony_ci return; 137423b3eb3cSopenharmony_ci } 137523b3eb3cSopenharmony_ci let a3 = Math.min(this.options.buttons.length, this.buttonItemsSize.length); 137623b3eb3cSopenharmony_ci if (this.optionsArray.e2 !== void 0 && this.optionsArray.deleteCount !== void 0 && 137723b3eb3cSopenharmony_ci this.optionsArray.f2 !== void 0) { 137823b3eb3cSopenharmony_ci this.changeSelectedIndexes(a3); 137923b3eb3cSopenharmony_ci this.changeFocusIndex(a3); 138023b3eb3cSopenharmony_ci this.optionsArray.e2 = void 0; 138123b3eb3cSopenharmony_ci this.optionsArray.deleteCount = void 0; 138223b3eb3cSopenharmony_ci this.optionsArray.f2 = void 0; 138323b3eb3cSopenharmony_ci } 138423b3eb3cSopenharmony_ci } 138523b3eb3cSopenharmony_ci 138623b3eb3cSopenharmony_ci onOptionsChange() { 138723b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 138823b3eb3cSopenharmony_ci return; 138923b3eb3cSopenharmony_ci } 139023b3eb3cSopenharmony_ci this.calculateBorderRadius(); 139123b3eb3cSopenharmony_ci } 139223b3eb3cSopenharmony_ci 139323b3eb3cSopenharmony_ci aboutToAppear() { 139423b3eb3cSopenharmony_ci for (let index = 0; index < this.buttonItemsRealHeight.length; index++) { 139523b3eb3cSopenharmony_ci this.buttonItemsRealHeight[index] = 0; 139623b3eb3cSopenharmony_ci } 139723b3eb3cSopenharmony_ci } 139823b3eb3cSopenharmony_ci 139923b3eb3cSopenharmony_ci getBorderRadius(index) { 140023b3eb3cSopenharmony_ci let borderRadius = this.buttonBorderRadius[index]; 140123b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && this.buttonItemsSelected[this.focusIndex]) { 140223b3eb3cSopenharmony_ci borderRadius.topStart = LengthMetrics.vp((borderRadius.topStart?.value ?? 0) + 4); 140323b3eb3cSopenharmony_ci borderRadius.topEnd = LengthMetrics.vp((borderRadius.topEnd?.value ?? 0) + 4); 140423b3eb3cSopenharmony_ci borderRadius.bottomStart = LengthMetrics.vp((borderRadius.bottomStart?.value ?? 0) + 4); 140523b3eb3cSopenharmony_ci borderRadius.bottomEnd = LengthMetrics.vp((borderRadius.bottomEnd?.value ?? 0) + 4); 140623b3eb3cSopenharmony_ci } 140723b3eb3cSopenharmony_ci return borderRadius; 140823b3eb3cSopenharmony_ci } 140923b3eb3cSopenharmony_ci 141023b3eb3cSopenharmony_ci focusStack(index, parent = null) { 141123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 141223b3eb3cSopenharmony_ci Stack.create(); 141323b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 141423b3eb3cSopenharmony_ci Stack.size({ width: 1, height: 1 }); 141523b3eb3cSopenharmony_ci Stack.align(Alignment.Center); 141623b3eb3cSopenharmony_ci }, Stack); 141723b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 141823b3eb3cSopenharmony_ci Stack.create(); 141923b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 142023b3eb3cSopenharmony_ci Stack.borderRadius(this.getBorderRadius(index)); 142123b3eb3cSopenharmony_ci Stack.size({ 142223b3eb3cSopenharmony_ci width: this.options.type === 'capsule' && this.buttonItemsSelected[this.focusIndex] ? 142323b3eb3cSopenharmony_ci this.buttonWidth[index] + 8 : this.buttonWidth[index], 142423b3eb3cSopenharmony_ci height: this.options.type === 'capsule' && this.buttonItemsSelected[this.focusIndex] ? 142523b3eb3cSopenharmony_ci this.buttonHeight[index] + 8 : this.buttonHeight[index] 142623b3eb3cSopenharmony_ci }); 142723b3eb3cSopenharmony_ci Stack.borderColor(e1.a2); 142823b3eb3cSopenharmony_ci Stack.borderWidth(2); 142923b3eb3cSopenharmony_ci }, Stack); 143023b3eb3cSopenharmony_ci Stack.pop(); 143123b3eb3cSopenharmony_ci Stack.pop(); 143223b3eb3cSopenharmony_ci } 143323b3eb3cSopenharmony_ci 143423b3eb3cSopenharmony_ci calculateBorderRadius() { 143523b3eb3cSopenharmony_ci let v2 = Array.from({ 143623b3eb3cSopenharmony_ci length: a1 143723b3eb3cSopenharmony_ci }, (z2, index) => { 143823b3eb3cSopenharmony_ci return { 143923b3eb3cSopenharmony_ci topStart: LengthMetrics.vp(0), 144023b3eb3cSopenharmony_ci topEnd: LengthMetrics.vp(0), 144123b3eb3cSopenharmony_ci bottomStart: LengthMetrics.vp(0), 144223b3eb3cSopenharmony_ci bottomEnd: LengthMetrics.vp(0) 144323b3eb3cSopenharmony_ci }; 144423b3eb3cSopenharmony_ci }); 144523b3eb3cSopenharmony_ci for (let index = 0; index < this.buttonBorderRadius.length; index++) { 144623b3eb3cSopenharmony_ci let w2 = this.buttonItemsSize[index].height / 2; 144723b3eb3cSopenharmony_ci if (this.options.type === 'tab' || !(this.options.multiply ?? false)) { 144823b3eb3cSopenharmony_ci v2[index].topStart = LengthMetrics.vp(this.options.j2 ?? w2); 144923b3eb3cSopenharmony_ci v2[index].topEnd = LengthMetrics.vp(this.options.j2 ?? w2); 145023b3eb3cSopenharmony_ci v2[index].bottomStart = LengthMetrics.vp(this.options.j2 ?? w2); 145123b3eb3cSopenharmony_ci v2[index].bottomEnd = LengthMetrics.vp(this.options.j2 ?? w2); 145223b3eb3cSopenharmony_ci } else { 145323b3eb3cSopenharmony_ci if (index === 0) { 145423b3eb3cSopenharmony_ci v2[index].topStart = LengthMetrics.vp(this.options.j2 ?? w2); 145523b3eb3cSopenharmony_ci v2[index].topEnd = LengthMetrics.vp(0); 145623b3eb3cSopenharmony_ci v2[index].bottomStart = LengthMetrics.vp(this.options.j2 ?? w2); 145723b3eb3cSopenharmony_ci v2[index].bottomEnd = LengthMetrics.vp(0); 145823b3eb3cSopenharmony_ci } else if (this.options.buttons && 145923b3eb3cSopenharmony_ci index === Math.min(this.options.buttons.length, this.buttonItemsSize.length) - 1) { 146023b3eb3cSopenharmony_ci v2[index].topStart = LengthMetrics.vp(0); 146123b3eb3cSopenharmony_ci v2[index].topEnd = LengthMetrics.vp(this.options.j2 ?? w2); 146223b3eb3cSopenharmony_ci v2[index].bottomStart = LengthMetrics.vp(0); 146323b3eb3cSopenharmony_ci v2[index].bottomEnd = LengthMetrics.vp(this.options.j2 ?? w2); 146423b3eb3cSopenharmony_ci } else { 146523b3eb3cSopenharmony_ci v2[index].topStart = LengthMetrics.vp(0); 146623b3eb3cSopenharmony_ci v2[index].topEnd = LengthMetrics.vp(0); 146723b3eb3cSopenharmony_ci v2[index].bottomStart = LengthMetrics.vp(0); 146823b3eb3cSopenharmony_ci v2[index].bottomEnd = LengthMetrics.vp(0); 146923b3eb3cSopenharmony_ci } 147023b3eb3cSopenharmony_ci } 147123b3eb3cSopenharmony_ci } 147223b3eb3cSopenharmony_ci this.buttonBorderRadius = v2; 147323b3eb3cSopenharmony_ci } 147423b3eb3cSopenharmony_ci 147523b3eb3cSopenharmony_ci getAccessibilityDescription(value) { 147623b3eb3cSopenharmony_ci if (value) { 147723b3eb3cSopenharmony_ci try { 147823b3eb3cSopenharmony_ci return (typeof value === 'string') ? value : 147923b3eb3cSopenharmony_ci getContext(this).resourceManager.getStringSync(value.id); 148023b3eb3cSopenharmony_ci } catch (error) { 148123b3eb3cSopenharmony_ci console.error(`Ace SegmentButton getAccessibilityDescription, error: ${error.toString()}`); 148223b3eb3cSopenharmony_ci } 148323b3eb3cSopenharmony_ci } 148423b3eb3cSopenharmony_ci return ''; 148523b3eb3cSopenharmony_ci } 148623b3eb3cSopenharmony_ci 148723b3eb3cSopenharmony_ci initialRender() { 148823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 148923b3eb3cSopenharmony_ci If.create(); 149023b3eb3cSopenharmony_ci if (this.optionsArray !== void 0 && this.optionsArray.length > 1) { 149123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 149223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 149323b3eb3cSopenharmony_ci Row.create({ space: 1 }); 149423b3eb3cSopenharmony_ci Row.direction(this.options.direction); 149523b3eb3cSopenharmony_ci Row.focusScopeId(this.groupId, true); 149623b3eb3cSopenharmony_ci Row.padding(this.options.m2); 149723b3eb3cSopenharmony_ci Row.onSizeChange((u2, newValue) => { 149823b3eb3cSopenharmony_ci this.componentSize = { width: newValue.width, height: newValue.height }; 149923b3eb3cSopenharmony_ci }); 150023b3eb3cSopenharmony_ci }, Row); 150123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 150223b3eb3cSopenharmony_ci ForEach.create(); 150323b3eb3cSopenharmony_ci const forEachItemGenFunction = (_item, index) => { 150423b3eb3cSopenharmony_ci const item = _item; 150523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 150623b3eb3cSopenharmony_ci If.create(); 150723b3eb3cSopenharmony_ci if (index < a1) { 150823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 150923b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 151023b3eb3cSopenharmony_ci Button.createWithChild(); 151123b3eb3cSopenharmony_ci Button.type(ButtonType.Normal); 151223b3eb3cSopenharmony_ci Button.stateEffect(false); 151323b3eb3cSopenharmony_ci Button.hoverEffect(HoverEffect.None); 151423b3eb3cSopenharmony_ci Button.backgroundColor(Color.Transparent); 151523b3eb3cSopenharmony_ci Button.accessibilityLevel(item.accessibilityLevel); 151623b3eb3cSopenharmony_ci Button.accessibilitySelected(this.options.multiply ? undefined : 151723b3eb3cSopenharmony_ci this.selectedIndexes.includes(index)); 151823b3eb3cSopenharmony_ci Button.accessibilityChecked(this.options.multiply ? 151923b3eb3cSopenharmony_ci this.selectedIndexes.includes(index) : undefined); 152023b3eb3cSopenharmony_ci Button.accessibilityDescription(this.getAccessibilityDescription(item.accessibilityDescription)); 152123b3eb3cSopenharmony_ci Button.direction(this.options.direction); 152223b3eb3cSopenharmony_ci Button.borderRadius(this.buttonBorderRadius[index]); 152323b3eb3cSopenharmony_ci Button.scale({ 152423b3eb3cSopenharmony_ci x: this.options.type === 'capsule' && (this.options.multiply ?? false) ? 152523b3eb3cSopenharmony_ci 1 : this.zoomScaleArray[index], 152623b3eb3cSopenharmony_ci y: this.options.type === 'capsule' && (this.options.multiply ?? false) ? 152723b3eb3cSopenharmony_ci 1 : this.zoomScaleArray[index] 152823b3eb3cSopenharmony_ci }); 152923b3eb3cSopenharmony_ci Button.layoutWeight(1); 153023b3eb3cSopenharmony_ci Button.padding(0); 153123b3eb3cSopenharmony_ci Button.onSizeChange((t2, newValue) => { 153223b3eb3cSopenharmony_ci this.buttonItemsSize[index] = { 153323b3eb3cSopenharmony_ci width: newValue.width, 153423b3eb3cSopenharmony_ci height: this.buttonItemsSize[index].height 153523b3eb3cSopenharmony_ci }; 153623b3eb3cSopenharmony_ci if (newValue.width) { 153723b3eb3cSopenharmony_ci this.buttonItemsPosition[index] = { 153823b3eb3cSopenharmony_ci start: LengthMetrics.vp(Number.parseFloat(this.options.m2.toString()) + 153923b3eb3cSopenharmony_ci (Number.parseFloat(newValue.width.toString()) + 1) * index), 154023b3eb3cSopenharmony_ci top: LengthMetrics.px(Math.floor(this.getUIContext() 154123b3eb3cSopenharmony_ci .vp2px(Number.parseFloat(this.options.m2.toString())))) 154223b3eb3cSopenharmony_ci }; 154323b3eb3cSopenharmony_ci } 154423b3eb3cSopenharmony_ci }); 154523b3eb3cSopenharmony_ci ViewStackProcessor.visualState("normal"); 154623b3eb3cSopenharmony_ci Button.overlay(undefined); 154723b3eb3cSopenharmony_ci ViewStackProcessor.visualState("focused"); 154823b3eb3cSopenharmony_ci Button.overlay({ 154923b3eb3cSopenharmony_ci builder: () => { 155023b3eb3cSopenharmony_ci this.focusStack.call(this, index); 155123b3eb3cSopenharmony_ci } 155223b3eb3cSopenharmony_ci }, { 155323b3eb3cSopenharmony_ci align: Alignment.Center 155423b3eb3cSopenharmony_ci }); 155523b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 155623b3eb3cSopenharmony_ci Button.onFocus(() => { 155723b3eb3cSopenharmony_ci this.focusIndex = index; 155823b3eb3cSopenharmony_ci }); 155923b3eb3cSopenharmony_ci Gesture.create(GesturePriority.Low); 156023b3eb3cSopenharmony_ci TapGesture.create(); 156123b3eb3cSopenharmony_ci TapGesture.onAction(() => { 156223b3eb3cSopenharmony_ci this.focusIndex = -1; 156323b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && 156423b3eb3cSopenharmony_ci (this.options.multiply ?? false)) { 156523b3eb3cSopenharmony_ci if (this.selectedIndexes.indexOf(index) === -1) { 156623b3eb3cSopenharmony_ci this.selectedIndexes.push(index); 156723b3eb3cSopenharmony_ci } else { 156823b3eb3cSopenharmony_ci this.selectedIndexes.splice(this.selectedIndexes.indexOf(index), 156923b3eb3cSopenharmony_ci 1); 157023b3eb3cSopenharmony_ci } 157123b3eb3cSopenharmony_ci } else { 157223b3eb3cSopenharmony_ci this.selectedIndexes[0] = index; 157323b3eb3cSopenharmony_ci } 157423b3eb3cSopenharmony_ci }); 157523b3eb3cSopenharmony_ci TapGesture.pop(); 157623b3eb3cSopenharmony_ci Gesture.pop(); 157723b3eb3cSopenharmony_ci Button.onTouch((event) => { 157823b3eb3cSopenharmony_ci if (event.source !== SourceType.TouchScreen) { 157923b3eb3cSopenharmony_ci return; 158023b3eb3cSopenharmony_ci } 158123b3eb3cSopenharmony_ci if (event.type === TouchType.Down) { 158223b3eb3cSopenharmony_ci Context.animateTo({ 158323b3eb3cSopenharmony_ci curve: curves.interpolatingSpring(10, 1, 410, 38) 158423b3eb3cSopenharmony_ci }, () => { 158523b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 0.95; 158623b3eb3cSopenharmony_ci }); 158723b3eb3cSopenharmony_ci } else if (event.type === TouchType.Up) { 158823b3eb3cSopenharmony_ci Context.animateTo({ 158923b3eb3cSopenharmony_ci curve: curves.interpolatingSpring(10, 1, 410, 38) 159023b3eb3cSopenharmony_ci }, () => { 159123b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 1; 159223b3eb3cSopenharmony_ci }); 159323b3eb3cSopenharmony_ci } 159423b3eb3cSopenharmony_ci }); 159523b3eb3cSopenharmony_ci Button.onHover((isHover) => { 159623b3eb3cSopenharmony_ci this.hoverArray[index] = isHover; 159723b3eb3cSopenharmony_ci if (isHover) { 159823b3eb3cSopenharmony_ci Context.animateTo({ duration: 250, curve: Curve.Friction }, () => { 159923b3eb3cSopenharmony_ci this.hoverColorArray[index].e3 = (e1.b2); 160023b3eb3cSopenharmony_ci }); 160123b3eb3cSopenharmony_ci } else { 160223b3eb3cSopenharmony_ci Context.animateTo({ duration: 250, curve: Curve.Friction }, () => { 160323b3eb3cSopenharmony_ci this.hoverColorArray[index].e3 = Color.Transparent; 160423b3eb3cSopenharmony_ci }); 160523b3eb3cSopenharmony_ci } 160623b3eb3cSopenharmony_ci }); 160723b3eb3cSopenharmony_ci Button.onMouse((event) => { 160823b3eb3cSopenharmony_ci switch (event.action) { 160923b3eb3cSopenharmony_ci case MouseAction.Press: 161023b3eb3cSopenharmony_ci Context.animateTo({ curve: curves.springMotion(0.347, 0.99) }, 161123b3eb3cSopenharmony_ci () => { 161223b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 0.95; 161323b3eb3cSopenharmony_ci }); 161423b3eb3cSopenharmony_ci Context.animateTo({ duration: 100, curve: Curve.Sharp }, () => { 161523b3eb3cSopenharmony_ci this.pressArray[index] = true; 161623b3eb3cSopenharmony_ci }); 161723b3eb3cSopenharmony_ci break; 161823b3eb3cSopenharmony_ci case MouseAction.Release: 161923b3eb3cSopenharmony_ci Context.animateTo({ curve: curves.springMotion(0.347, 0.99) }, 162023b3eb3cSopenharmony_ci () => { 162123b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 1; 162223b3eb3cSopenharmony_ci }); 162323b3eb3cSopenharmony_ci Context.animateTo({ duration: 100, curve: Curve.Sharp }, () => { 162423b3eb3cSopenharmony_ci this.pressArray[index] = false; 162523b3eb3cSopenharmony_ci }); 162623b3eb3cSopenharmony_ci break; 162723b3eb3cSopenharmony_ci } 162823b3eb3cSopenharmony_ci }); 162923b3eb3cSopenharmony_ci }, Button); 163023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 163123b3eb3cSopenharmony_ci __Common__.create(); 163223b3eb3cSopenharmony_ci __Common__.onSizeChange((s2, newValue) => { 163323b3eb3cSopenharmony_ci this.buttonItemsRealHeight[index] = newValue.height; 163423b3eb3cSopenharmony_ci let maxHeight = Math.max(...this.buttonItemsRealHeight.slice(0, 163523b3eb3cSopenharmony_ci this.options.buttons ? 163623b3eb3cSopenharmony_ci this.options.buttons.length : 0)); 163723b3eb3cSopenharmony_ci for (let index = 0; index < this.buttonItemsSize.length; index++) { 163823b3eb3cSopenharmony_ci this.buttonItemsSize[index] = 163923b3eb3cSopenharmony_ci { width: this.buttonItemsSize[index].width, height: maxHeight }; 164023b3eb3cSopenharmony_ci } 164123b3eb3cSopenharmony_ci this.calculateBorderRadius(); 164223b3eb3cSopenharmony_ci }); 164323b3eb3cSopenharmony_ci }, __Common__); 164423b3eb3cSopenharmony_ci { 164523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 164623b3eb3cSopenharmony_ci if (isInitialRender) { 164723b3eb3cSopenharmony_ci let componentCall = new i1(this, { 164823b3eb3cSopenharmony_ci selectedIndexes: this.t2, 164923b3eb3cSopenharmony_ci focusIndex: this.z2, 165023b3eb3cSopenharmony_ci index: index, 165123b3eb3cSopenharmony_ci itemOptions: item, 165223b3eb3cSopenharmony_ci options: this.options, 165323b3eb3cSopenharmony_ci property: this.buttonItemProperty[index], 165423b3eb3cSopenharmony_ci groupId: this.groupId, 165523b3eb3cSopenharmony_ci maxFontScale: this.maxFontScale 165623b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 165723b3eb3cSopenharmony_ci }, { 165823b3eb3cSopenharmony_ci page: "segmentbutton/src/main/ets/components/MainPage.ets", 165923b3eb3cSopenharmony_ci line: 813, 166023b3eb3cSopenharmony_ci u3: 15 166123b3eb3cSopenharmony_ci }); 166223b3eb3cSopenharmony_ci ViewPU.create(componentCall); 166323b3eb3cSopenharmony_ci let paramsLambda = () => { 166423b3eb3cSopenharmony_ci return { 166523b3eb3cSopenharmony_ci selectedIndexes: this.selectedIndexes, 166623b3eb3cSopenharmony_ci focusIndex: this.focusIndex, 166723b3eb3cSopenharmony_ci index: index, 166823b3eb3cSopenharmony_ci itemOptions: item, 166923b3eb3cSopenharmony_ci options: this.options, 167023b3eb3cSopenharmony_ci property: this.buttonItemProperty[index], 167123b3eb3cSopenharmony_ci groupId: this.groupId, 167223b3eb3cSopenharmony_ci maxFontScale: this.maxFontScale 167323b3eb3cSopenharmony_ci }; 167423b3eb3cSopenharmony_ci }; 167523b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 167623b3eb3cSopenharmony_ci } else { 167723b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, { 167823b3eb3cSopenharmony_ci index: index, 167923b3eb3cSopenharmony_ci itemOptions: item, 168023b3eb3cSopenharmony_ci options: this.options, 168123b3eb3cSopenharmony_ci property: this.buttonItemProperty[index], 168223b3eb3cSopenharmony_ci maxFontScale: this.maxFontScale 168323b3eb3cSopenharmony_ci }); 168423b3eb3cSopenharmony_ci } 168523b3eb3cSopenharmony_ci }, { name: "SegmentButtonItem" }); 168623b3eb3cSopenharmony_ci } 168723b3eb3cSopenharmony_ci __Common__.pop(); 168823b3eb3cSopenharmony_ci Button.pop(); 168923b3eb3cSopenharmony_ci }); 169023b3eb3cSopenharmony_ci } else { 169123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 169223b3eb3cSopenharmony_ci }); 169323b3eb3cSopenharmony_ci } 169423b3eb3cSopenharmony_ci }, If); 169523b3eb3cSopenharmony_ci If.pop(); 169623b3eb3cSopenharmony_ci }; 169723b3eb3cSopenharmony_ci this.forEachUpdateFunction(elmtId, this.optionsArray, forEachItemGenFunction, undefined, true, 169823b3eb3cSopenharmony_ci false); 169923b3eb3cSopenharmony_ci }, ForEach); 170023b3eb3cSopenharmony_ci ForEach.pop(); 170123b3eb3cSopenharmony_ci Row.pop(); 170223b3eb3cSopenharmony_ci }); 170323b3eb3cSopenharmony_ci } else { 170423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 170523b3eb3cSopenharmony_ci }); 170623b3eb3cSopenharmony_ci } 170723b3eb3cSopenharmony_ci }, If); 170823b3eb3cSopenharmony_ci If.pop(); 170923b3eb3cSopenharmony_ci } 171023b3eb3cSopenharmony_ci 171123b3eb3cSopenharmony_ci rerender() { 171223b3eb3cSopenharmony_ci this.updateDirtyElements(); 171323b3eb3cSopenharmony_ci } 171423b3eb3cSopenharmony_ci} 171523b3eb3cSopenharmony_ci 171623b3eb3cSopenharmony_cilet n1 = class ItemProperty { 171723b3eb3cSopenharmony_ci constructor() { 171823b3eb3cSopenharmony_ci this.fontColor = e1.q1; 171923b3eb3cSopenharmony_ci this.fontSize = e1.u1; 172023b3eb3cSopenharmony_ci this.fontWeight = FontWeight.Regular; 172123b3eb3cSopenharmony_ci this.isSelected = false; 172223b3eb3cSopenharmony_ci } 172323b3eb3cSopenharmony_ci}; 172423b3eb3cSopenharmony_cin1 = j([ 172523b3eb3cSopenharmony_ci Observed 172623b3eb3cSopenharmony_ci], n1); 172723b3eb3cSopenharmony_ci 172823b3eb3cSopenharmony_ciexport class SegmentButton extends ViewPU { 172923b3eb3cSopenharmony_ci constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) { 173023b3eb3cSopenharmony_ci super(parent, __localStorage, elmtId, extraInfo); 173123b3eb3cSopenharmony_ci if (typeof paramsLambda === "function") { 173223b3eb3cSopenharmony_ci this.paramsGenerator_ = paramsLambda; 173323b3eb3cSopenharmony_ci } 173423b3eb3cSopenharmony_ci this.o2 = new SynchedPropertyNesedObjectPU(params.options, this, "options"); 173523b3eb3cSopenharmony_ci this.t2 = new SynchedPropertyObjectTwoWayPU(params.selectedIndexes, this, "selectedIndexes"); 173623b3eb3cSopenharmony_ci this.onItemClicked = undefined; 173723b3eb3cSopenharmony_ci this.a3 = new SynchedPropertyObjectOneWayPU(params.maxFontScale, this, "maxFontScale"); 173823b3eb3cSopenharmony_ci this.i3 = new ObservedPropertyObjectPU({ width: 0, height: 0 }, this, "componentSize"); 173923b3eb3cSopenharmony_ci this.addProvidedVar("componentSize", this.i3, false); 174023b3eb3cSopenharmony_ci this.q2 = new ObservedPropertyObjectPU(Array.from({ 174123b3eb3cSopenharmony_ci length: a1 174223b3eb3cSopenharmony_ci }, (r2, index) => { 174323b3eb3cSopenharmony_ci return { 174423b3eb3cSopenharmony_ci topStart: LengthMetrics.vp(0), 174523b3eb3cSopenharmony_ci topEnd: LengthMetrics.vp(0), 174623b3eb3cSopenharmony_ci bottomStart: LengthMetrics.vp(0), 174723b3eb3cSopenharmony_ci bottomEnd: LengthMetrics.vp(0) 174823b3eb3cSopenharmony_ci }; 174923b3eb3cSopenharmony_ci }), this, "buttonBorderRadius"); 175023b3eb3cSopenharmony_ci this.addProvidedVar("buttonBorderRadius", this.q2, false); 175123b3eb3cSopenharmony_ci this.s2 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (q2, index) => { 175223b3eb3cSopenharmony_ci return {}; 175323b3eb3cSopenharmony_ci }), this, "buttonItemsSize"); 175423b3eb3cSopenharmony_ci this.addProvidedVar("buttonItemsSize", this.s2, false); 175523b3eb3cSopenharmony_ci this.j3 = new ObservedPropertyObjectPU(Array.from({ 175623b3eb3cSopenharmony_ci length: a1 175723b3eb3cSopenharmony_ci }, (o2, index) => { 175823b3eb3cSopenharmony_ci return {}; 175923b3eb3cSopenharmony_ci }), this, "buttonItemsPosition"); 176023b3eb3cSopenharmony_ci this.addProvidedVar("buttonItemsPosition", this.j3, false); 176123b3eb3cSopenharmony_ci this.m3 = 176223b3eb3cSopenharmony_ci new ObservedPropertyObjectPU(Array.from({ length: a1 }, (n2, index) => false), this, "buttonItemsSelected"); 176323b3eb3cSopenharmony_ci this.addProvidedVar("buttonItemsSelected", this.m3, false); 176423b3eb3cSopenharmony_ci this.l3 = new ObservedPropertyObjectPU(Array.from({ 176523b3eb3cSopenharmony_ci length: a1 176623b3eb3cSopenharmony_ci }, (m2, index) => new n1()), this, "buttonItemProperty"); 176723b3eb3cSopenharmony_ci this.addProvidedVar("buttonItemProperty", this.l3, false); 176823b3eb3cSopenharmony_ci this.z2 = new ObservedPropertySimplePU(-1, this, "focusIndex"); 176923b3eb3cSopenharmony_ci this.addProvidedVar("focusIndex", this.z2, false); 177023b3eb3cSopenharmony_ci this.u2 = new ObservedPropertyObjectPU({}, this, "selectedItemPosition"); 177123b3eb3cSopenharmony_ci this.addProvidedVar("selectedItemPosition", this.u2, false); 177223b3eb3cSopenharmony_ci this.v2 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (l2, index) => 1.0), this, "zoomScaleArray"); 177323b3eb3cSopenharmony_ci this.addProvidedVar("zoomScaleArray", this.v2, false); 177423b3eb3cSopenharmony_ci this.n3 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (k2, index) => false), this, "pressArray"); 177523b3eb3cSopenharmony_ci this.q3 = new ObservedPropertyObjectPU(Array.from({ length: a1 }, (j2, index) => false), this, "hoverArray"); 177623b3eb3cSopenharmony_ci this.r3 = new ObservedPropertyObjectPU(Array.from({ 177723b3eb3cSopenharmony_ci length: a1 177823b3eb3cSopenharmony_ci }, (i2, index) => new j1()), this, "hoverColorArray"); 177923b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 178023b3eb3cSopenharmony_ci this.isCurrentPositionSelected = false; 178123b3eb3cSopenharmony_ci this.panGestureStartPoint = { x: 0, y: 0 }; 178223b3eb3cSopenharmony_ci this.isPanGestureMoved = false; 178323b3eb3cSopenharmony_ci this.v3 = new ObservedPropertySimplePU(false, this, "shouldMirror"); 178423b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(params); 178523b3eb3cSopenharmony_ci this.declareWatch("options", this.onOptionsChange); 178623b3eb3cSopenharmony_ci this.declareWatch("selectedIndexes", this.onSelectedChange); 178723b3eb3cSopenharmony_ci this.declareWatch("buttonItemsPosition", this.onItemsPositionChange); 178823b3eb3cSopenharmony_ci this.finalizeConstruction(); 178923b3eb3cSopenharmony_ci } 179023b3eb3cSopenharmony_ci 179123b3eb3cSopenharmony_ci setInitiallyProvidedValue(params) { 179223b3eb3cSopenharmony_ci this.o2.set(params.options); 179323b3eb3cSopenharmony_ci if (params.onItemClicked !== undefined) { 179423b3eb3cSopenharmony_ci this.onItemClicked = params.onItemClicked; 179523b3eb3cSopenharmony_ci } 179623b3eb3cSopenharmony_ci if (params.maxFontScale === undefined) { 179723b3eb3cSopenharmony_ci this.a3.set(b1); 179823b3eb3cSopenharmony_ci } 179923b3eb3cSopenharmony_ci if (params.componentSize !== undefined) { 180023b3eb3cSopenharmony_ci this.componentSize = params.componentSize; 180123b3eb3cSopenharmony_ci } 180223b3eb3cSopenharmony_ci if (params.buttonBorderRadius !== undefined) { 180323b3eb3cSopenharmony_ci this.buttonBorderRadius = params.buttonBorderRadius; 180423b3eb3cSopenharmony_ci } 180523b3eb3cSopenharmony_ci if (params.buttonItemsSize !== undefined) { 180623b3eb3cSopenharmony_ci this.buttonItemsSize = params.buttonItemsSize; 180723b3eb3cSopenharmony_ci } 180823b3eb3cSopenharmony_ci if (params.buttonItemsPosition !== undefined) { 180923b3eb3cSopenharmony_ci this.buttonItemsPosition = params.buttonItemsPosition; 181023b3eb3cSopenharmony_ci } 181123b3eb3cSopenharmony_ci if (params.buttonItemsSelected !== undefined) { 181223b3eb3cSopenharmony_ci this.buttonItemsSelected = params.buttonItemsSelected; 181323b3eb3cSopenharmony_ci } 181423b3eb3cSopenharmony_ci if (params.buttonItemProperty !== undefined) { 181523b3eb3cSopenharmony_ci this.buttonItemProperty = params.buttonItemProperty; 181623b3eb3cSopenharmony_ci } 181723b3eb3cSopenharmony_ci if (params.focusIndex !== undefined) { 181823b3eb3cSopenharmony_ci this.focusIndex = params.focusIndex; 181923b3eb3cSopenharmony_ci } 182023b3eb3cSopenharmony_ci if (params.selectedItemPosition !== undefined) { 182123b3eb3cSopenharmony_ci this.selectedItemPosition = params.selectedItemPosition; 182223b3eb3cSopenharmony_ci } 182323b3eb3cSopenharmony_ci if (params.zoomScaleArray !== undefined) { 182423b3eb3cSopenharmony_ci this.zoomScaleArray = params.zoomScaleArray; 182523b3eb3cSopenharmony_ci } 182623b3eb3cSopenharmony_ci if (params.pressArray !== undefined) { 182723b3eb3cSopenharmony_ci this.pressArray = params.pressArray; 182823b3eb3cSopenharmony_ci } 182923b3eb3cSopenharmony_ci if (params.hoverArray !== undefined) { 183023b3eb3cSopenharmony_ci this.hoverArray = params.hoverArray; 183123b3eb3cSopenharmony_ci } 183223b3eb3cSopenharmony_ci if (params.hoverColorArray !== undefined) { 183323b3eb3cSopenharmony_ci this.hoverColorArray = params.hoverColorArray; 183423b3eb3cSopenharmony_ci } 183523b3eb3cSopenharmony_ci if (params.doSelectedChangeAnimate !== undefined) { 183623b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = params.doSelectedChangeAnimate; 183723b3eb3cSopenharmony_ci } 183823b3eb3cSopenharmony_ci if (params.isCurrentPositionSelected !== undefined) { 183923b3eb3cSopenharmony_ci this.isCurrentPositionSelected = params.isCurrentPositionSelected; 184023b3eb3cSopenharmony_ci } 184123b3eb3cSopenharmony_ci if (params.panGestureStartPoint !== undefined) { 184223b3eb3cSopenharmony_ci this.panGestureStartPoint = params.panGestureStartPoint; 184323b3eb3cSopenharmony_ci } 184423b3eb3cSopenharmony_ci if (params.isPanGestureMoved !== undefined) { 184523b3eb3cSopenharmony_ci this.isPanGestureMoved = params.isPanGestureMoved; 184623b3eb3cSopenharmony_ci } 184723b3eb3cSopenharmony_ci if (params.shouldMirror !== undefined) { 184823b3eb3cSopenharmony_ci this.shouldMirror = params.shouldMirror; 184923b3eb3cSopenharmony_ci } 185023b3eb3cSopenharmony_ci } 185123b3eb3cSopenharmony_ci 185223b3eb3cSopenharmony_ci updateStateVars(params) { 185323b3eb3cSopenharmony_ci this.o2.set(params.options); 185423b3eb3cSopenharmony_ci this.a3.reset(params.maxFontScale); 185523b3eb3cSopenharmony_ci } 185623b3eb3cSopenharmony_ci 185723b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(rmElmtId) { 185823b3eb3cSopenharmony_ci this.o2.purgeDependencyOnElmtId(rmElmtId); 185923b3eb3cSopenharmony_ci this.t2.purgeDependencyOnElmtId(rmElmtId); 186023b3eb3cSopenharmony_ci this.a3.purgeDependencyOnElmtId(rmElmtId); 186123b3eb3cSopenharmony_ci this.i3.purgeDependencyOnElmtId(rmElmtId); 186223b3eb3cSopenharmony_ci this.q2.purgeDependencyOnElmtId(rmElmtId); 186323b3eb3cSopenharmony_ci this.s2.purgeDependencyOnElmtId(rmElmtId); 186423b3eb3cSopenharmony_ci this.j3.purgeDependencyOnElmtId(rmElmtId); 186523b3eb3cSopenharmony_ci this.m3.purgeDependencyOnElmtId(rmElmtId); 186623b3eb3cSopenharmony_ci this.l3.purgeDependencyOnElmtId(rmElmtId); 186723b3eb3cSopenharmony_ci this.z2.purgeDependencyOnElmtId(rmElmtId); 186823b3eb3cSopenharmony_ci this.u2.purgeDependencyOnElmtId(rmElmtId); 186923b3eb3cSopenharmony_ci this.v2.purgeDependencyOnElmtId(rmElmtId); 187023b3eb3cSopenharmony_ci this.n3.purgeDependencyOnElmtId(rmElmtId); 187123b3eb3cSopenharmony_ci this.q3.purgeDependencyOnElmtId(rmElmtId); 187223b3eb3cSopenharmony_ci this.r3.purgeDependencyOnElmtId(rmElmtId); 187323b3eb3cSopenharmony_ci this.v3.purgeDependencyOnElmtId(rmElmtId); 187423b3eb3cSopenharmony_ci } 187523b3eb3cSopenharmony_ci 187623b3eb3cSopenharmony_ci aboutToBeDeleted() { 187723b3eb3cSopenharmony_ci this.o2.aboutToBeDeleted(); 187823b3eb3cSopenharmony_ci this.t2.aboutToBeDeleted(); 187923b3eb3cSopenharmony_ci this.a3.aboutToBeDeleted(); 188023b3eb3cSopenharmony_ci this.i3.aboutToBeDeleted(); 188123b3eb3cSopenharmony_ci this.q2.aboutToBeDeleted(); 188223b3eb3cSopenharmony_ci this.s2.aboutToBeDeleted(); 188323b3eb3cSopenharmony_ci this.j3.aboutToBeDeleted(); 188423b3eb3cSopenharmony_ci this.m3.aboutToBeDeleted(); 188523b3eb3cSopenharmony_ci this.l3.aboutToBeDeleted(); 188623b3eb3cSopenharmony_ci this.z2.aboutToBeDeleted(); 188723b3eb3cSopenharmony_ci this.u2.aboutToBeDeleted(); 188823b3eb3cSopenharmony_ci this.v2.aboutToBeDeleted(); 188923b3eb3cSopenharmony_ci this.n3.aboutToBeDeleted(); 189023b3eb3cSopenharmony_ci this.q3.aboutToBeDeleted(); 189123b3eb3cSopenharmony_ci this.r3.aboutToBeDeleted(); 189223b3eb3cSopenharmony_ci this.v3.aboutToBeDeleted(); 189323b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 189423b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 189523b3eb3cSopenharmony_ci } 189623b3eb3cSopenharmony_ci 189723b3eb3cSopenharmony_ci get options() { 189823b3eb3cSopenharmony_ci return this.o2.get(); 189923b3eb3cSopenharmony_ci } 190023b3eb3cSopenharmony_ci 190123b3eb3cSopenharmony_ci get selectedIndexes() { 190223b3eb3cSopenharmony_ci return this.t2.get(); 190323b3eb3cSopenharmony_ci } 190423b3eb3cSopenharmony_ci 190523b3eb3cSopenharmony_ci set selectedIndexes(newValue) { 190623b3eb3cSopenharmony_ci this.t2.set(newValue); 190723b3eb3cSopenharmony_ci } 190823b3eb3cSopenharmony_ci 190923b3eb3cSopenharmony_ci get maxFontScale() { 191023b3eb3cSopenharmony_ci return this.a3.get(); 191123b3eb3cSopenharmony_ci } 191223b3eb3cSopenharmony_ci 191323b3eb3cSopenharmony_ci set maxFontScale(newValue) { 191423b3eb3cSopenharmony_ci this.a3.set(newValue); 191523b3eb3cSopenharmony_ci } 191623b3eb3cSopenharmony_ci 191723b3eb3cSopenharmony_ci get componentSize() { 191823b3eb3cSopenharmony_ci return this.i3.get(); 191923b3eb3cSopenharmony_ci } 192023b3eb3cSopenharmony_ci 192123b3eb3cSopenharmony_ci set componentSize(newValue) { 192223b3eb3cSopenharmony_ci this.i3.set(newValue); 192323b3eb3cSopenharmony_ci } 192423b3eb3cSopenharmony_ci 192523b3eb3cSopenharmony_ci get buttonBorderRadius() { 192623b3eb3cSopenharmony_ci return this.q2.get(); 192723b3eb3cSopenharmony_ci } 192823b3eb3cSopenharmony_ci 192923b3eb3cSopenharmony_ci set buttonBorderRadius(newValue) { 193023b3eb3cSopenharmony_ci this.q2.set(newValue); 193123b3eb3cSopenharmony_ci } 193223b3eb3cSopenharmony_ci 193323b3eb3cSopenharmony_ci get buttonItemsSize() { 193423b3eb3cSopenharmony_ci return this.s2.get(); 193523b3eb3cSopenharmony_ci } 193623b3eb3cSopenharmony_ci 193723b3eb3cSopenharmony_ci set buttonItemsSize(newValue) { 193823b3eb3cSopenharmony_ci this.s2.set(newValue); 193923b3eb3cSopenharmony_ci } 194023b3eb3cSopenharmony_ci 194123b3eb3cSopenharmony_ci get buttonItemsPosition() { 194223b3eb3cSopenharmony_ci return this.j3.get(); 194323b3eb3cSopenharmony_ci } 194423b3eb3cSopenharmony_ci 194523b3eb3cSopenharmony_ci set buttonItemsPosition(newValue) { 194623b3eb3cSopenharmony_ci this.j3.set(newValue); 194723b3eb3cSopenharmony_ci } 194823b3eb3cSopenharmony_ci 194923b3eb3cSopenharmony_ci get buttonItemsSelected() { 195023b3eb3cSopenharmony_ci return this.m3.get(); 195123b3eb3cSopenharmony_ci } 195223b3eb3cSopenharmony_ci 195323b3eb3cSopenharmony_ci set buttonItemsSelected(newValue) { 195423b3eb3cSopenharmony_ci this.m3.set(newValue); 195523b3eb3cSopenharmony_ci } 195623b3eb3cSopenharmony_ci 195723b3eb3cSopenharmony_ci get buttonItemProperty() { 195823b3eb3cSopenharmony_ci return this.l3.get(); 195923b3eb3cSopenharmony_ci } 196023b3eb3cSopenharmony_ci 196123b3eb3cSopenharmony_ci set buttonItemProperty(newValue) { 196223b3eb3cSopenharmony_ci this.l3.set(newValue); 196323b3eb3cSopenharmony_ci } 196423b3eb3cSopenharmony_ci 196523b3eb3cSopenharmony_ci get focusIndex() { 196623b3eb3cSopenharmony_ci return this.z2.get(); 196723b3eb3cSopenharmony_ci } 196823b3eb3cSopenharmony_ci 196923b3eb3cSopenharmony_ci set focusIndex(newValue) { 197023b3eb3cSopenharmony_ci this.z2.set(newValue); 197123b3eb3cSopenharmony_ci } 197223b3eb3cSopenharmony_ci 197323b3eb3cSopenharmony_ci get selectedItemPosition() { 197423b3eb3cSopenharmony_ci return this.u2.get(); 197523b3eb3cSopenharmony_ci } 197623b3eb3cSopenharmony_ci 197723b3eb3cSopenharmony_ci set selectedItemPosition(newValue) { 197823b3eb3cSopenharmony_ci this.u2.set(newValue); 197923b3eb3cSopenharmony_ci } 198023b3eb3cSopenharmony_ci 198123b3eb3cSopenharmony_ci get zoomScaleArray() { 198223b3eb3cSopenharmony_ci return this.v2.get(); 198323b3eb3cSopenharmony_ci } 198423b3eb3cSopenharmony_ci 198523b3eb3cSopenharmony_ci set zoomScaleArray(newValue) { 198623b3eb3cSopenharmony_ci this.v2.set(newValue); 198723b3eb3cSopenharmony_ci } 198823b3eb3cSopenharmony_ci 198923b3eb3cSopenharmony_ci get pressArray() { 199023b3eb3cSopenharmony_ci return this.n3.get(); 199123b3eb3cSopenharmony_ci } 199223b3eb3cSopenharmony_ci 199323b3eb3cSopenharmony_ci set pressArray(newValue) { 199423b3eb3cSopenharmony_ci this.n3.set(newValue); 199523b3eb3cSopenharmony_ci } 199623b3eb3cSopenharmony_ci 199723b3eb3cSopenharmony_ci get hoverArray() { 199823b3eb3cSopenharmony_ci return this.q3.get(); 199923b3eb3cSopenharmony_ci } 200023b3eb3cSopenharmony_ci 200123b3eb3cSopenharmony_ci set hoverArray(newValue) { 200223b3eb3cSopenharmony_ci this.q3.set(newValue); 200323b3eb3cSopenharmony_ci } 200423b3eb3cSopenharmony_ci 200523b3eb3cSopenharmony_ci get hoverColorArray() { 200623b3eb3cSopenharmony_ci return this.r3.get(); 200723b3eb3cSopenharmony_ci } 200823b3eb3cSopenharmony_ci 200923b3eb3cSopenharmony_ci set hoverColorArray(newValue) { 201023b3eb3cSopenharmony_ci this.r3.set(newValue); 201123b3eb3cSopenharmony_ci } 201223b3eb3cSopenharmony_ci 201323b3eb3cSopenharmony_ci get shouldMirror() { 201423b3eb3cSopenharmony_ci return this.v3.get(); 201523b3eb3cSopenharmony_ci } 201623b3eb3cSopenharmony_ci 201723b3eb3cSopenharmony_ci set shouldMirror(newValue) { 201823b3eb3cSopenharmony_ci this.v3.set(newValue); 201923b3eb3cSopenharmony_ci } 202023b3eb3cSopenharmony_ci 202123b3eb3cSopenharmony_ci onItemsPositionChange() { 202223b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 202323b3eb3cSopenharmony_ci return; 202423b3eb3cSopenharmony_ci } 202523b3eb3cSopenharmony_ci if (this.doSelectedChangeAnimate) { 202623b3eb3cSopenharmony_ci this.updateAnimatedProperty(this.getSelectedChangeCurve()); 202723b3eb3cSopenharmony_ci } else { 202823b3eb3cSopenharmony_ci this.updateAnimatedProperty(null); 202923b3eb3cSopenharmony_ci } 203023b3eb3cSopenharmony_ci } 203123b3eb3cSopenharmony_ci 203223b3eb3cSopenharmony_ci setItemsSelected() { 203323b3eb3cSopenharmony_ci this.buttonItemsSelected.forEach((h2, index) => { 203423b3eb3cSopenharmony_ci this.buttonItemsSelected[index] = false; 203523b3eb3cSopenharmony_ci }); 203623b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 203723b3eb3cSopenharmony_ci this.selectedIndexes.forEach(index => this.buttonItemsSelected[index] = true); 203823b3eb3cSopenharmony_ci } else { 203923b3eb3cSopenharmony_ci this.buttonItemsSelected[this.selectedIndexes[0]] = true; 204023b3eb3cSopenharmony_ci } 204123b3eb3cSopenharmony_ci } 204223b3eb3cSopenharmony_ci 204323b3eb3cSopenharmony_ci updateSelectedIndexes() { 204423b3eb3cSopenharmony_ci if (this.selectedIndexes === void 0) { 204523b3eb3cSopenharmony_ci this.selectedIndexes = []; 204623b3eb3cSopenharmony_ci } 204723b3eb3cSopenharmony_ci if (this.options.type === 'tab' && this.selectedIndexes.length === 0) { 204823b3eb3cSopenharmony_ci this.selectedIndexes[0] = 0; 204923b3eb3cSopenharmony_ci } 205023b3eb3cSopenharmony_ci if (this.selectedIndexes.length > 1) { 205123b3eb3cSopenharmony_ci if (this.options.type === 'tab') { 205223b3eb3cSopenharmony_ci this.selectedIndexes = [0]; 205323b3eb3cSopenharmony_ci } 205423b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && !(this.options.multiply ?? false)) { 205523b3eb3cSopenharmony_ci this.selectedIndexes = []; 205623b3eb3cSopenharmony_ci } 205723b3eb3cSopenharmony_ci } 205823b3eb3cSopenharmony_ci let g2 = this.selectedIndexes.some(index => { 205923b3eb3cSopenharmony_ci return (index === void 0 || index < 0 || (this.options.buttons && index >= this.options.buttons.length)); 206023b3eb3cSopenharmony_ci }); 206123b3eb3cSopenharmony_ci if (g2) { 206223b3eb3cSopenharmony_ci if (this.options.type === 'tab') { 206323b3eb3cSopenharmony_ci this.selectedIndexes = [0]; 206423b3eb3cSopenharmony_ci } else { 206523b3eb3cSopenharmony_ci this.selectedIndexes = []; 206623b3eb3cSopenharmony_ci } 206723b3eb3cSopenharmony_ci } 206823b3eb3cSopenharmony_ci } 206923b3eb3cSopenharmony_ci 207023b3eb3cSopenharmony_ci onOptionsChange() { 207123b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 207223b3eb3cSopenharmony_ci return; 207323b3eb3cSopenharmony_ci } 207423b3eb3cSopenharmony_ci this.shouldMirror = this.isShouldMirror(); 207523b3eb3cSopenharmony_ci this.updateSelectedIndexes(); 207623b3eb3cSopenharmony_ci this.setItemsSelected(); 207723b3eb3cSopenharmony_ci this.updateAnimatedProperty(null); 207823b3eb3cSopenharmony_ci } 207923b3eb3cSopenharmony_ci 208023b3eb3cSopenharmony_ci onSelectedChange() { 208123b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 208223b3eb3cSopenharmony_ci return; 208323b3eb3cSopenharmony_ci } 208423b3eb3cSopenharmony_ci this.updateSelectedIndexes(); 208523b3eb3cSopenharmony_ci this.setItemsSelected(); 208623b3eb3cSopenharmony_ci if (this.doSelectedChangeAnimate) { 208723b3eb3cSopenharmony_ci this.updateAnimatedProperty(this.getSelectedChangeCurve()); 208823b3eb3cSopenharmony_ci } else { 208923b3eb3cSopenharmony_ci this.updateAnimatedProperty(null); 209023b3eb3cSopenharmony_ci } 209123b3eb3cSopenharmony_ci } 209223b3eb3cSopenharmony_ci 209323b3eb3cSopenharmony_ci aboutToAppear() { 209423b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 209523b3eb3cSopenharmony_ci return; 209623b3eb3cSopenharmony_ci } 209723b3eb3cSopenharmony_ci this.options.h2 = () => { 209823b3eb3cSopenharmony_ci if (this.options.type === 'tab') { 209923b3eb3cSopenharmony_ci this.selectedIndexes = [0]; 210023b3eb3cSopenharmony_ci } else { 210123b3eb3cSopenharmony_ci this.selectedIndexes = []; 210223b3eb3cSopenharmony_ci } 210323b3eb3cSopenharmony_ci }; 210423b3eb3cSopenharmony_ci this.shouldMirror = this.isShouldMirror(); 210523b3eb3cSopenharmony_ci this.updateSelectedIndexes(); 210623b3eb3cSopenharmony_ci this.setItemsSelected(); 210723b3eb3cSopenharmony_ci this.updateAnimatedProperty(null); 210823b3eb3cSopenharmony_ci } 210923b3eb3cSopenharmony_ci 211023b3eb3cSopenharmony_ci isMouseWheelScroll(event) { 211123b3eb3cSopenharmony_ci return event.source === SourceType.Mouse && !this.isPanGestureMoved; 211223b3eb3cSopenharmony_ci } 211323b3eb3cSopenharmony_ci 211423b3eb3cSopenharmony_ci isMovedFromPanGestureStartPoint(x, y) { 211523b3eb3cSopenharmony_ci return !i(x, this.panGestureStartPoint.x) || !i(y, this.panGestureStartPoint.y); 211623b3eb3cSopenharmony_ci } 211723b3eb3cSopenharmony_ci 211823b3eb3cSopenharmony_ci isShouldMirror() { 211923b3eb3cSopenharmony_ci if (this.options.direction == Direction.Rtl) { 212023b3eb3cSopenharmony_ci return true; 212123b3eb3cSopenharmony_ci } 212223b3eb3cSopenharmony_ci try { 212323b3eb3cSopenharmony_ci let f2 = t.System.getSystemLanguage(); 212423b3eb3cSopenharmony_ci if (f2 === 'ug' && this.options.direction != Direction.Ltr) { 212523b3eb3cSopenharmony_ci return true; 212623b3eb3cSopenharmony_ci } 212723b3eb3cSopenharmony_ci } catch (error) { 212823b3eb3cSopenharmony_ci console.error(`Ace SegmentButton getSystemLanguage, error: ${error.toString()}`); 212923b3eb3cSopenharmony_ci } 213023b3eb3cSopenharmony_ci return false; 213123b3eb3cSopenharmony_ci } 213223b3eb3cSopenharmony_ci 213323b3eb3cSopenharmony_ci initialRender() { 213423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 213523b3eb3cSopenharmony_ci Stack.create(); 213623b3eb3cSopenharmony_ci Stack.direction(this.options ? this.options.direction : undefined); 213723b3eb3cSopenharmony_ci Stack.onBlur(() => { 213823b3eb3cSopenharmony_ci this.focusIndex = -1; 213923b3eb3cSopenharmony_ci }); 214023b3eb3cSopenharmony_ci Stack.onKeyEvent((event) => { 214123b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 214223b3eb3cSopenharmony_ci return; 214323b3eb3cSopenharmony_ci } 214423b3eb3cSopenharmony_ci if (event.type === KeyType.Down) { 214523b3eb3cSopenharmony_ci if (event.keyCode === KeyCode.KEYCODE_SPACE || event.keyCode === KeyCode.KEYCODE_ENTER || 214623b3eb3cSopenharmony_ci event.keyCode === KeyCode.KEYCODE_NUMPAD_ENTER) { 214723b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 214823b3eb3cSopenharmony_ci if (this.selectedIndexes.indexOf(this.focusIndex) === -1) { 214923b3eb3cSopenharmony_ci this.selectedIndexes.push(this.focusIndex); 215023b3eb3cSopenharmony_ci } else { 215123b3eb3cSopenharmony_ci this.selectedIndexes.splice(this.selectedIndexes.indexOf(this.focusIndex), 1); 215223b3eb3cSopenharmony_ci } 215323b3eb3cSopenharmony_ci } else { 215423b3eb3cSopenharmony_ci this.selectedIndexes[0] = this.focusIndex; 215523b3eb3cSopenharmony_ci } 215623b3eb3cSopenharmony_ci } 215723b3eb3cSopenharmony_ci } 215823b3eb3cSopenharmony_ci }); 215923b3eb3cSopenharmony_ci Stack.accessibilityLevel('no'); 216023b3eb3cSopenharmony_ci Gesture.create(GesturePriority.High); 216123b3eb3cSopenharmony_ci GestureGroup.create(GestureMode.Parallel); 216223b3eb3cSopenharmony_ci TapGesture.create(); 216323b3eb3cSopenharmony_ci TapGesture.onAction((event) => { 216423b3eb3cSopenharmony_ci this.focusIndex = -1; 216523b3eb3cSopenharmony_ci let a2 = event.fingerList.find(Boolean); 216623b3eb3cSopenharmony_ci if (a2 === void 0) { 216723b3eb3cSopenharmony_ci return; 216823b3eb3cSopenharmony_ci } 216923b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 217023b3eb3cSopenharmony_ci return; 217123b3eb3cSopenharmony_ci } 217223b3eb3cSopenharmony_ci let b2 = a2.localX; 217323b3eb3cSopenharmony_ci let c2 = Math.min(this.options.buttons.length, this.buttonItemsSize.length); 217423b3eb3cSopenharmony_ci for (let d2 = 0; d2 < c2; d2++) { 217523b3eb3cSopenharmony_ci b2 = b2 - this.buttonItemsSize[d2].width; 217623b3eb3cSopenharmony_ci if (b2 >= 0) { 217723b3eb3cSopenharmony_ci continue; 217823b3eb3cSopenharmony_ci } 217923b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = 218023b3eb3cSopenharmony_ci this.selectedIndexes[0] > Math.min(this.options.buttons.length, this.buttonItemsSize.length) ? 218123b3eb3cSopenharmony_ci false : true; 218223b3eb3cSopenharmony_ci let e2 = this.isShouldMirror() ? c2 - 1 - d2 : d2; 218323b3eb3cSopenharmony_ci if (this.onItemClicked) { 218423b3eb3cSopenharmony_ci this.onItemClicked(e2); 218523b3eb3cSopenharmony_ci } 218623b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 218723b3eb3cSopenharmony_ci let selectedIndex = this.selectedIndexes.indexOf(e2); 218823b3eb3cSopenharmony_ci if (selectedIndex === -1) { 218923b3eb3cSopenharmony_ci this.selectedIndexes.push(e2); 219023b3eb3cSopenharmony_ci } else { 219123b3eb3cSopenharmony_ci this.selectedIndexes.splice(selectedIndex, 1); 219223b3eb3cSopenharmony_ci } 219323b3eb3cSopenharmony_ci } else { 219423b3eb3cSopenharmony_ci this.selectedIndexes[0] = e2; 219523b3eb3cSopenharmony_ci } 219623b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 219723b3eb3cSopenharmony_ci break; 219823b3eb3cSopenharmony_ci } 219923b3eb3cSopenharmony_ci }); 220023b3eb3cSopenharmony_ci TapGesture.pop(); 220123b3eb3cSopenharmony_ci SwipeGesture.create(); 220223b3eb3cSopenharmony_ci SwipeGesture.onAction((event) => { 220323b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0 || 220423b3eb3cSopenharmony_ci event.sourceTool === SourceTool.TOUCHPAD) { 220523b3eb3cSopenharmony_ci return; 220623b3eb3cSopenharmony_ci } 220723b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 220823b3eb3cSopenharmony_ci return; 220923b3eb3cSopenharmony_ci } 221023b3eb3cSopenharmony_ci if (this.isCurrentPositionSelected) { 221123b3eb3cSopenharmony_ci return; 221223b3eb3cSopenharmony_ci } 221323b3eb3cSopenharmony_ci if (Math.abs(event.angle) < 90 && this.selectedIndexes[0] !== 221423b3eb3cSopenharmony_ci Math.min(this.options.buttons.length, this.buttonItemsSize.length) - 1) { 221523b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = true; 221623b3eb3cSopenharmony_ci this.selectedIndexes[0] = this.selectedIndexes[0] + 1; 221723b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 221823b3eb3cSopenharmony_ci } else if (Math.abs(event.angle) > 90 && this.selectedIndexes[0] !== 0) { 221923b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = true; 222023b3eb3cSopenharmony_ci this.selectedIndexes[0] = this.selectedIndexes[0] - 1; 222123b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 222223b3eb3cSopenharmony_ci } 222323b3eb3cSopenharmony_ci }); 222423b3eb3cSopenharmony_ci SwipeGesture.pop(); 222523b3eb3cSopenharmony_ci PanGesture.create(); 222623b3eb3cSopenharmony_ci PanGesture.onActionStart((event) => { 222723b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 222823b3eb3cSopenharmony_ci return; 222923b3eb3cSopenharmony_ci } 223023b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 223123b3eb3cSopenharmony_ci return; 223223b3eb3cSopenharmony_ci } 223323b3eb3cSopenharmony_ci let v1 = event.fingerList.find(Boolean); 223423b3eb3cSopenharmony_ci if (v1 === void 0) { 223523b3eb3cSopenharmony_ci return; 223623b3eb3cSopenharmony_ci } 223723b3eb3cSopenharmony_ci let w1 = v1.localX; 223823b3eb3cSopenharmony_ci this.panGestureStartPoint = { x: v1.globalX, y: v1.globalY }; 223923b3eb3cSopenharmony_ci this.isPanGestureMoved = false; 224023b3eb3cSopenharmony_ci for (let z1 = 0; z1 < Math.min(this.options.buttons.length, this.buttonItemsSize.length); z1++) { 224123b3eb3cSopenharmony_ci w1 = w1 - this.buttonItemsSize[z1].width; 224223b3eb3cSopenharmony_ci if (w1 < 0) { 224323b3eb3cSopenharmony_ci this.isCurrentPositionSelected = z1 === this.selectedIndexes[0] ? true : false; 224423b3eb3cSopenharmony_ci break; 224523b3eb3cSopenharmony_ci } 224623b3eb3cSopenharmony_ci } 224723b3eb3cSopenharmony_ci }); 224823b3eb3cSopenharmony_ci PanGesture.onActionUpdate((event) => { 224923b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 225023b3eb3cSopenharmony_ci return; 225123b3eb3cSopenharmony_ci } 225223b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 225323b3eb3cSopenharmony_ci return; 225423b3eb3cSopenharmony_ci } 225523b3eb3cSopenharmony_ci if (!this.isCurrentPositionSelected) { 225623b3eb3cSopenharmony_ci return; 225723b3eb3cSopenharmony_ci } 225823b3eb3cSopenharmony_ci let q1 = event.fingerList.find(Boolean); 225923b3eb3cSopenharmony_ci if (q1 === void 0) { 226023b3eb3cSopenharmony_ci return; 226123b3eb3cSopenharmony_ci } 226223b3eb3cSopenharmony_ci let s1 = q1.localX; 226323b3eb3cSopenharmony_ci if (!this.isPanGestureMoved && this.isMovedFromPanGestureStartPoint(q1.globalX, q1.globalY)) { 226423b3eb3cSopenharmony_ci this.isPanGestureMoved = true; 226523b3eb3cSopenharmony_ci } 226623b3eb3cSopenharmony_ci for (let u1 = 0; u1 < Math.min(this.options.buttons.length, this.buttonItemsSize.length); u1++) { 226723b3eb3cSopenharmony_ci s1 = s1 - this.buttonItemsSize[u1].width; 226823b3eb3cSopenharmony_ci if (s1 < 0) { 226923b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = true; 227023b3eb3cSopenharmony_ci this.selectedIndexes[0] = u1; 227123b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 227223b3eb3cSopenharmony_ci break; 227323b3eb3cSopenharmony_ci } 227423b3eb3cSopenharmony_ci } 227523b3eb3cSopenharmony_ci this.zoomScaleArray.forEach((t1, index) => { 227623b3eb3cSopenharmony_ci if (index === this.selectedIndexes[0]) { 227723b3eb3cSopenharmony_ci Context.animateTo({ curve: curves.interpolatingSpring(10, 1, 410, 38) }, () => { 227823b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 0.95; 227923b3eb3cSopenharmony_ci }); 228023b3eb3cSopenharmony_ci } else { 228123b3eb3cSopenharmony_ci Context.animateTo({ curve: curves.interpolatingSpring(10, 1, 410, 38) }, () => { 228223b3eb3cSopenharmony_ci this.zoomScaleArray[index] = 1; 228323b3eb3cSopenharmony_ci }); 228423b3eb3cSopenharmony_ci } 228523b3eb3cSopenharmony_ci }); 228623b3eb3cSopenharmony_ci }); 228723b3eb3cSopenharmony_ci PanGesture.onActionEnd((event) => { 228823b3eb3cSopenharmony_ci if (this.options === void 0 || this.options.buttons === void 0) { 228923b3eb3cSopenharmony_ci return; 229023b3eb3cSopenharmony_ci } 229123b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 229223b3eb3cSopenharmony_ci return; 229323b3eb3cSopenharmony_ci } 229423b3eb3cSopenharmony_ci let p1 = event.fingerList.find(Boolean); 229523b3eb3cSopenharmony_ci if (p1 === void 0) { 229623b3eb3cSopenharmony_ci return; 229723b3eb3cSopenharmony_ci } 229823b3eb3cSopenharmony_ci if (!this.isPanGestureMoved && this.isMovedFromPanGestureStartPoint(p1.globalX, p1.globalY)) { 229923b3eb3cSopenharmony_ci this.isPanGestureMoved = true; 230023b3eb3cSopenharmony_ci } 230123b3eb3cSopenharmony_ci if (this.isMouseWheelScroll(event)) { 230223b3eb3cSopenharmony_ci let offset = event.offsetX !== 0 ? event.offsetX : event.offsetY; 230323b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = true; 230423b3eb3cSopenharmony_ci if (offset > 0 && this.selectedIndexes[0] > 0) { 230523b3eb3cSopenharmony_ci this.selectedIndexes[0] -= 1; 230623b3eb3cSopenharmony_ci } else if (offset < 0 && this.selectedIndexes[0] < 230723b3eb3cSopenharmony_ci Math.min(this.options.buttons.length, this.buttonItemsSize.length) - 1) { 230823b3eb3cSopenharmony_ci this.selectedIndexes[0] += 1; 230923b3eb3cSopenharmony_ci } 231023b3eb3cSopenharmony_ci this.doSelectedChangeAnimate = false; 231123b3eb3cSopenharmony_ci } 231223b3eb3cSopenharmony_ci Context.animateTo({ curve: curves.interpolatingSpring(10, 1, 410, 38) }, () => { 231323b3eb3cSopenharmony_ci this.zoomScaleArray[this.selectedIndexes[0]] = 1; 231423b3eb3cSopenharmony_ci }); 231523b3eb3cSopenharmony_ci this.isCurrentPositionSelected = false; 231623b3eb3cSopenharmony_ci }); 231723b3eb3cSopenharmony_ci PanGesture.pop(); 231823b3eb3cSopenharmony_ci GestureGroup.pop(); 231923b3eb3cSopenharmony_ci Gesture.pop(); 232023b3eb3cSopenharmony_ci }, Stack); 232123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 232223b3eb3cSopenharmony_ci If.create(); 232323b3eb3cSopenharmony_ci if (this.options !== void 0 && this.options.buttons != void 0) { 232423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 232523b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 232623b3eb3cSopenharmony_ci If.create(); 232723b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 232823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 232923b3eb3cSopenharmony_ci { 233023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 233123b3eb3cSopenharmony_ci if (isInitialRender) { 233223b3eb3cSopenharmony_ci let componentCall = new f1(this, { 233323b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 233423b3eb3cSopenharmony_ci options: this.options, 233523b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 233623b3eb3cSopenharmony_ci }, { 233723b3eb3cSopenharmony_ci page: "segmentbutton/src/main/ets/components/MainPage.ets", 233823b3eb3cSopenharmony_ci line: 1114, 233923b3eb3cSopenharmony_ci u3: 11 234023b3eb3cSopenharmony_ci }); 234123b3eb3cSopenharmony_ci ViewPU.create(componentCall); 234223b3eb3cSopenharmony_ci let paramsLambda = () => { 234323b3eb3cSopenharmony_ci return { 234423b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 234523b3eb3cSopenharmony_ci options: this.options 234623b3eb3cSopenharmony_ci }; 234723b3eb3cSopenharmony_ci }; 234823b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 234923b3eb3cSopenharmony_ci } else { 235023b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, { 235123b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 235223b3eb3cSopenharmony_ci options: this.options 235323b3eb3cSopenharmony_ci }); 235423b3eb3cSopenharmony_ci } 235523b3eb3cSopenharmony_ci }, { name: "MultiSelectBackground" }); 235623b3eb3cSopenharmony_ci } 235723b3eb3cSopenharmony_ci }); 235823b3eb3cSopenharmony_ci } else { 235923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 236023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 236123b3eb3cSopenharmony_ci Stack.create(); 236223b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 236323b3eb3cSopenharmony_ci Stack.size(ObservedObject.GetRawObject(this.componentSize)); 236423b3eb3cSopenharmony_ci Stack.backgroundColor(this.options.backgroundColor ?? e1.BACKGROUND_COLOR); 236523b3eb3cSopenharmony_ci Stack.borderRadius(this.options.l2 ?? this.componentSize.height / 2); 236623b3eb3cSopenharmony_ci Stack.backgroundBlurStyle(this.options.backgroundBlurStyle); 236723b3eb3cSopenharmony_ci }, Stack); 236823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 236923b3eb3cSopenharmony_ci If.create(); 237023b3eb3cSopenharmony_ci if (this.options.buttons !== void 0 && this.options.buttons.length > 1) { 237123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 237223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 237323b3eb3cSopenharmony_ci Row.create({ space: 1 }); 237423b3eb3cSopenharmony_ci Row.direction(this.options.direction); 237523b3eb3cSopenharmony_ci }, Row); 237623b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 237723b3eb3cSopenharmony_ci ForEach.create(); 237823b3eb3cSopenharmony_ci const forEachItemGenFunction = (_item, index) => { 237923b3eb3cSopenharmony_ci const item = _item; 238023b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 238123b3eb3cSopenharmony_ci If.create(); 238223b3eb3cSopenharmony_ci if (index < a1) { 238323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 238423b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, 238523b3eb3cSopenharmony_ci isInitialRender) => { 238623b3eb3cSopenharmony_ci Stack.create(); 238723b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 238823b3eb3cSopenharmony_ci Stack.scale({ 238923b3eb3cSopenharmony_ci x: this.options.type === 'capsule' && 239023b3eb3cSopenharmony_ci (this.options.multiply ?? false) ? 1 : 239123b3eb3cSopenharmony_ci this.zoomScaleArray[index], 239223b3eb3cSopenharmony_ci y: this.options.type === 'capsule' && 239323b3eb3cSopenharmony_ci (this.options.multiply ?? false) ? 1 : 239423b3eb3cSopenharmony_ci this.zoomScaleArray[index] 239523b3eb3cSopenharmony_ci }); 239623b3eb3cSopenharmony_ci }, Stack); 239723b3eb3cSopenharmony_ci { 239823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, 239923b3eb3cSopenharmony_ci isInitialRender) => { 240023b3eb3cSopenharmony_ci if (isInitialRender) { 240123b3eb3cSopenharmony_ci let componentCall = new l1(this, { 240223b3eb3cSopenharmony_ci pressIndex: index, 240323b3eb3cSopenharmony_ci colorProperty: this.hoverColorArray[index], 240423b3eb3cSopenharmony_ci press: this.pressArray[index], 240523b3eb3cSopenharmony_ci hover: this.hoverArray[index], 240623b3eb3cSopenharmony_ci options: this.options, 240723b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 240823b3eb3cSopenharmony_ci }, { 240923b3eb3cSopenharmony_ci page: "segmentbutton/src/main/ets/components/MainPage.ets", 241023b3eb3cSopenharmony_ci line: 1125, 241123b3eb3cSopenharmony_ci u3: 23 241223b3eb3cSopenharmony_ci }); 241323b3eb3cSopenharmony_ci ViewPU.create(componentCall); 241423b3eb3cSopenharmony_ci let paramsLambda = () => { 241523b3eb3cSopenharmony_ci return { 241623b3eb3cSopenharmony_ci pressIndex: index, 241723b3eb3cSopenharmony_ci colorProperty: this.hoverColorArray[index], 241823b3eb3cSopenharmony_ci press: this.pressArray[index], 241923b3eb3cSopenharmony_ci hover: this.hoverArray[index], 242023b3eb3cSopenharmony_ci options: this.options 242123b3eb3cSopenharmony_ci }; 242223b3eb3cSopenharmony_ci }; 242323b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = 242423b3eb3cSopenharmony_ci paramsLambda; 242523b3eb3cSopenharmony_ci } else { 242623b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, 242723b3eb3cSopenharmony_ci { 242823b3eb3cSopenharmony_ci colorProperty: this.hoverColorArray[index], 242923b3eb3cSopenharmony_ci press: this.pressArray[index], 243023b3eb3cSopenharmony_ci hover: this.hoverArray[index], 243123b3eb3cSopenharmony_ci options: this.options 243223b3eb3cSopenharmony_ci }); 243323b3eb3cSopenharmony_ci } 243423b3eb3cSopenharmony_ci }, { name: "PressAndHoverEffect" }); 243523b3eb3cSopenharmony_ci } 243623b3eb3cSopenharmony_ci Stack.pop(); 243723b3eb3cSopenharmony_ci }); 243823b3eb3cSopenharmony_ci } else { 243923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 244023b3eb3cSopenharmony_ci }); 244123b3eb3cSopenharmony_ci } 244223b3eb3cSopenharmony_ci }, If); 244323b3eb3cSopenharmony_ci If.pop(); 244423b3eb3cSopenharmony_ci }; 244523b3eb3cSopenharmony_ci this.forEachUpdateFunction(elmtId, this.options.buttons, 244623b3eb3cSopenharmony_ci forEachItemGenFunction, undefined, true, false); 244723b3eb3cSopenharmony_ci }, ForEach); 244823b3eb3cSopenharmony_ci ForEach.pop(); 244923b3eb3cSopenharmony_ci Row.pop(); 245023b3eb3cSopenharmony_ci }); 245123b3eb3cSopenharmony_ci } else { 245223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 245323b3eb3cSopenharmony_ci }); 245423b3eb3cSopenharmony_ci } 245523b3eb3cSopenharmony_ci }, If); 245623b3eb3cSopenharmony_ci If.pop(); 245723b3eb3cSopenharmony_ci Stack.pop(); 245823b3eb3cSopenharmony_ci }); 245923b3eb3cSopenharmony_ci } 246023b3eb3cSopenharmony_ci }, If); 246123b3eb3cSopenharmony_ci If.pop(); 246223b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 246323b3eb3cSopenharmony_ci Stack.create(); 246423b3eb3cSopenharmony_ci Context.animation({ duration: 0 }); 246523b3eb3cSopenharmony_ci Stack.direction(this.options.direction); 246623b3eb3cSopenharmony_ci Stack.size(ObservedObject.GetRawObject(this.componentSize)); 246723b3eb3cSopenharmony_ci Context.animation(null); 246823b3eb3cSopenharmony_ci Stack.borderRadius((this.options.type === 'capsule' && (this.options.multiply ?? false) ? 246923b3eb3cSopenharmony_ci this.options.j2 : this.options.l2) ?? 247023b3eb3cSopenharmony_ci this.componentSize.height / 2); 247123b3eb3cSopenharmony_ci Stack.clip(true); 247223b3eb3cSopenharmony_ci }, Stack); 247323b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 247423b3eb3cSopenharmony_ci If.create(); 247523b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 247623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 247723b3eb3cSopenharmony_ci { 247823b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 247923b3eb3cSopenharmony_ci if (isInitialRender) { 248023b3eb3cSopenharmony_ci let componentCall = new h1(this, { 248123b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 248223b3eb3cSopenharmony_ci options: this.options, 248323b3eb3cSopenharmony_ci selectedIndexes: this.t2 248423b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 248523b3eb3cSopenharmony_ci }, { 248623b3eb3cSopenharmony_ci page: "segmentbutton/src/main/ets/components/MainPage.ets", 248723b3eb3cSopenharmony_ci line: 1151, 248823b3eb3cSopenharmony_ci u3: 13 248923b3eb3cSopenharmony_ci }); 249023b3eb3cSopenharmony_ci ViewPU.create(componentCall); 249123b3eb3cSopenharmony_ci let paramsLambda = () => { 249223b3eb3cSopenharmony_ci return { 249323b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 249423b3eb3cSopenharmony_ci options: this.options, 249523b3eb3cSopenharmony_ci selectedIndexes: this.selectedIndexes 249623b3eb3cSopenharmony_ci }; 249723b3eb3cSopenharmony_ci }; 249823b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 249923b3eb3cSopenharmony_ci } else { 250023b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, { 250123b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 250223b3eb3cSopenharmony_ci options: this.options 250323b3eb3cSopenharmony_ci }); 250423b3eb3cSopenharmony_ci } 250523b3eb3cSopenharmony_ci }, { name: "MultiSelectItemArray" }); 250623b3eb3cSopenharmony_ci } 250723b3eb3cSopenharmony_ci }); 250823b3eb3cSopenharmony_ci } else { 250923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 251023b3eb3cSopenharmony_ci { 251123b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 251223b3eb3cSopenharmony_ci if (isInitialRender) { 251323b3eb3cSopenharmony_ci let componentCall = new g1(this, { 251423b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 251523b3eb3cSopenharmony_ci options: this.options, 251623b3eb3cSopenharmony_ci selectedIndexes: this.t2 251723b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 251823b3eb3cSopenharmony_ci }, { 251923b3eb3cSopenharmony_ci page: "segmentbutton/src/main/ets/components/MainPage.ets", 252023b3eb3cSopenharmony_ci line: 1157, 252123b3eb3cSopenharmony_ci u3: 13 252223b3eb3cSopenharmony_ci }); 252323b3eb3cSopenharmony_ci ViewPU.create(componentCall); 252423b3eb3cSopenharmony_ci let paramsLambda = () => { 252523b3eb3cSopenharmony_ci return { 252623b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 252723b3eb3cSopenharmony_ci options: this.options, 252823b3eb3cSopenharmony_ci selectedIndexes: this.selectedIndexes 252923b3eb3cSopenharmony_ci }; 253023b3eb3cSopenharmony_ci }; 253123b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 253223b3eb3cSopenharmony_ci } else { 253323b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, { 253423b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 253523b3eb3cSopenharmony_ci options: this.options 253623b3eb3cSopenharmony_ci }); 253723b3eb3cSopenharmony_ci } 253823b3eb3cSopenharmony_ci }, { name: "SelectItem" }); 253923b3eb3cSopenharmony_ci } 254023b3eb3cSopenharmony_ci }); 254123b3eb3cSopenharmony_ci } 254223b3eb3cSopenharmony_ci }, If); 254323b3eb3cSopenharmony_ci If.pop(); 254423b3eb3cSopenharmony_ci Stack.pop(); 254523b3eb3cSopenharmony_ci { 254623b3eb3cSopenharmony_ci this.observeComponentCreation2((elmtId, isInitialRender) => { 254723b3eb3cSopenharmony_ci if (isInitialRender) { 254823b3eb3cSopenharmony_ci let componentCall = new m1(this, { 254923b3eb3cSopenharmony_ci pressArray: this.n3, 255023b3eb3cSopenharmony_ci hoverArray: this.q3, 255123b3eb3cSopenharmony_ci hoverColorArray: this.r3, 255223b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 255323b3eb3cSopenharmony_ci options: this.options, 255423b3eb3cSopenharmony_ci selectedIndexes: this.t2, 255523b3eb3cSopenharmony_ci maxFontScale: this.getMaxFontSize() 255623b3eb3cSopenharmony_ci }, undefined, elmtId, () => { 255723b3eb3cSopenharmony_ci }, { page: "segmentbutton/src/main/ets/components/MainPage.ets", line: 1172, u3: 9 }); 255823b3eb3cSopenharmony_ci ViewPU.create(componentCall); 255923b3eb3cSopenharmony_ci let paramsLambda = () => { 256023b3eb3cSopenharmony_ci return { 256123b3eb3cSopenharmony_ci pressArray: this.pressArray, 256223b3eb3cSopenharmony_ci hoverArray: this.hoverArray, 256323b3eb3cSopenharmony_ci hoverColorArray: this.hoverColorArray, 256423b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 256523b3eb3cSopenharmony_ci options: this.options, 256623b3eb3cSopenharmony_ci selectedIndexes: this.selectedIndexes, 256723b3eb3cSopenharmony_ci maxFontScale: this.getMaxFontSize() 256823b3eb3cSopenharmony_ci }; 256923b3eb3cSopenharmony_ci }; 257023b3eb3cSopenharmony_ci componentCall.paramsGenerator_ = paramsLambda; 257123b3eb3cSopenharmony_ci } else { 257223b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(elmtId, { 257323b3eb3cSopenharmony_ci optionsArray: this.options.buttons, 257423b3eb3cSopenharmony_ci options: this.options, 257523b3eb3cSopenharmony_ci maxFontScale: this.getMaxFontSize() 257623b3eb3cSopenharmony_ci }); 257723b3eb3cSopenharmony_ci } 257823b3eb3cSopenharmony_ci }, { name: "SegmentButtonItemArrayComponent" }); 257923b3eb3cSopenharmony_ci } 258023b3eb3cSopenharmony_ci }); 258123b3eb3cSopenharmony_ci } else { 258223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 258323b3eb3cSopenharmony_ci }); 258423b3eb3cSopenharmony_ci } 258523b3eb3cSopenharmony_ci }, If); 258623b3eb3cSopenharmony_ci If.pop(); 258723b3eb3cSopenharmony_ci Stack.pop(); 258823b3eb3cSopenharmony_ci } 258923b3eb3cSopenharmony_ci 259023b3eb3cSopenharmony_ci getMaxFontSize() { 259123b3eb3cSopenharmony_ci if (typeof this.maxFontScale === void 0) { 259223b3eb3cSopenharmony_ci return b1; 259323b3eb3cSopenharmony_ci } 259423b3eb3cSopenharmony_ci if (typeof this.maxFontScale === 'number') { 259523b3eb3cSopenharmony_ci return Math.max(Math.min(this.maxFontScale, c1), d1); 259623b3eb3cSopenharmony_ci } 259723b3eb3cSopenharmony_ci const resourceManager = this.getUIContext().getHostContext()?.resourceManager; 259823b3eb3cSopenharmony_ci if (!resourceManager) { 259923b3eb3cSopenharmony_ci return b1; 260023b3eb3cSopenharmony_ci } 260123b3eb3cSopenharmony_ci try { 260223b3eb3cSopenharmony_ci return resourceManager.getNumber(this.maxFontScale.id); 260323b3eb3cSopenharmony_ci } catch (error) { 260423b3eb3cSopenharmony_ci console.error(`Ace SegmentButton getMaxFontSize, error: ${error.toString()}`); 260523b3eb3cSopenharmony_ci return b1; 260623b3eb3cSopenharmony_ci } 260723b3eb3cSopenharmony_ci } 260823b3eb3cSopenharmony_ci 260923b3eb3cSopenharmony_ci getSelectedChangeCurve() { 261023b3eb3cSopenharmony_ci if (this.options.type === 'capsule' && (this.options.multiply ?? false)) { 261123b3eb3cSopenharmony_ci return null; 261223b3eb3cSopenharmony_ci } 261323b3eb3cSopenharmony_ci return curves.springMotion(0.347, 0.99); 261423b3eb3cSopenharmony_ci } 261523b3eb3cSopenharmony_ci 261623b3eb3cSopenharmony_ci updateAnimatedProperty(curve) { 261723b3eb3cSopenharmony_ci let o1 = () => { 261823b3eb3cSopenharmony_ci this.selectedItemPosition = 261923b3eb3cSopenharmony_ci this.selectedIndexes.length === 0 ? {} : this.buttonItemsPosition[this.selectedIndexes[0]]; 262023b3eb3cSopenharmony_ci this.buttonItemsSelected.forEach((selected, index) => { 262123b3eb3cSopenharmony_ci this.buttonItemProperty[index].fontColor = selected ? 262223b3eb3cSopenharmony_ci this.options.selectedFontColor ?? (this.options.type === 'tab' ? 262323b3eb3cSopenharmony_ci e1.s1 : e1.t1) : 262423b3eb3cSopenharmony_ci this.options.fontColor ?? e1.q1; 262523b3eb3cSopenharmony_ci }); 262623b3eb3cSopenharmony_ci }; 262723b3eb3cSopenharmony_ci if (curve) { 262823b3eb3cSopenharmony_ci Context.animateTo({ curve: curve }, o1); 262923b3eb3cSopenharmony_ci } else { 263023b3eb3cSopenharmony_ci o1(); 263123b3eb3cSopenharmony_ci } 263223b3eb3cSopenharmony_ci this.buttonItemsSelected.forEach((selected, index) => { 263323b3eb3cSopenharmony_ci this.buttonItemProperty[index].fontSize = selected ? this.options.selectedFontSize ?? 263423b3eb3cSopenharmony_ci e1.v1 : this.options.fontSize ?? e1.u1; 263523b3eb3cSopenharmony_ci this.buttonItemProperty[index].fontWeight = 263623b3eb3cSopenharmony_ci selected ? this.options.selectedFontWeight ?? FontWeight.Medium : 263723b3eb3cSopenharmony_ci this.options.fontWeight ?? FontWeight.Regular; 263823b3eb3cSopenharmony_ci this.buttonItemProperty[index].isSelected = selected; 263923b3eb3cSopenharmony_ci }); 264023b3eb3cSopenharmony_ci } 264123b3eb3cSopenharmony_ci 264223b3eb3cSopenharmony_ci rerender() { 264323b3eb3cSopenharmony_ci this.updateDirtyElements(); 264423b3eb3cSopenharmony_ci } 264523b3eb3cSopenharmony_ci} 264623b3eb3cSopenharmony_ci 264723b3eb3cSopenharmony_ciexport default { 264823b3eb3cSopenharmony_ci SegmentButton, 264923b3eb3cSopenharmony_ci SegmentButtonOptions, 265023b3eb3cSopenharmony_ci SegmentButtonItemOptionsArray, 265123b3eb3cSopenharmony_ci SegmentButtonItemOptions, 265223b3eb3cSopenharmony_ci}; 2653