123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the 'License'); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an 'AS IS' BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ciif (!('finalizeConstruction' in ViewPU.prototype)) { 1723b3eb3cSopenharmony_ci Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 1823b3eb3cSopenharmony_ci} 1923b3eb3cSopenharmony_ciconst hilog = requireNapi('hilog'); 2023b3eb3cSopenharmony_ciconst KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 2123b3eb3cSopenharmony_ciconst resourceManager = requireNapi('resourceManager'); 2223b3eb3cSopenharmony_ciconst LengthMetrics = requireNapi('arkui.node').LengthMetrics; 2323b3eb3cSopenharmony_ciexport var EditableLeftIconType; 2423b3eb3cSopenharmony_ci(function (x10) { 2523b3eb3cSopenharmony_ci x10[x10['Back'] = 0] = 'Back'; 2623b3eb3cSopenharmony_ci x10[x10['Cancel'] = 1] = 'Cancel'; 2723b3eb3cSopenharmony_ci})(EditableLeftIconType || (EditableLeftIconType = {})); 2823b3eb3cSopenharmony_civar ItemType; 2923b3eb3cSopenharmony_ci(function (w10) { 3023b3eb3cSopenharmony_ci w10[w10['Image'] = 0] = 'Image'; 3123b3eb3cSopenharmony_ci w10[w10['Icon'] = 1] = 'Icon'; 3223b3eb3cSopenharmony_ci w10[w10['LeftIcon'] = 2] = 'LeftIcon'; 3323b3eb3cSopenharmony_ci})(ItemType || (ItemType = {})); 3423b3eb3cSopenharmony_ciconst PUBLIC_CANCEL = { 'id': -1, 'type': 40000, params: ['sys.symbol.xmark'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 3523b3eb3cSopenharmony_ciconst PUBLIC_OK = { 'id': -1, 'type': 40000, params: ['sys.symbol.checkmark'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 3623b3eb3cSopenharmony_ciconst PUBLIC_BACK = { 'id': -1, 'type': 40000, params: ['sys.symbol.chevron_backward'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 3723b3eb3cSopenharmony_ciconst DEFAULT_TITLE_BAR_HEIGHT = 56; 3823b3eb3cSopenharmony_ciconst DEFAULT_TITLE_PADDING = 2; 3923b3eb3cSopenharmony_ciconst MAX_LINE_ONE = 1; 4023b3eb3cSopenharmony_ciconst MAX_LINES_TWO = 2; 4123b3eb3cSopenharmony_ciconst MAX_MAIN_TITLE_PERCENT = 0.65; 4223b3eb3cSopenharmony_ciconst MAX_SUB_TITLE_PERCENT = 0.35; 4323b3eb3cSopenharmony_ciconst MIN_SUBTITLE_SIZE = '10.0vp'; 4423b3eb3cSopenharmony_ciconst TEXT_EDITABLE_DIALOG = '18.3fp'; 4523b3eb3cSopenharmony_ciconst IMAGE_SIZE = '64vp'; 4623b3eb3cSopenharmony_ciconst MAX_DIALOG = '256vp'; 4723b3eb3cSopenharmony_ciconst MIN_DIALOG = '216vp'; 4823b3eb3cSopenharmony_ciconst SYMBOL_SIZE = '24vp'; 4923b3eb3cSopenharmony_ciconst SYMBOL_TITLE_SIZE = '64vp'; 5023b3eb3cSopenharmony_ciconst TITLE_VP = 20; 5123b3eb3cSopenharmony_ciconst SUBTITLE_VP = 14; 5223b3eb3cSopenharmony_ciconst TITLE_F = getNumberByResource(125831095, TITLE_VP); 5323b3eb3cSopenharmony_ciconst SUBTITLE_F = getNumberByResource(125831097, SUBTITLE_VP); 5423b3eb3cSopenharmony_ciconst TITLE_F_VP = (TITLE_F > 0 ? TITLE_F : TITLE_VP) + 'vp'; 5523b3eb3cSopenharmony_ciconst SUBTITLE_F_VP = (SUBTITLE_F > 0 ? SUBTITLE_F : SUBTITLE_VP) + 'vp'; 5623b3eb3cSopenharmony_ciclass EditableTitleBarTheme { 5723b3eb3cSopenharmony_ci constructor() { 5823b3eb3cSopenharmony_ci this.iconColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 5923b3eb3cSopenharmony_ci this.iconBackgroundColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6023b3eb3cSopenharmony_ci this.iconBackgroundPressedColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_pressed_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6123b3eb3cSopenharmony_ci this.iconBackgroundHoverColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_hover_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6223b3eb3cSopenharmony_ci this.iconBackgroundFocusOutlineColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_focus_outline_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6323b3eb3cSopenharmony_ci this.titleColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_title_tertiary_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6423b3eb3cSopenharmony_ci this.subTitleColor = { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_subheader_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 6523b3eb3cSopenharmony_ci } 6623b3eb3cSopenharmony_ci} 6723b3eb3cSopenharmony_ciclass ButtonGestureModifier { 6823b3eb3cSopenharmony_ci constructor(v10) { 6923b3eb3cSopenharmony_ci this.fontSize = 1; 7023b3eb3cSopenharmony_ci this.controller = null; 7123b3eb3cSopenharmony_ci this.controller = v10; 7223b3eb3cSopenharmony_ci } 7323b3eb3cSopenharmony_ci applyGesture(s10) { 7423b3eb3cSopenharmony_ci if (this.fontSize >= ButtonGestureModifier.minFontSize) { 7523b3eb3cSopenharmony_ci s10.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime }) 7623b3eb3cSopenharmony_ci .onAction(() => { 7723b3eb3cSopenharmony_ci if (s10) { 7823b3eb3cSopenharmony_ci this.controller?.open(); 7923b3eb3cSopenharmony_ci } 8023b3eb3cSopenharmony_ci }) 8123b3eb3cSopenharmony_ci .onActionEnd(() => { 8223b3eb3cSopenharmony_ci this.controller?.close(); 8323b3eb3cSopenharmony_ci })); 8423b3eb3cSopenharmony_ci } 8523b3eb3cSopenharmony_ci else { 8623b3eb3cSopenharmony_ci s10.clearGestures(); 8723b3eb3cSopenharmony_ci } 8823b3eb3cSopenharmony_ci } 8923b3eb3cSopenharmony_ci} 9023b3eb3cSopenharmony_ciButtonGestureModifier.longPressTime = 500; 9123b3eb3cSopenharmony_ciButtonGestureModifier.minFontSize = 1.75; 9223b3eb3cSopenharmony_ciexport class EditableTitleBar extends ViewPU { 9323b3eb3cSopenharmony_ci constructor(m10, n10, o10, p10 = -1, q10 = undefined, r10) { 9423b3eb3cSopenharmony_ci super(m10, o10, p10, r10); 9523b3eb3cSopenharmony_ci if (typeof q10 === 'function') { 9623b3eb3cSopenharmony_ci this.paramsGenerator_ = q10; 9723b3eb3cSopenharmony_ci } 9823b3eb3cSopenharmony_ci this.leftIconStyle = EditableLeftIconType.Back; 9923b3eb3cSopenharmony_ci this.title = ''; 10023b3eb3cSopenharmony_ci this.subtitle = ''; 10123b3eb3cSopenharmony_ci this.isSaveIconRequired = true; 10223b3eb3cSopenharmony_ci this.imageItem = undefined; 10323b3eb3cSopenharmony_ci this.menuItems = undefined; 10423b3eb3cSopenharmony_ci this.options = { 10523b3eb3cSopenharmony_ci safeAreaTypes: [SafeAreaType.SYSTEM], 10623b3eb3cSopenharmony_ci safeAreaEdges: [SafeAreaEdge.TOP], 10723b3eb3cSopenharmony_ci }; 10823b3eb3cSopenharmony_ci this.onSave = undefined; 10923b3eb3cSopenharmony_ci this.onCancel = undefined; 11023b3eb3cSopenharmony_ci this.constraintWidth = 0; 11123b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = false; 11223b3eb3cSopenharmony_ci this.maxFontScale = 1; 11323b3eb3cSopenharmony_ci this.systemFontScale = 1; 11423b3eb3cSopenharmony_ci this.__editableTitleBarTheme = new ObservedPropertyObjectPU(new EditableTitleBarTheme(), this, 'editableTitleBarTheme'); 11523b3eb3cSopenharmony_ci this.addProvidedVar('editableTitleBarTheme', this.__editableTitleBarTheme, false); 11623b3eb3cSopenharmony_ci this.__contentMargin = new SynchedPropertyObjectOneWayPU(n10.contentMargin, this, 'contentMargin'); 11723b3eb3cSopenharmony_ci this.__titleBarMargin = new ObservedPropertyObjectPU({ 11823b3eb3cSopenharmony_ci start: LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.margin_left'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }), 11923b3eb3cSopenharmony_ci end: LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.margin_right'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }), 12023b3eb3cSopenharmony_ci }, this, 'titleBarMargin'); 12123b3eb3cSopenharmony_ci this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 12223b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(n10); 12323b3eb3cSopenharmony_ci this.finalizeConstruction(); 12423b3eb3cSopenharmony_ci } 12523b3eb3cSopenharmony_ci setInitiallyProvidedValue(l10) { 12623b3eb3cSopenharmony_ci if (l10.leftIconStyle !== undefined) { 12723b3eb3cSopenharmony_ci this.leftIconStyle = l10.leftIconStyle; 12823b3eb3cSopenharmony_ci } 12923b3eb3cSopenharmony_ci if (l10.title !== undefined) { 13023b3eb3cSopenharmony_ci this.title = l10.title; 13123b3eb3cSopenharmony_ci } 13223b3eb3cSopenharmony_ci if (l10.subtitle !== undefined) { 13323b3eb3cSopenharmony_ci this.subtitle = l10.subtitle; 13423b3eb3cSopenharmony_ci } 13523b3eb3cSopenharmony_ci if (l10.isSaveIconRequired !== undefined) { 13623b3eb3cSopenharmony_ci this.isSaveIconRequired = l10.isSaveIconRequired; 13723b3eb3cSopenharmony_ci } 13823b3eb3cSopenharmony_ci if (l10.imageItem !== undefined) { 13923b3eb3cSopenharmony_ci this.imageItem = l10.imageItem; 14023b3eb3cSopenharmony_ci } 14123b3eb3cSopenharmony_ci if (l10.menuItems !== undefined) { 14223b3eb3cSopenharmony_ci this.menuItems = l10.menuItems; 14323b3eb3cSopenharmony_ci } 14423b3eb3cSopenharmony_ci if (l10.options !== undefined) { 14523b3eb3cSopenharmony_ci this.options = l10.options; 14623b3eb3cSopenharmony_ci } 14723b3eb3cSopenharmony_ci if (l10.onSave !== undefined) { 14823b3eb3cSopenharmony_ci this.onSave = l10.onSave; 14923b3eb3cSopenharmony_ci } 15023b3eb3cSopenharmony_ci if (l10.onCancel !== undefined) { 15123b3eb3cSopenharmony_ci this.onCancel = l10.onCancel; 15223b3eb3cSopenharmony_ci } 15323b3eb3cSopenharmony_ci if (l10.constraintWidth !== undefined) { 15423b3eb3cSopenharmony_ci this.constraintWidth = l10.constraintWidth; 15523b3eb3cSopenharmony_ci } 15623b3eb3cSopenharmony_ci if (l10.isFollowingSystemFontScale !== undefined) { 15723b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = l10.isFollowingSystemFontScale; 15823b3eb3cSopenharmony_ci } 15923b3eb3cSopenharmony_ci if (l10.maxFontScale !== undefined) { 16023b3eb3cSopenharmony_ci this.maxFontScale = l10.maxFontScale; 16123b3eb3cSopenharmony_ci } 16223b3eb3cSopenharmony_ci if (l10.systemFontScale !== undefined) { 16323b3eb3cSopenharmony_ci this.systemFontScale = l10.systemFontScale; 16423b3eb3cSopenharmony_ci } 16523b3eb3cSopenharmony_ci if (l10.editableTitleBarTheme !== undefined) { 16623b3eb3cSopenharmony_ci this.editableTitleBarTheme = l10.editableTitleBarTheme; 16723b3eb3cSopenharmony_ci } 16823b3eb3cSopenharmony_ci if (l10.titleBarMargin !== undefined) { 16923b3eb3cSopenharmony_ci this.titleBarMargin = l10.titleBarMargin; 17023b3eb3cSopenharmony_ci } 17123b3eb3cSopenharmony_ci if (l10.fontSize !== undefined) { 17223b3eb3cSopenharmony_ci this.fontSize = l10.fontSize; 17323b3eb3cSopenharmony_ci } 17423b3eb3cSopenharmony_ci } 17523b3eb3cSopenharmony_ci updateStateVars(k10) { 17623b3eb3cSopenharmony_ci this.__contentMargin.reset(k10.contentMargin); 17723b3eb3cSopenharmony_ci } 17823b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(j10) { 17923b3eb3cSopenharmony_ci this.__editableTitleBarTheme.purgeDependencyOnElmtId(j10); 18023b3eb3cSopenharmony_ci this.__contentMargin.purgeDependencyOnElmtId(j10); 18123b3eb3cSopenharmony_ci this.__titleBarMargin.purgeDependencyOnElmtId(j10); 18223b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(j10); 18323b3eb3cSopenharmony_ci } 18423b3eb3cSopenharmony_ci aboutToBeDeleted() { 18523b3eb3cSopenharmony_ci this.__editableTitleBarTheme.aboutToBeDeleted(); 18623b3eb3cSopenharmony_ci this.__contentMargin.aboutToBeDeleted(); 18723b3eb3cSopenharmony_ci this.__titleBarMargin.aboutToBeDeleted(); 18823b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 18923b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 19023b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 19123b3eb3cSopenharmony_ci } 19223b3eb3cSopenharmony_ci get editableTitleBarTheme() { 19323b3eb3cSopenharmony_ci return this.__editableTitleBarTheme.get(); 19423b3eb3cSopenharmony_ci } 19523b3eb3cSopenharmony_ci set editableTitleBarTheme(i10) { 19623b3eb3cSopenharmony_ci this.__editableTitleBarTheme.set(i10); 19723b3eb3cSopenharmony_ci } 19823b3eb3cSopenharmony_ci get contentMargin() { 19923b3eb3cSopenharmony_ci return this.__contentMargin.get(); 20023b3eb3cSopenharmony_ci } 20123b3eb3cSopenharmony_ci set contentMargin(h10) { 20223b3eb3cSopenharmony_ci this.__contentMargin.set(h10); 20323b3eb3cSopenharmony_ci } 20423b3eb3cSopenharmony_ci get titleBarMargin() { 20523b3eb3cSopenharmony_ci return this.__titleBarMargin.get(); 20623b3eb3cSopenharmony_ci } 20723b3eb3cSopenharmony_ci set titleBarMargin(g10) { 20823b3eb3cSopenharmony_ci this.__titleBarMargin.set(g10); 20923b3eb3cSopenharmony_ci } 21023b3eb3cSopenharmony_ci get fontSize() { 21123b3eb3cSopenharmony_ci return this.__fontSize.get(); 21223b3eb3cSopenharmony_ci } 21323b3eb3cSopenharmony_ci set fontSize(e10) { 21423b3eb3cSopenharmony_ci this.__fontSize.set(e10); 21523b3eb3cSopenharmony_ci } 21623b3eb3cSopenharmony_ci onWillApplyTheme(d10) { 21723b3eb3cSopenharmony_ci this.editableTitleBarTheme.iconColor = d10.colors.iconPrimary; 21823b3eb3cSopenharmony_ci this.editableTitleBarTheme.titleColor = d10.colors.fontPrimary; 21923b3eb3cSopenharmony_ci this.editableTitleBarTheme.subTitleColor = d10.colors.fontSecondary; 22023b3eb3cSopenharmony_ci this.editableTitleBarTheme.iconBackgroundPressedColor = d10.colors.interactivePressed; 22123b3eb3cSopenharmony_ci this.editableTitleBarTheme.iconBackgroundHoverColor = d10.colors.interactiveHover; 22223b3eb3cSopenharmony_ci this.editableTitleBarTheme.iconBackgroundFocusOutlineColor = d10.colors.interactiveFocus; 22323b3eb3cSopenharmony_ci } 22423b3eb3cSopenharmony_ci aboutToAppear() { 22523b3eb3cSopenharmony_ci try { 22623b3eb3cSopenharmony_ci let c10 = this.getUIContext(); 22723b3eb3cSopenharmony_ci this.isFollowingSystemFontScale = c10.isFollowingSystemFontScale(); 22823b3eb3cSopenharmony_ci this.maxFontScale = c10.getMaxFontScale(); 22923b3eb3cSopenharmony_ci } 23023b3eb3cSopenharmony_ci catch (z9) { 23123b3eb3cSopenharmony_ci let a10 = z9.code; 23223b3eb3cSopenharmony_ci let b10 = z9.message; 23323b3eb3cSopenharmony_ci hilog.error(0x3900, 'Ace', `Faild to init fontsizescale info,cause, code: ${a10}, message: ${b10}`); 23423b3eb3cSopenharmony_ci } 23523b3eb3cSopenharmony_ci } 23623b3eb3cSopenharmony_ci decideFontScale() { 23723b3eb3cSopenharmony_ci let y9 = this.getUIContext(); 23823b3eb3cSopenharmony_ci this.systemFontScale = y9.getHostContext()?.config?.fontSizeScale ?? 1; 23923b3eb3cSopenharmony_ci if (!this.isFollowingSystemFontScale) { 24023b3eb3cSopenharmony_ci return 1; 24123b3eb3cSopenharmony_ci } 24223b3eb3cSopenharmony_ci return Math.min(this.systemFontScale, this.maxFontScale); 24323b3eb3cSopenharmony_ci } 24423b3eb3cSopenharmony_ci initialRender() { 24523b3eb3cSopenharmony_ci this.observeComponentCreation2((w9, x9) => { 24623b3eb3cSopenharmony_ci Flex.create({ 24723b3eb3cSopenharmony_ci justifyContent: FlexAlign.SpaceBetween, 24823b3eb3cSopenharmony_ci alignItems: ItemAlign.Stretch, 24923b3eb3cSopenharmony_ci }); 25023b3eb3cSopenharmony_ci Flex.backgroundColor(this.options.backgroundColor ?? EditableTitleBar.noneColor); 25123b3eb3cSopenharmony_ci Flex.backgroundBlurStyle(this.options.backgroundBlurStyle ?? BlurStyle.NONE); 25223b3eb3cSopenharmony_ci Flex.expandSafeArea(this.options.safeAreaTypes, this.options.safeAreaEdges); 25323b3eb3cSopenharmony_ci }, Flex); 25423b3eb3cSopenharmony_ci this.observeComponentCreation2((u9, v9) => { 25523b3eb3cSopenharmony_ci Row.create(); 25623b3eb3cSopenharmony_ci Row.width('100%'); 25723b3eb3cSopenharmony_ci Row.margin(this.contentMargin ?? this.titleBarMargin); 25823b3eb3cSopenharmony_ci Row.height(EditableTitleBar.totalHeight); 25923b3eb3cSopenharmony_ci }, Row); 26023b3eb3cSopenharmony_ci this.observeComponentCreation2((s9, t9) => { 26123b3eb3cSopenharmony_ci Row.create(); 26223b3eb3cSopenharmony_ci Row.flexShrink(0); 26323b3eb3cSopenharmony_ci }, Row); 26423b3eb3cSopenharmony_ci this.leftIconLayout.bind(this)(this); 26523b3eb3cSopenharmony_ci Row.pop(); 26623b3eb3cSopenharmony_ci this.observeComponentCreation2((l9, m9) => { 26723b3eb3cSopenharmony_ci If.create(); 26823b3eb3cSopenharmony_ci if (this.imageItem) { 26923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 27023b3eb3cSopenharmony_ci this.observeComponentCreation2((q9, r9) => { 27123b3eb3cSopenharmony_ci Row.create(); 27223b3eb3cSopenharmony_ci Row.flexShrink(0); 27323b3eb3cSopenharmony_ci }, Row); 27423b3eb3cSopenharmony_ci this.imageItemLayout.bind(this)(this); 27523b3eb3cSopenharmony_ci Row.pop(); 27623b3eb3cSopenharmony_ci }); 27723b3eb3cSopenharmony_ci } 27823b3eb3cSopenharmony_ci else { 27923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 28023b3eb3cSopenharmony_ci }); 28123b3eb3cSopenharmony_ci } 28223b3eb3cSopenharmony_ci }, If); 28323b3eb3cSopenharmony_ci If.pop(); 28423b3eb3cSopenharmony_ci this.observeComponentCreation2((j9, k9) => { 28523b3eb3cSopenharmony_ci Row.create(); 28623b3eb3cSopenharmony_ci Row.width('100%'); 28723b3eb3cSopenharmony_ci Row.flexShrink(1); 28823b3eb3cSopenharmony_ci }, Row); 28923b3eb3cSopenharmony_ci this.titleLayout.bind(this)(this); 29023b3eb3cSopenharmony_ci Row.pop(); 29123b3eb3cSopenharmony_ci this.observeComponentCreation2((h9, i9) => { 29223b3eb3cSopenharmony_ci Row.create(); 29323b3eb3cSopenharmony_ci Row.flexShrink(0); 29423b3eb3cSopenharmony_ci }, Row); 29523b3eb3cSopenharmony_ci this.rightMenuItemsLayout.bind(this)(this); 29623b3eb3cSopenharmony_ci Row.pop(); 29723b3eb3cSopenharmony_ci Row.pop(); 29823b3eb3cSopenharmony_ci Flex.pop(); 29923b3eb3cSopenharmony_ci } 30023b3eb3cSopenharmony_ci imageItemLayout(t8 = null) { 30123b3eb3cSopenharmony_ci { 30223b3eb3cSopenharmony_ci this.observeComponentCreation2((v8, w8) => { 30323b3eb3cSopenharmony_ci if (w8) { 30423b3eb3cSopenharmony_ci let x8 = new ImageMenuItem(ViewPU.__proto__ !== NativeViewPartialUpdate && t8 instanceof PUV2ViewBase ? t8 : this, { 30523b3eb3cSopenharmony_ci item: this.imageItem, 30623b3eb3cSopenharmony_ci attribute: ItemType.Image, 30723b3eb3cSopenharmony_ci }, undefined, v8, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 241, col: 5 }); 30823b3eb3cSopenharmony_ci ViewPU.create(x8); 30923b3eb3cSopenharmony_ci let d7 = () => { 31023b3eb3cSopenharmony_ci return { 31123b3eb3cSopenharmony_ci item: this.imageItem, 31223b3eb3cSopenharmony_ci attribute: ItemType.Image 31323b3eb3cSopenharmony_ci }; 31423b3eb3cSopenharmony_ci }; 31523b3eb3cSopenharmony_ci x8.paramsGenerator_ = d7; 31623b3eb3cSopenharmony_ci } 31723b3eb3cSopenharmony_ci else { 31823b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(v8, {}); 31923b3eb3cSopenharmony_ci } 32023b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 32123b3eb3cSopenharmony_ci } 32223b3eb3cSopenharmony_ci } 32323b3eb3cSopenharmony_ci leftIconLayout(w7 = null) { 32423b3eb3cSopenharmony_ci this.observeComponentCreation2((y7, z7) => { 32523b3eb3cSopenharmony_ci If.create(); 32623b3eb3cSopenharmony_ci if (this.leftIconStyle === EditableLeftIconType.Back) { 32723b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 32823b3eb3cSopenharmony_ci { 32923b3eb3cSopenharmony_ci this.observeComponentCreation2((l8, m8) => { 33023b3eb3cSopenharmony_ci if (m8) { 33123b3eb3cSopenharmony_ci let n8 = new ImageMenuItem(ViewPU.__proto__ !== NativeViewPartialUpdate && w7 instanceof PUV2ViewBase ? w7 : this, { 33223b3eb3cSopenharmony_ci item: { 33323b3eb3cSopenharmony_ci value: PUBLIC_BACK, 33423b3eb3cSopenharmony_ci isEnabled: true, 33523b3eb3cSopenharmony_ci action: () => this.onCancel ? this.onCancel() : this.getUIContext()?.getRouter()?.back() 33623b3eb3cSopenharmony_ci }, 33723b3eb3cSopenharmony_ci fontSize: this.fontSize, 33823b3eb3cSopenharmony_ci attribute: ItemType.LeftIcon, 33923b3eb3cSopenharmony_ci useSymbol: true, 34023b3eb3cSopenharmony_ci }, undefined, l8, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 253, col: 7 }); 34123b3eb3cSopenharmony_ci ViewPU.create(n8); 34223b3eb3cSopenharmony_ci let c7 = () => { 34323b3eb3cSopenharmony_ci return { 34423b3eb3cSopenharmony_ci item: { 34523b3eb3cSopenharmony_ci value: PUBLIC_BACK, 34623b3eb3cSopenharmony_ci isEnabled: true, 34723b3eb3cSopenharmony_ci action: () => this.onCancel ? this.onCancel() : this.getUIContext()?.getRouter()?.back() 34823b3eb3cSopenharmony_ci }, 34923b3eb3cSopenharmony_ci fontSize: this.fontSize, 35023b3eb3cSopenharmony_ci attribute: ItemType.LeftIcon, 35123b3eb3cSopenharmony_ci useSymbol: true 35223b3eb3cSopenharmony_ci }; 35323b3eb3cSopenharmony_ci }; 35423b3eb3cSopenharmony_ci n8.paramsGenerator_ = c7; 35523b3eb3cSopenharmony_ci } 35623b3eb3cSopenharmony_ci else { 35723b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(l8, { 35823b3eb3cSopenharmony_ci fontSize: this.fontSize 35923b3eb3cSopenharmony_ci }); 36023b3eb3cSopenharmony_ci } 36123b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 36223b3eb3cSopenharmony_ci } 36323b3eb3cSopenharmony_ci }); 36423b3eb3cSopenharmony_ci } 36523b3eb3cSopenharmony_ci else { 36623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 36723b3eb3cSopenharmony_ci { 36823b3eb3cSopenharmony_ci this.observeComponentCreation2((c8, d8) => { 36923b3eb3cSopenharmony_ci if (d8) { 37023b3eb3cSopenharmony_ci let e8 = new ImageMenuItem(ViewPU.__proto__ !== NativeViewPartialUpdate && w7 instanceof PUV2ViewBase ? w7 : this, { 37123b3eb3cSopenharmony_ci item: { 37223b3eb3cSopenharmony_ci value: PUBLIC_CANCEL, 37323b3eb3cSopenharmony_ci isEnabled: true, 37423b3eb3cSopenharmony_ci action: () => this.onCancel && this.onCancel(), 37523b3eb3cSopenharmony_ci }, 37623b3eb3cSopenharmony_ci fontSize: this.fontSize, 37723b3eb3cSopenharmony_ci attribute: ItemType.LeftIcon, 37823b3eb3cSopenharmony_ci useSymbol: true, 37923b3eb3cSopenharmony_ci }, undefined, c8, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 264, col: 7 }); 38023b3eb3cSopenharmony_ci ViewPU.create(e8); 38123b3eb3cSopenharmony_ci let z6 = () => { 38223b3eb3cSopenharmony_ci return { 38323b3eb3cSopenharmony_ci item: { 38423b3eb3cSopenharmony_ci value: PUBLIC_CANCEL, 38523b3eb3cSopenharmony_ci isEnabled: true, 38623b3eb3cSopenharmony_ci action: () => this.onCancel && this.onCancel(), 38723b3eb3cSopenharmony_ci }, 38823b3eb3cSopenharmony_ci fontSize: this.fontSize, 38923b3eb3cSopenharmony_ci attribute: ItemType.LeftIcon, 39023b3eb3cSopenharmony_ci useSymbol: true 39123b3eb3cSopenharmony_ci }; 39223b3eb3cSopenharmony_ci }; 39323b3eb3cSopenharmony_ci e8.paramsGenerator_ = z6; 39423b3eb3cSopenharmony_ci } 39523b3eb3cSopenharmony_ci else { 39623b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(c8, { 39723b3eb3cSopenharmony_ci fontSize: this.fontSize 39823b3eb3cSopenharmony_ci }); 39923b3eb3cSopenharmony_ci } 40023b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 40123b3eb3cSopenharmony_ci } 40223b3eb3cSopenharmony_ci }); 40323b3eb3cSopenharmony_ci } 40423b3eb3cSopenharmony_ci }, If); 40523b3eb3cSopenharmony_ci If.pop(); 40623b3eb3cSopenharmony_ci } 40723b3eb3cSopenharmony_ci titleLayout(b7 = null) { 40823b3eb3cSopenharmony_ci this.observeComponentCreation2((u7, v7) => { 40923b3eb3cSopenharmony_ci Column.create(); 41023b3eb3cSopenharmony_ci Column.height(EditableTitleBar.totalHeight); 41123b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 41223b3eb3cSopenharmony_ci Column.margin({ 41323b3eb3cSopenharmony_ci start: LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_space_horizontal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }), 41423b3eb3cSopenharmony_ci }); 41523b3eb3cSopenharmony_ci Column.alignItems(HorizontalAlign.Start); 41623b3eb3cSopenharmony_ci }, Column); 41723b3eb3cSopenharmony_ci this.observeComponentCreation2((s7, t7) => { 41823b3eb3cSopenharmony_ci Row.create(); 41923b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Start); 42023b3eb3cSopenharmony_ci }, Row); 42123b3eb3cSopenharmony_ci this.observeComponentCreation2((q7, r7) => { 42223b3eb3cSopenharmony_ci Text.create(this.title); 42323b3eb3cSopenharmony_ci Text.maxFontSize(TITLE_F_VP); 42423b3eb3cSopenharmony_ci Text.minFontSize(SUBTITLE_F_VP); 42523b3eb3cSopenharmony_ci Text.fontColor(this.editableTitleBarTheme.titleColor); 42623b3eb3cSopenharmony_ci Text.maxLines(this.subtitle ? MAX_LINE_ONE : MAX_LINES_TWO); 42723b3eb3cSopenharmony_ci Text.fontWeight(FontWeight.Bold); 42823b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Start); 42923b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 43023b3eb3cSopenharmony_ci Text.heightAdaptivePolicy(this.subtitle ? 43123b3eb3cSopenharmony_ci TextHeightAdaptivePolicy.MAX_LINES_FIRST : TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST); 43223b3eb3cSopenharmony_ci Text.constraintSize({ 43323b3eb3cSopenharmony_ci maxHeight: this.subtitle ? EditableTitleBar.maxMainTitleHeight : EditableTitleBar.totalHeight, 43423b3eb3cSopenharmony_ci }); 43523b3eb3cSopenharmony_ci }, Text); 43623b3eb3cSopenharmony_ci Text.pop(); 43723b3eb3cSopenharmony_ci Row.pop(); 43823b3eb3cSopenharmony_ci this.observeComponentCreation2((g7, h7) => { 43923b3eb3cSopenharmony_ci If.create(); 44023b3eb3cSopenharmony_ci if (this.subtitle) { 44123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 44223b3eb3cSopenharmony_ci this.observeComponentCreation2((o7, p7) => { 44323b3eb3cSopenharmony_ci Row.create(); 44423b3eb3cSopenharmony_ci Row.margin({ 44523b3eb3cSopenharmony_ci top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level1'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 44623b3eb3cSopenharmony_ci }); 44723b3eb3cSopenharmony_ci Row.justifyContent(FlexAlign.Start); 44823b3eb3cSopenharmony_ci }, Row); 44923b3eb3cSopenharmony_ci this.observeComponentCreation2((m7, n7) => { 45023b3eb3cSopenharmony_ci Text.create(this.subtitle); 45123b3eb3cSopenharmony_ci Text.maxFontSize(SUBTITLE_F_VP); 45223b3eb3cSopenharmony_ci Text.minFontSize(MIN_SUBTITLE_SIZE); 45323b3eb3cSopenharmony_ci Text.fontColor(this.editableTitleBarTheme.subTitleColor); 45423b3eb3cSopenharmony_ci Text.maxLines(MAX_LINE_ONE); 45523b3eb3cSopenharmony_ci Text.fontWeight(FontWeight.Regular); 45623b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Start); 45723b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 45823b3eb3cSopenharmony_ci Text.heightAdaptivePolicy(TextHeightAdaptivePolicy.MAX_LINES_FIRST); 45923b3eb3cSopenharmony_ci Text.constraintSize({ 46023b3eb3cSopenharmony_ci maxHeight: this.title ? EditableTitleBar.maxSubTitleHeight : EditableTitleBar.totalHeight, 46123b3eb3cSopenharmony_ci }); 46223b3eb3cSopenharmony_ci }, Text); 46323b3eb3cSopenharmony_ci Text.pop(); 46423b3eb3cSopenharmony_ci Row.pop(); 46523b3eb3cSopenharmony_ci }); 46623b3eb3cSopenharmony_ci } 46723b3eb3cSopenharmony_ci else { 46823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 46923b3eb3cSopenharmony_ci }); 47023b3eb3cSopenharmony_ci } 47123b3eb3cSopenharmony_ci }, If); 47223b3eb3cSopenharmony_ci If.pop(); 47323b3eb3cSopenharmony_ci Column.pop(); 47423b3eb3cSopenharmony_ci } 47523b3eb3cSopenharmony_ci rightMenuItemsLayout(t6 = null) { 47623b3eb3cSopenharmony_ci { 47723b3eb3cSopenharmony_ci this.observeComponentCreation2((v6, w6) => { 47823b3eb3cSopenharmony_ci if (w6) { 47923b3eb3cSopenharmony_ci let x6 = new EditableTitleBarMenuSection(ViewPU.__proto__ !== NativeViewPartialUpdate && t6 instanceof PUV2ViewBase ? t6 : this, { 48023b3eb3cSopenharmony_ci menuItems: this.menuItems, 48123b3eb3cSopenharmony_ci onSave: this.onSave, 48223b3eb3cSopenharmony_ci isSaveEnabled: this.isSaveIconRequired, 48323b3eb3cSopenharmony_ci fontSize: this.fontSize, 48423b3eb3cSopenharmony_ci }, undefined, v6, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 329, col: 5 }); 48523b3eb3cSopenharmony_ci ViewPU.create(x6); 48623b3eb3cSopenharmony_ci let y6 = () => { 48723b3eb3cSopenharmony_ci return { 48823b3eb3cSopenharmony_ci menuItems: this.menuItems, 48923b3eb3cSopenharmony_ci onSave: this.onSave, 49023b3eb3cSopenharmony_ci isSaveEnabled: this.isSaveIconRequired, 49123b3eb3cSopenharmony_ci fontSize: this.fontSize 49223b3eb3cSopenharmony_ci }; 49323b3eb3cSopenharmony_ci }; 49423b3eb3cSopenharmony_ci x6.paramsGenerator_ = y6; 49523b3eb3cSopenharmony_ci } 49623b3eb3cSopenharmony_ci else { 49723b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(v6, { 49823b3eb3cSopenharmony_ci fontSize: this.fontSize 49923b3eb3cSopenharmony_ci }); 50023b3eb3cSopenharmony_ci } 50123b3eb3cSopenharmony_ci }, { name: 'EditableTitleBarMenuSection' }); 50223b3eb3cSopenharmony_ci } 50323b3eb3cSopenharmony_ci } 50423b3eb3cSopenharmony_ci onPlaceChildren(o6, p6, q6) { 50523b3eb3cSopenharmony_ci p6.forEach((s6) => { 50623b3eb3cSopenharmony_ci s6.layout({ x: 0, y: 0 }); 50723b3eb3cSopenharmony_ci }); 50823b3eb3cSopenharmony_ci } 50923b3eb3cSopenharmony_ci onMeasureSize(i6, j6, k6) { 51023b3eb3cSopenharmony_ci let l6 = { width: i6.width, height: i6.height }; 51123b3eb3cSopenharmony_ci this.fontSize = this.decideFontScale(); 51223b3eb3cSopenharmony_ci j6.forEach((n6) => { 51323b3eb3cSopenharmony_ci l6.height = n6.measure(k6).height; 51423b3eb3cSopenharmony_ci l6.width = Number(k6.maxWidth); 51523b3eb3cSopenharmony_ci }); 51623b3eb3cSopenharmony_ci return l6; 51723b3eb3cSopenharmony_ci } 51823b3eb3cSopenharmony_ci rerender() { 51923b3eb3cSopenharmony_ci this.updateDirtyElements(); 52023b3eb3cSopenharmony_ci } 52123b3eb3cSopenharmony_ci} 52223b3eb3cSopenharmony_ciEditableTitleBar.maxCountOfExtraItems = 3; 52323b3eb3cSopenharmony_ciEditableTitleBar.maxOtherCountOfExtraItems = 2; 52423b3eb3cSopenharmony_ciEditableTitleBar.commonZero = 0; 52523b3eb3cSopenharmony_ciEditableTitleBar.noneColor = '#00000000'; 52623b3eb3cSopenharmony_ciEditableTitleBar.defaultHeight = getNumberByResource(125831115, DEFAULT_TITLE_BAR_HEIGHT); 52723b3eb3cSopenharmony_ciEditableTitleBar.defaultTitlePadding = getNumberByResource(125830920, DEFAULT_TITLE_PADDING); 52823b3eb3cSopenharmony_ciEditableTitleBar.totalHeight = EditableTitleBar.defaultHeight === EditableTitleBar.commonZero ? DEFAULT_TITLE_BAR_HEIGHT : 52923b3eb3cSopenharmony_ci EditableTitleBar.defaultHeight; 53023b3eb3cSopenharmony_ciEditableTitleBar.titlePadding = EditableTitleBar.defaultTitlePadding === EditableTitleBar.commonZero ? 53123b3eb3cSopenharmony_ci DEFAULT_TITLE_PADDING : EditableTitleBar.defaultTitlePadding; 53223b3eb3cSopenharmony_ciEditableTitleBar.maxMainTitleHeight = (EditableTitleBar.totalHeight - EditableTitleBar.titlePadding) * MAX_MAIN_TITLE_PERCENT; 53323b3eb3cSopenharmony_ciEditableTitleBar.maxSubTitleHeight = (EditableTitleBar.totalHeight - EditableTitleBar.titlePadding) * MAX_SUB_TITLE_PERCENT; 53423b3eb3cSopenharmony_ciclass EditableTitleBarMenuSection extends ViewPU { 53523b3eb3cSopenharmony_ci constructor(c6, d6, e6, f6 = -1, g6 = undefined, h6) { 53623b3eb3cSopenharmony_ci super(c6, e6, f6, h6); 53723b3eb3cSopenharmony_ci if (typeof g6 === 'function') { 53823b3eb3cSopenharmony_ci this.paramsGenerator_ = g6; 53923b3eb3cSopenharmony_ci } 54023b3eb3cSopenharmony_ci this.menuItems = undefined; 54123b3eb3cSopenharmony_ci this.onSave = undefined; 54223b3eb3cSopenharmony_ci this.isSaveEnabled = true; 54323b3eb3cSopenharmony_ci this.__fontSize = new SynchedPropertySimpleOneWayPU(d6.fontSize, this, 'fontSize'); 54423b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(d6); 54523b3eb3cSopenharmony_ci this.finalizeConstruction(); 54623b3eb3cSopenharmony_ci } 54723b3eb3cSopenharmony_ci setInitiallyProvidedValue(b6) { 54823b3eb3cSopenharmony_ci if (b6.menuItems !== undefined) { 54923b3eb3cSopenharmony_ci this.menuItems = b6.menuItems; 55023b3eb3cSopenharmony_ci } 55123b3eb3cSopenharmony_ci if (b6.onSave !== undefined) { 55223b3eb3cSopenharmony_ci this.onSave = b6.onSave; 55323b3eb3cSopenharmony_ci } 55423b3eb3cSopenharmony_ci if (b6.isSaveEnabled !== undefined) { 55523b3eb3cSopenharmony_ci this.isSaveEnabled = b6.isSaveEnabled; 55623b3eb3cSopenharmony_ci } 55723b3eb3cSopenharmony_ci if (b6.fontSize === undefined) { 55823b3eb3cSopenharmony_ci this.__fontSize.set(1); 55923b3eb3cSopenharmony_ci } 56023b3eb3cSopenharmony_ci } 56123b3eb3cSopenharmony_ci updateStateVars(a6) { 56223b3eb3cSopenharmony_ci this.__fontSize.reset(a6.fontSize); 56323b3eb3cSopenharmony_ci } 56423b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(z5) { 56523b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(z5); 56623b3eb3cSopenharmony_ci } 56723b3eb3cSopenharmony_ci aboutToBeDeleted() { 56823b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 56923b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 57023b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 57123b3eb3cSopenharmony_ci } 57223b3eb3cSopenharmony_ci get fontSize() { 57323b3eb3cSopenharmony_ci return this.__fontSize.get(); 57423b3eb3cSopenharmony_ci } 57523b3eb3cSopenharmony_ci set fontSize(y5) { 57623b3eb3cSopenharmony_ci this.__fontSize.set(y5); 57723b3eb3cSopenharmony_ci } 57823b3eb3cSopenharmony_ci initialRender() { 57923b3eb3cSopenharmony_ci this.observeComponentCreation2((w5, x5) => { 58023b3eb3cSopenharmony_ci Column.create(); 58123b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 58223b3eb3cSopenharmony_ci }, Column); 58323b3eb3cSopenharmony_ci this.observeComponentCreation2((u5, v5) => { 58423b3eb3cSopenharmony_ci Row.create(); 58523b3eb3cSopenharmony_ci }, Row); 58623b3eb3cSopenharmony_ci this.observeComponentCreation2((c5, d5) => { 58723b3eb3cSopenharmony_ci If.create(); 58823b3eb3cSopenharmony_ci if (this.menuItems !== undefined && this.menuItems.length > EditableTitleBar.commonZero) { 58923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 59023b3eb3cSopenharmony_ci this.observeComponentCreation2((h5, i5) => { 59123b3eb3cSopenharmony_ci ForEach.create(); 59223b3eb3cSopenharmony_ci const r5 = l5 => { 59323b3eb3cSopenharmony_ci const m5 = l5; 59423b3eb3cSopenharmony_ci { 59523b3eb3cSopenharmony_ci this.observeComponentCreation2((o5, p5) => { 59623b3eb3cSopenharmony_ci if (p5) { 59723b3eb3cSopenharmony_ci let q5 = new ImageMenuItem(this, { 59823b3eb3cSopenharmony_ci item: m5, 59923b3eb3cSopenharmony_ci attribute: ItemType.Icon, 60023b3eb3cSopenharmony_ci fontSize: this.fontSize, 60123b3eb3cSopenharmony_ci }, undefined, o5, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 369, col: 15 }); 60223b3eb3cSopenharmony_ci ViewPU.create(q5); 60323b3eb3cSopenharmony_ci let s5 = () => { 60423b3eb3cSopenharmony_ci return { 60523b3eb3cSopenharmony_ci item: m5, 60623b3eb3cSopenharmony_ci attribute: ItemType.Icon, 60723b3eb3cSopenharmony_ci fontSize: this.fontSize 60823b3eb3cSopenharmony_ci }; 60923b3eb3cSopenharmony_ci }; 61023b3eb3cSopenharmony_ci q5.paramsGenerator_ = s5; 61123b3eb3cSopenharmony_ci } 61223b3eb3cSopenharmony_ci else { 61323b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(o5, { 61423b3eb3cSopenharmony_ci fontSize: this.fontSize 61523b3eb3cSopenharmony_ci }); 61623b3eb3cSopenharmony_ci } 61723b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 61823b3eb3cSopenharmony_ci } 61923b3eb3cSopenharmony_ci }; 62023b3eb3cSopenharmony_ci this.forEachUpdateFunction(h5, this.menuItems.slice(EditableTitleBar.commonZero, this.isSaveEnabled ? 62123b3eb3cSopenharmony_ci EditableTitleBar.maxOtherCountOfExtraItems : EditableTitleBar.maxCountOfExtraItems), r5); 62223b3eb3cSopenharmony_ci }, ForEach); 62323b3eb3cSopenharmony_ci ForEach.pop(); 62423b3eb3cSopenharmony_ci }); 62523b3eb3cSopenharmony_ci } 62623b3eb3cSopenharmony_ci else { 62723b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 62823b3eb3cSopenharmony_ci }); 62923b3eb3cSopenharmony_ci } 63023b3eb3cSopenharmony_ci }, If); 63123b3eb3cSopenharmony_ci If.pop(); 63223b3eb3cSopenharmony_ci this.observeComponentCreation2((r4, s4) => { 63323b3eb3cSopenharmony_ci If.create(); 63423b3eb3cSopenharmony_ci if (this.isSaveEnabled) { 63523b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 63623b3eb3cSopenharmony_ci { 63723b3eb3cSopenharmony_ci this.observeComponentCreation2((w4, x4) => { 63823b3eb3cSopenharmony_ci if (x4) { 63923b3eb3cSopenharmony_ci let y4 = new ImageMenuItem(this, { 64023b3eb3cSopenharmony_ci item: { 64123b3eb3cSopenharmony_ci value: PUBLIC_OK, 64223b3eb3cSopenharmony_ci isEnabled: true, 64323b3eb3cSopenharmony_ci action: () => this.onSave && this.onSave(), 64423b3eb3cSopenharmony_ci }, 64523b3eb3cSopenharmony_ci fontSize: this.fontSize, 64623b3eb3cSopenharmony_ci attribute: ItemType.Icon, 64723b3eb3cSopenharmony_ci useSymbol: true, 64823b3eb3cSopenharmony_ci }, undefined, w4, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 377, col: 11 }); 64923b3eb3cSopenharmony_ci ViewPU.create(y4); 65023b3eb3cSopenharmony_ci let j5 = () => { 65123b3eb3cSopenharmony_ci return { 65223b3eb3cSopenharmony_ci item: { 65323b3eb3cSopenharmony_ci value: PUBLIC_OK, 65423b3eb3cSopenharmony_ci isEnabled: true, 65523b3eb3cSopenharmony_ci action: () => this.onSave && this.onSave(), 65623b3eb3cSopenharmony_ci }, 65723b3eb3cSopenharmony_ci fontSize: this.fontSize, 65823b3eb3cSopenharmony_ci attribute: ItemType.Icon, 65923b3eb3cSopenharmony_ci useSymbol: true 66023b3eb3cSopenharmony_ci }; 66123b3eb3cSopenharmony_ci }; 66223b3eb3cSopenharmony_ci y4.paramsGenerator_ = j5; 66323b3eb3cSopenharmony_ci } 66423b3eb3cSopenharmony_ci else { 66523b3eb3cSopenharmony_ci this.updateStateVarsOfChildByElmtId(w4, { 66623b3eb3cSopenharmony_ci fontSize: this.fontSize 66723b3eb3cSopenharmony_ci }); 66823b3eb3cSopenharmony_ci } 66923b3eb3cSopenharmony_ci }, { name: 'ImageMenuItem' }); 67023b3eb3cSopenharmony_ci } 67123b3eb3cSopenharmony_ci }); 67223b3eb3cSopenharmony_ci } 67323b3eb3cSopenharmony_ci else { 67423b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 67523b3eb3cSopenharmony_ci }); 67623b3eb3cSopenharmony_ci } 67723b3eb3cSopenharmony_ci }, If); 67823b3eb3cSopenharmony_ci If.pop(); 67923b3eb3cSopenharmony_ci Row.pop(); 68023b3eb3cSopenharmony_ci Column.pop(); 68123b3eb3cSopenharmony_ci } 68223b3eb3cSopenharmony_ci rerender() { 68323b3eb3cSopenharmony_ci this.updateDirtyElements(); 68423b3eb3cSopenharmony_ci } 68523b3eb3cSopenharmony_ci} 68623b3eb3cSopenharmony_ciclass ImageMenuItem extends ViewPU { 68723b3eb3cSopenharmony_ci constructor(d4, e4, f4, g4 = -1, h4 = undefined, i4) { 68823b3eb3cSopenharmony_ci super(d4, f4, g4, i4); 68923b3eb3cSopenharmony_ci if (typeof h4 === 'function') { 69023b3eb3cSopenharmony_ci this.paramsGenerator_ = h4; 69123b3eb3cSopenharmony_ci } 69223b3eb3cSopenharmony_ci this.item = { 69323b3eb3cSopenharmony_ci value: '', 69423b3eb3cSopenharmony_ci isEnabled: true, 69523b3eb3cSopenharmony_ci label: '', 69623b3eb3cSopenharmony_ci }; 69723b3eb3cSopenharmony_ci this.attribute = ItemType.Image; 69823b3eb3cSopenharmony_ci this.callbackId = undefined; 69923b3eb3cSopenharmony_ci this.minFontSize = 1.75; 70023b3eb3cSopenharmony_ci this.maxFontSize = 3.2; 70123b3eb3cSopenharmony_ci this.longPressTime = 500; 70223b3eb3cSopenharmony_ci this.useSymbol = false; 70323b3eb3cSopenharmony_ci this.__fontSize = new SynchedPropertySimpleOneWayPU(e4.fontSize, this, 'fontSize'); 70423b3eb3cSopenharmony_ci this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 70523b3eb3cSopenharmony_ci this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 70623b3eb3cSopenharmony_ci this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 70723b3eb3cSopenharmony_ci this.__editableTitleBarTheme = this.initializeConsume('editableTitleBarTheme', 'editableTitleBarTheme'); 70823b3eb3cSopenharmony_ci this.dialogController = new CustomDialogController({ 70923b3eb3cSopenharmony_ci builder: () => { 71023b3eb3cSopenharmony_ci let j4 = new EditableTitleBarDialog(this, { 71123b3eb3cSopenharmony_ci cancel: () => { 71223b3eb3cSopenharmony_ci }, 71323b3eb3cSopenharmony_ci confirm: () => { 71423b3eb3cSopenharmony_ci }, 71523b3eb3cSopenharmony_ci itemEditableDialog: this.item, 71623b3eb3cSopenharmony_ci textEditableTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 71723b3eb3cSopenharmony_ci fontSize: this.fontSize, 71823b3eb3cSopenharmony_ci useSymbol: this.useSymbol, 71923b3eb3cSopenharmony_ci }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/EditableTitleBar.ets', line: 413, col: 14 }); 72023b3eb3cSopenharmony_ci j4.setController(this.dialogController); 72123b3eb3cSopenharmony_ci ViewPU.create(j4); 72223b3eb3cSopenharmony_ci let a5 = () => { 72323b3eb3cSopenharmony_ci return { 72423b3eb3cSopenharmony_ci cancel: () => { 72523b3eb3cSopenharmony_ci }, 72623b3eb3cSopenharmony_ci confirm: () => { 72723b3eb3cSopenharmony_ci }, 72823b3eb3cSopenharmony_ci itemEditableDialog: this.item, 72923b3eb3cSopenharmony_ci textEditableTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 73023b3eb3cSopenharmony_ci fontSize: this.fontSize, 73123b3eb3cSopenharmony_ci useSymbol: this.useSymbol 73223b3eb3cSopenharmony_ci }; 73323b3eb3cSopenharmony_ci }; 73423b3eb3cSopenharmony_ci j4.paramsGenerator_ = a5; 73523b3eb3cSopenharmony_ci }, 73623b3eb3cSopenharmony_ci maskColor: Color.Transparent, 73723b3eb3cSopenharmony_ci isModal: true, 73823b3eb3cSopenharmony_ci customStyle: true 73923b3eb3cSopenharmony_ci }, this); 74023b3eb3cSopenharmony_ci this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 74123b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(e4); 74223b3eb3cSopenharmony_ci this.declareWatch('fontSize', this.onFontSizeUpdated); 74323b3eb3cSopenharmony_ci this.finalizeConstruction(); 74423b3eb3cSopenharmony_ci } 74523b3eb3cSopenharmony_ci setInitiallyProvidedValue(c4) { 74623b3eb3cSopenharmony_ci if (c4.item !== undefined) { 74723b3eb3cSopenharmony_ci this.item = c4.item; 74823b3eb3cSopenharmony_ci } 74923b3eb3cSopenharmony_ci if (c4.attribute !== undefined) { 75023b3eb3cSopenharmony_ci this.attribute = c4.attribute; 75123b3eb3cSopenharmony_ci } 75223b3eb3cSopenharmony_ci if (c4.callbackId !== undefined) { 75323b3eb3cSopenharmony_ci this.callbackId = c4.callbackId; 75423b3eb3cSopenharmony_ci } 75523b3eb3cSopenharmony_ci if (c4.minFontSize !== undefined) { 75623b3eb3cSopenharmony_ci this.minFontSize = c4.minFontSize; 75723b3eb3cSopenharmony_ci } 75823b3eb3cSopenharmony_ci if (c4.maxFontSize !== undefined) { 75923b3eb3cSopenharmony_ci this.maxFontSize = c4.maxFontSize; 76023b3eb3cSopenharmony_ci } 76123b3eb3cSopenharmony_ci if (c4.longPressTime !== undefined) { 76223b3eb3cSopenharmony_ci this.longPressTime = c4.longPressTime; 76323b3eb3cSopenharmony_ci } 76423b3eb3cSopenharmony_ci if (c4.useSymbol !== undefined) { 76523b3eb3cSopenharmony_ci this.useSymbol = c4.useSymbol; 76623b3eb3cSopenharmony_ci } 76723b3eb3cSopenharmony_ci if (c4.fontSize === undefined) { 76823b3eb3cSopenharmony_ci this.__fontSize.set(1); 76923b3eb3cSopenharmony_ci } 77023b3eb3cSopenharmony_ci if (c4.isOnFocus !== undefined) { 77123b3eb3cSopenharmony_ci this.isOnFocus = c4.isOnFocus; 77223b3eb3cSopenharmony_ci } 77323b3eb3cSopenharmony_ci if (c4.isOnHover !== undefined) { 77423b3eb3cSopenharmony_ci this.isOnHover = c4.isOnHover; 77523b3eb3cSopenharmony_ci } 77623b3eb3cSopenharmony_ci if (c4.isOnClick !== undefined) { 77723b3eb3cSopenharmony_ci this.isOnClick = c4.isOnClick; 77823b3eb3cSopenharmony_ci } 77923b3eb3cSopenharmony_ci if (c4.dialogController !== undefined) { 78023b3eb3cSopenharmony_ci this.dialogController = c4.dialogController; 78123b3eb3cSopenharmony_ci } 78223b3eb3cSopenharmony_ci if (c4.buttonGestureModifier !== undefined) { 78323b3eb3cSopenharmony_ci this.buttonGestureModifier = c4.buttonGestureModifier; 78423b3eb3cSopenharmony_ci } 78523b3eb3cSopenharmony_ci } 78623b3eb3cSopenharmony_ci updateStateVars(b4) { 78723b3eb3cSopenharmony_ci this.__fontSize.reset(b4.fontSize); 78823b3eb3cSopenharmony_ci } 78923b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(a4) { 79023b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(a4); 79123b3eb3cSopenharmony_ci this.__isOnFocus.purgeDependencyOnElmtId(a4); 79223b3eb3cSopenharmony_ci this.__isOnHover.purgeDependencyOnElmtId(a4); 79323b3eb3cSopenharmony_ci this.__isOnClick.purgeDependencyOnElmtId(a4); 79423b3eb3cSopenharmony_ci this.__editableTitleBarTheme.purgeDependencyOnElmtId(a4); 79523b3eb3cSopenharmony_ci this.__buttonGestureModifier.purgeDependencyOnElmtId(a4); 79623b3eb3cSopenharmony_ci } 79723b3eb3cSopenharmony_ci aboutToBeDeleted() { 79823b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 79923b3eb3cSopenharmony_ci this.__isOnFocus.aboutToBeDeleted(); 80023b3eb3cSopenharmony_ci this.__isOnHover.aboutToBeDeleted(); 80123b3eb3cSopenharmony_ci this.__isOnClick.aboutToBeDeleted(); 80223b3eb3cSopenharmony_ci this.__editableTitleBarTheme.aboutToBeDeleted(); 80323b3eb3cSopenharmony_ci this.__buttonGestureModifier.aboutToBeDeleted(); 80423b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 80523b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 80623b3eb3cSopenharmony_ci } 80723b3eb3cSopenharmony_ci get fontSize() { 80823b3eb3cSopenharmony_ci return this.__fontSize.get(); 80923b3eb3cSopenharmony_ci } 81023b3eb3cSopenharmony_ci set fontSize(z3) { 81123b3eb3cSopenharmony_ci this.__fontSize.set(z3); 81223b3eb3cSopenharmony_ci } 81323b3eb3cSopenharmony_ci get isOnFocus() { 81423b3eb3cSopenharmony_ci return this.__isOnFocus.get(); 81523b3eb3cSopenharmony_ci } 81623b3eb3cSopenharmony_ci set isOnFocus(y3) { 81723b3eb3cSopenharmony_ci this.__isOnFocus.set(y3); 81823b3eb3cSopenharmony_ci } 81923b3eb3cSopenharmony_ci get isOnHover() { 82023b3eb3cSopenharmony_ci return this.__isOnHover.get(); 82123b3eb3cSopenharmony_ci } 82223b3eb3cSopenharmony_ci set isOnHover(x3) { 82323b3eb3cSopenharmony_ci this.__isOnHover.set(x3); 82423b3eb3cSopenharmony_ci } 82523b3eb3cSopenharmony_ci get isOnClick() { 82623b3eb3cSopenharmony_ci return this.__isOnClick.get(); 82723b3eb3cSopenharmony_ci } 82823b3eb3cSopenharmony_ci set isOnClick(w3) { 82923b3eb3cSopenharmony_ci this.__isOnClick.set(w3); 83023b3eb3cSopenharmony_ci } 83123b3eb3cSopenharmony_ci get editableTitleBarTheme() { 83223b3eb3cSopenharmony_ci return this.__editableTitleBarTheme.get(); 83323b3eb3cSopenharmony_ci } 83423b3eb3cSopenharmony_ci set editableTitleBarTheme(v3) { 83523b3eb3cSopenharmony_ci this.__editableTitleBarTheme.set(v3); 83623b3eb3cSopenharmony_ci } 83723b3eb3cSopenharmony_ci get buttonGestureModifier() { 83823b3eb3cSopenharmony_ci return this.__buttonGestureModifier.get(); 83923b3eb3cSopenharmony_ci } 84023b3eb3cSopenharmony_ci set buttonGestureModifier(u3) { 84123b3eb3cSopenharmony_ci this.__buttonGestureModifier.set(u3); 84223b3eb3cSopenharmony_ci } 84323b3eb3cSopenharmony_ci textDialog() { 84423b3eb3cSopenharmony_ci if (this.item.value === PUBLIC_OK) { 84523b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_save'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 84623b3eb3cSopenharmony_ci } 84723b3eb3cSopenharmony_ci else if (this.item.value === PUBLIC_CANCEL) { 84823b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_cancel'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 84923b3eb3cSopenharmony_ci } 85023b3eb3cSopenharmony_ci else if (this.item.value === PUBLIC_BACK) { 85123b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 85223b3eb3cSopenharmony_ci } 85323b3eb3cSopenharmony_ci else { 85423b3eb3cSopenharmony_ci return this.item.label ? this.item.label : ''; 85523b3eb3cSopenharmony_ci } 85623b3eb3cSopenharmony_ci } 85723b3eb3cSopenharmony_ci onFontSizeUpdated() { 85823b3eb3cSopenharmony_ci this.buttonGestureModifier.fontSize = this.fontSize; 85923b3eb3cSopenharmony_ci } 86023b3eb3cSopenharmony_ci touchEventAction(t3) { 86123b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 86223b3eb3cSopenharmony_ci return; 86323b3eb3cSopenharmony_ci } 86423b3eb3cSopenharmony_ci if (t3.type === TouchType.Down) { 86523b3eb3cSopenharmony_ci this.isOnClick = true; 86623b3eb3cSopenharmony_ci } 86723b3eb3cSopenharmony_ci if (t3.type === TouchType.Up || t3.type === TouchType.Cancel) { 86823b3eb3cSopenharmony_ci if (this.fontSize >= this.minFontSize) { 86923b3eb3cSopenharmony_ci this.dialogController?.close(); 87023b3eb3cSopenharmony_ci } 87123b3eb3cSopenharmony_ci this.isOnClick = false; 87223b3eb3cSopenharmony_ci } 87323b3eb3cSopenharmony_ci } 87423b3eb3cSopenharmony_ci keyEventAction(s3) { 87523b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 87623b3eb3cSopenharmony_ci return; 87723b3eb3cSopenharmony_ci } 87823b3eb3cSopenharmony_ci if (s3.keyCode !== KeyCode.KEYCODE_ENTER && s3.keyCode !== KeyCode.KEYCODE_SPACE) { 87923b3eb3cSopenharmony_ci return; 88023b3eb3cSopenharmony_ci } 88123b3eb3cSopenharmony_ci if (s3.type === KeyType.Down) { 88223b3eb3cSopenharmony_ci this.isOnClick = true; 88323b3eb3cSopenharmony_ci } 88423b3eb3cSopenharmony_ci if (s3.type === KeyType.Up) { 88523b3eb3cSopenharmony_ci this.isOnClick = false; 88623b3eb3cSopenharmony_ci } 88723b3eb3cSopenharmony_ci } 88823b3eb3cSopenharmony_ci getBgColor() { 88923b3eb3cSopenharmony_ci if (this.isOnClick) { 89023b3eb3cSopenharmony_ci return this.editableTitleBarTheme.iconBackgroundPressedColor; 89123b3eb3cSopenharmony_ci } 89223b3eb3cSopenharmony_ci else if (this.isOnHover) { 89323b3eb3cSopenharmony_ci return this.editableTitleBarTheme.iconBackgroundHoverColor; 89423b3eb3cSopenharmony_ci } 89523b3eb3cSopenharmony_ci else { 89623b3eb3cSopenharmony_ci return this.editableTitleBarTheme.iconBackgroundColor; 89723b3eb3cSopenharmony_ci } 89823b3eb3cSopenharmony_ci } 89923b3eb3cSopenharmony_ci getFgColor() { 90023b3eb3cSopenharmony_ci if (this.isOnClick) { 90123b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_pressed_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 90223b3eb3cSopenharmony_ci } 90323b3eb3cSopenharmony_ci else if (this.isOnHover) { 90423b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10001, params: ['sys.color.titlebar_icon_background_hover_color'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 90523b3eb3cSopenharmony_ci } 90623b3eb3cSopenharmony_ci else { 90723b3eb3cSopenharmony_ci return EditableTitleBar.noneColor; 90823b3eb3cSopenharmony_ci } 90923b3eb3cSopenharmony_ci } 91023b3eb3cSopenharmony_ci getAccessibilityReadText() { 91123b3eb3cSopenharmony_ci if (this.item.value === PUBLIC_OK) { 91223b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_save'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 91323b3eb3cSopenharmony_ci } 91423b3eb3cSopenharmony_ci else if (this.item.value === PUBLIC_CANCEL) { 91523b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_cancel'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 91623b3eb3cSopenharmony_ci } 91723b3eb3cSopenharmony_ci else if (this.item.value === PUBLIC_BACK) { 91823b3eb3cSopenharmony_ci return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 91923b3eb3cSopenharmony_ci } 92023b3eb3cSopenharmony_ci else if (this.item.label) { 92123b3eb3cSopenharmony_ci return this.item.label; 92223b3eb3cSopenharmony_ci } 92323b3eb3cSopenharmony_ci return undefined; 92423b3eb3cSopenharmony_ci } 92523b3eb3cSopenharmony_ci IconBuilder(u2 = null) { 92623b3eb3cSopenharmony_ci this.observeComponentCreation2((h3, i3) => { 92723b3eb3cSopenharmony_ci Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 92823b3eb3cSopenharmony_ci Button.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 92923b3eb3cSopenharmony_ci Button.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 93023b3eb3cSopenharmony_ci Button.focusable(this.item.isEnabled); 93123b3eb3cSopenharmony_ci Button.enabled(this.item.isEnabled); 93223b3eb3cSopenharmony_ci Button.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 93323b3eb3cSopenharmony_ci Button.margin({ 93423b3eb3cSopenharmony_ci start: this.attribute === ItemType.LeftIcon ? LengthMetrics.vp(EditableTitleBar.commonZero) : 93523b3eb3cSopenharmony_ci LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_space_horizontal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }), 93623b3eb3cSopenharmony_ci }); 93723b3eb3cSopenharmony_ci Button.focusOnTouch(true); 93823b3eb3cSopenharmony_ci Button.foregroundColor(this.getFgColor()); 93923b3eb3cSopenharmony_ci Button.backgroundColor(this.getBgColor()); 94023b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 94123b3eb3cSopenharmony_ci Button.border({ 94223b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 94323b3eb3cSopenharmony_ci width: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_focus_outline_weight'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 94423b3eb3cSopenharmony_ci color: this.editableTitleBarTheme.iconBackgroundFocusOutlineColor, 94523b3eb3cSopenharmony_ci style: BorderStyle.Solid, 94623b3eb3cSopenharmony_ci }); 94723b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 94823b3eb3cSopenharmony_ci Button.border({ 94923b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 95023b3eb3cSopenharmony_ci width: EditableTitleBar.commonZero, 95123b3eb3cSopenharmony_ci }); 95223b3eb3cSopenharmony_ci ViewStackProcessor.visualState('pressed'); 95323b3eb3cSopenharmony_ci Button.border({ 95423b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 95523b3eb3cSopenharmony_ci width: EditableTitleBar.commonZero, 95623b3eb3cSopenharmony_ci }); 95723b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 95823b3eb3cSopenharmony_ci Button.onFocus(() => { 95923b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 96023b3eb3cSopenharmony_ci return; 96123b3eb3cSopenharmony_ci } 96223b3eb3cSopenharmony_ci this.isOnFocus = true; 96323b3eb3cSopenharmony_ci }); 96423b3eb3cSopenharmony_ci Button.onBlur(() => this.isOnFocus = false); 96523b3eb3cSopenharmony_ci Button.onHover((r3) => { 96623b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 96723b3eb3cSopenharmony_ci return; 96823b3eb3cSopenharmony_ci } 96923b3eb3cSopenharmony_ci this.isOnHover = r3; 97023b3eb3cSopenharmony_ci }); 97123b3eb3cSopenharmony_ci Button.onKeyEvent((q3) => { 97223b3eb3cSopenharmony_ci this.keyEventAction(q3); 97323b3eb3cSopenharmony_ci }); 97423b3eb3cSopenharmony_ci Button.onTouch((p3) => { 97523b3eb3cSopenharmony_ci this.touchEventAction(p3); 97623b3eb3cSopenharmony_ci }); 97723b3eb3cSopenharmony_ci Button.onClick(() => { 97823b3eb3cSopenharmony_ci this.item.isEnabled && this.item.action && this.item.action(); 97923b3eb3cSopenharmony_ci }); 98023b3eb3cSopenharmony_ci Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 98123b3eb3cSopenharmony_ci }, Button); 98223b3eb3cSopenharmony_ci this.observeComponentCreation2((x2, y2) => { 98323b3eb3cSopenharmony_ci If.create(); 98423b3eb3cSopenharmony_ci if (this.useSymbol) { 98523b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 98623b3eb3cSopenharmony_ci this.observeComponentCreation2((f3, g3) => { 98723b3eb3cSopenharmony_ci SymbolGlyph.create(this.item.value); 98823b3eb3cSopenharmony_ci SymbolGlyph.fontColor([this.editableTitleBarTheme.iconColor]); 98923b3eb3cSopenharmony_ci SymbolGlyph.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 99023b3eb3cSopenharmony_ci SymbolGlyph.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 99123b3eb3cSopenharmony_ci SymbolGlyph.focusable(this.item.isEnabled); 99223b3eb3cSopenharmony_ci SymbolGlyph.enabled(this.item.isEnabled); 99323b3eb3cSopenharmony_ci SymbolGlyph.draggable(false); 99423b3eb3cSopenharmony_ci SymbolGlyph.fontSize(SYMBOL_SIZE); 99523b3eb3cSopenharmony_ci SymbolGlyph.accessibilityText(this.getAccessibilityReadText()); 99623b3eb3cSopenharmony_ci }, SymbolGlyph); 99723b3eb3cSopenharmony_ci }); 99823b3eb3cSopenharmony_ci } 99923b3eb3cSopenharmony_ci else { 100023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 100123b3eb3cSopenharmony_ci this.observeComponentCreation2((b3, c3) => { 100223b3eb3cSopenharmony_ci Image.create(this.item.value); 100323b3eb3cSopenharmony_ci Image.fillColor(this.editableTitleBarTheme.iconColor); 100423b3eb3cSopenharmony_ci Image.matchTextDirection(this.item.value === PUBLIC_BACK ? true : false); 100523b3eb3cSopenharmony_ci Image.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 100623b3eb3cSopenharmony_ci Image.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 100723b3eb3cSopenharmony_ci Image.focusable(this.item.isEnabled); 100823b3eb3cSopenharmony_ci Image.enabled(this.item.isEnabled); 100923b3eb3cSopenharmony_ci Image.draggable(false); 101023b3eb3cSopenharmony_ci Image.accessibilityText(this.getAccessibilityReadText()); 101123b3eb3cSopenharmony_ci }, Image); 101223b3eb3cSopenharmony_ci }); 101323b3eb3cSopenharmony_ci } 101423b3eb3cSopenharmony_ci }, If); 101523b3eb3cSopenharmony_ci If.pop(); 101623b3eb3cSopenharmony_ci Button.pop(); 101723b3eb3cSopenharmony_ci } 101823b3eb3cSopenharmony_ci ImageBuilder(b2 = null) { 101923b3eb3cSopenharmony_ci this.observeComponentCreation2((s2, t2) => { 102023b3eb3cSopenharmony_ci Stack.create({ alignContent: Alignment.Center }); 102123b3eb3cSopenharmony_ci Stack.margin({ 102223b3eb3cSopenharmony_ci start: LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_space_horizontal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }), 102323b3eb3cSopenharmony_ci }); 102423b3eb3cSopenharmony_ci }, Stack); 102523b3eb3cSopenharmony_ci this.observeComponentCreation2((q2, r2) => { 102623b3eb3cSopenharmony_ci If.create(); 102723b3eb3cSopenharmony_ci if (this.useSymbol) { 102823b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 102923b3eb3cSopenharmony_ci this.observeComponentCreation2((p4, z4) => { 103023b3eb3cSopenharmony_ci SymbolGlyph.create(this.item.value); 103123b3eb3cSopenharmony_ci SymbolGlyph.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 103223b3eb3cSopenharmony_ci SymbolGlyph.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 103323b3eb3cSopenharmony_ci SymbolGlyph.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 103423b3eb3cSopenharmony_ci SymbolGlyph.focusable(false); 103523b3eb3cSopenharmony_ci SymbolGlyph.enabled(this.item.isEnabled); 103623b3eb3cSopenharmony_ci }, SymbolGlyph); 103723b3eb3cSopenharmony_ci }); 103823b3eb3cSopenharmony_ci } 103923b3eb3cSopenharmony_ci else { 104023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 104123b3eb3cSopenharmony_ci this.observeComponentCreation2((k4, l4) => { 104223b3eb3cSopenharmony_ci Image.create(this.item.value); 104323b3eb3cSopenharmony_ci Image.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 104423b3eb3cSopenharmony_ci Image.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 104523b3eb3cSopenharmony_ci Image.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 104623b3eb3cSopenharmony_ci Image.focusable(false); 104723b3eb3cSopenharmony_ci Image.enabled(this.item.isEnabled); 104823b3eb3cSopenharmony_ci Image.objectFit(ImageFit.Cover); 104923b3eb3cSopenharmony_ci }, Image); 105023b3eb3cSopenharmony_ci }); 105123b3eb3cSopenharmony_ci } 105223b3eb3cSopenharmony_ci }, If); 105323b3eb3cSopenharmony_ci If.pop(); 105423b3eb3cSopenharmony_ci this.observeComponentCreation2((f2, g2) => { 105523b3eb3cSopenharmony_ci Button.createWithLabel({ type: ButtonType.Circle }); 105623b3eb3cSopenharmony_ci Button.width({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_width'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 105723b3eb3cSopenharmony_ci Button.height({ 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_height'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 105823b3eb3cSopenharmony_ci Button.focusable(this.item.isEnabled); 105923b3eb3cSopenharmony_ci Button.enabled(this.item.isEnabled); 106023b3eb3cSopenharmony_ci Button.foregroundColor(this.getFgColor()); 106123b3eb3cSopenharmony_ci Button.backgroundColor(EditableTitleBar.noneColor); 106223b3eb3cSopenharmony_ci ViewStackProcessor.visualState('pressed'); 106323b3eb3cSopenharmony_ci Button.border({ 106423b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 106523b3eb3cSopenharmony_ci width: EditableTitleBar.commonZero, 106623b3eb3cSopenharmony_ci }); 106723b3eb3cSopenharmony_ci ViewStackProcessor.visualState('normal'); 106823b3eb3cSopenharmony_ci Button.border({ 106923b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 107023b3eb3cSopenharmony_ci width: EditableTitleBar.commonZero, 107123b3eb3cSopenharmony_ci }); 107223b3eb3cSopenharmony_ci ViewStackProcessor.visualState('focused'); 107323b3eb3cSopenharmony_ci Button.border({ 107423b3eb3cSopenharmony_ci radius: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_shape'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 107523b3eb3cSopenharmony_ci width: { 'id': -1, 'type': 10002, params: ['sys.float.titlebar_icon_background_focus_outline_weight'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 107623b3eb3cSopenharmony_ci color: this.editableTitleBarTheme.iconBackgroundFocusOutlineColor, 107723b3eb3cSopenharmony_ci style: BorderStyle.Solid, 107823b3eb3cSopenharmony_ci }); 107923b3eb3cSopenharmony_ci ViewStackProcessor.visualState(); 108023b3eb3cSopenharmony_ci Button.onFocus(() => { 108123b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 108223b3eb3cSopenharmony_ci return; 108323b3eb3cSopenharmony_ci } 108423b3eb3cSopenharmony_ci this.isOnFocus = true; 108523b3eb3cSopenharmony_ci }); 108623b3eb3cSopenharmony_ci Button.onBlur(() => this.isOnFocus = false); 108723b3eb3cSopenharmony_ci Button.onHover((p2) => { 108823b3eb3cSopenharmony_ci if (!this.item.isEnabled) { 108923b3eb3cSopenharmony_ci return; 109023b3eb3cSopenharmony_ci } 109123b3eb3cSopenharmony_ci this.isOnHover = p2; 109223b3eb3cSopenharmony_ci }); 109323b3eb3cSopenharmony_ci Button.onKeyEvent((o2) => { 109423b3eb3cSopenharmony_ci this.keyEventAction(o2); 109523b3eb3cSopenharmony_ci }); 109623b3eb3cSopenharmony_ci Button.onTouch((n2) => { 109723b3eb3cSopenharmony_ci this.touchEventAction(n2); 109823b3eb3cSopenharmony_ci }); 109923b3eb3cSopenharmony_ci Button.onClick(() => { 110023b3eb3cSopenharmony_ci this.item.isEnabled && this.item.action && this.item.action(); 110123b3eb3cSopenharmony_ci }); 110223b3eb3cSopenharmony_ci Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 110323b3eb3cSopenharmony_ci }, Button); 110423b3eb3cSopenharmony_ci Button.pop(); 110523b3eb3cSopenharmony_ci Stack.pop(); 110623b3eb3cSopenharmony_ci } 110723b3eb3cSopenharmony_ci initialRender() { 110823b3eb3cSopenharmony_ci this.observeComponentCreation2((x1, y1) => { 110923b3eb3cSopenharmony_ci If.create(); 111023b3eb3cSopenharmony_ci if (this.attribute === ItemType.Icon || this.attribute === ItemType.LeftIcon) { 111123b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 111223b3eb3cSopenharmony_ci this.IconBuilder.bind(this)(this); 111323b3eb3cSopenharmony_ci }); 111423b3eb3cSopenharmony_ci } 111523b3eb3cSopenharmony_ci else { 111623b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 111723b3eb3cSopenharmony_ci this.ImageBuilder.bind(this)(this); 111823b3eb3cSopenharmony_ci }); 111923b3eb3cSopenharmony_ci } 112023b3eb3cSopenharmony_ci }, If); 112123b3eb3cSopenharmony_ci If.pop(); 112223b3eb3cSopenharmony_ci } 112323b3eb3cSopenharmony_ci rerender() { 112423b3eb3cSopenharmony_ci this.updateDirtyElements(); 112523b3eb3cSopenharmony_ci } 112623b3eb3cSopenharmony_ci} 112723b3eb3cSopenharmony_ciclass EditableTitleBarDialog extends ViewPU { 112823b3eb3cSopenharmony_ci constructor(o1, p1, q1, r1 = -1, s1 = undefined, t1) { 112923b3eb3cSopenharmony_ci super(o1, q1, r1, t1); 113023b3eb3cSopenharmony_ci if (typeof s1 === 'function') { 113123b3eb3cSopenharmony_ci this.paramsGenerator_ = s1; 113223b3eb3cSopenharmony_ci } 113323b3eb3cSopenharmony_ci this.itemEditableDialog = { 113423b3eb3cSopenharmony_ci value: '', 113523b3eb3cSopenharmony_ci isEnabled: true, 113623b3eb3cSopenharmony_ci }; 113723b3eb3cSopenharmony_ci this.callbackId = undefined; 113823b3eb3cSopenharmony_ci this.textEditableTitleBarDialog = ''; 113923b3eb3cSopenharmony_ci this.mainWindowStage = undefined; 114023b3eb3cSopenharmony_ci this.controller = undefined; 114123b3eb3cSopenharmony_ci this.minFontSize = 1.75; 114223b3eb3cSopenharmony_ci this.maxFontSize = 3.2; 114323b3eb3cSopenharmony_ci this.screenWidth = 640; 114423b3eb3cSopenharmony_ci this.verticalScreenLines = 6; 114523b3eb3cSopenharmony_ci this.horizontalsScreenLines = 1; 114623b3eb3cSopenharmony_ci this.useSymbol = false; 114723b3eb3cSopenharmony_ci this.cancel = () => { 114823b3eb3cSopenharmony_ci }; 114923b3eb3cSopenharmony_ci this.confirm = () => { 115023b3eb3cSopenharmony_ci }; 115123b3eb3cSopenharmony_ci this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 115223b3eb3cSopenharmony_ci this.__fontSize = new SynchedPropertySimpleOneWayPU(p1.fontSize, this, 'fontSize'); 115323b3eb3cSopenharmony_ci this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 115423b3eb3cSopenharmony_ci this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 115523b3eb3cSopenharmony_ci this.setInitiallyProvidedValue(p1); 115623b3eb3cSopenharmony_ci this.finalizeConstruction(); 115723b3eb3cSopenharmony_ci } 115823b3eb3cSopenharmony_ci setInitiallyProvidedValue(n1) { 115923b3eb3cSopenharmony_ci if (n1.itemEditableDialog !== undefined) { 116023b3eb3cSopenharmony_ci this.itemEditableDialog = n1.itemEditableDialog; 116123b3eb3cSopenharmony_ci } 116223b3eb3cSopenharmony_ci if (n1.callbackId !== undefined) { 116323b3eb3cSopenharmony_ci this.callbackId = n1.callbackId; 116423b3eb3cSopenharmony_ci } 116523b3eb3cSopenharmony_ci if (n1.textEditableTitleBarDialog !== undefined) { 116623b3eb3cSopenharmony_ci this.textEditableTitleBarDialog = n1.textEditableTitleBarDialog; 116723b3eb3cSopenharmony_ci } 116823b3eb3cSopenharmony_ci if (n1.mainWindowStage !== undefined) { 116923b3eb3cSopenharmony_ci this.mainWindowStage = n1.mainWindowStage; 117023b3eb3cSopenharmony_ci } 117123b3eb3cSopenharmony_ci if (n1.controller !== undefined) { 117223b3eb3cSopenharmony_ci this.controller = n1.controller; 117323b3eb3cSopenharmony_ci } 117423b3eb3cSopenharmony_ci if (n1.minFontSize !== undefined) { 117523b3eb3cSopenharmony_ci this.minFontSize = n1.minFontSize; 117623b3eb3cSopenharmony_ci } 117723b3eb3cSopenharmony_ci if (n1.maxFontSize !== undefined) { 117823b3eb3cSopenharmony_ci this.maxFontSize = n1.maxFontSize; 117923b3eb3cSopenharmony_ci } 118023b3eb3cSopenharmony_ci if (n1.screenWidth !== undefined) { 118123b3eb3cSopenharmony_ci this.screenWidth = n1.screenWidth; 118223b3eb3cSopenharmony_ci } 118323b3eb3cSopenharmony_ci if (n1.verticalScreenLines !== undefined) { 118423b3eb3cSopenharmony_ci this.verticalScreenLines = n1.verticalScreenLines; 118523b3eb3cSopenharmony_ci } 118623b3eb3cSopenharmony_ci if (n1.horizontalsScreenLines !== undefined) { 118723b3eb3cSopenharmony_ci this.horizontalsScreenLines = n1.horizontalsScreenLines; 118823b3eb3cSopenharmony_ci } 118923b3eb3cSopenharmony_ci if (n1.useSymbol !== undefined) { 119023b3eb3cSopenharmony_ci this.useSymbol = n1.useSymbol; 119123b3eb3cSopenharmony_ci } 119223b3eb3cSopenharmony_ci if (n1.cancel !== undefined) { 119323b3eb3cSopenharmony_ci this.cancel = n1.cancel; 119423b3eb3cSopenharmony_ci } 119523b3eb3cSopenharmony_ci if (n1.confirm !== undefined) { 119623b3eb3cSopenharmony_ci this.confirm = n1.confirm; 119723b3eb3cSopenharmony_ci } 119823b3eb3cSopenharmony_ci if (n1.fontSize === undefined) { 119923b3eb3cSopenharmony_ci this.__fontSize.set(1); 120023b3eb3cSopenharmony_ci } 120123b3eb3cSopenharmony_ci if (n1.maxLines !== undefined) { 120223b3eb3cSopenharmony_ci this.maxLines = n1.maxLines; 120323b3eb3cSopenharmony_ci } 120423b3eb3cSopenharmony_ci } 120523b3eb3cSopenharmony_ci updateStateVars(m1) { 120623b3eb3cSopenharmony_ci this.__fontSize.reset(m1.fontSize); 120723b3eb3cSopenharmony_ci } 120823b3eb3cSopenharmony_ci purgeVariableDependenciesOnElmtId(l1) { 120923b3eb3cSopenharmony_ci this.__mainWindow.purgeDependencyOnElmtId(l1); 121023b3eb3cSopenharmony_ci this.__fontSize.purgeDependencyOnElmtId(l1); 121123b3eb3cSopenharmony_ci this.__maxLines.purgeDependencyOnElmtId(l1); 121223b3eb3cSopenharmony_ci this.__windowStandardHeight.purgeDependencyOnElmtId(l1); 121323b3eb3cSopenharmony_ci } 121423b3eb3cSopenharmony_ci aboutToBeDeleted() { 121523b3eb3cSopenharmony_ci this.__mainWindow.aboutToBeDeleted(); 121623b3eb3cSopenharmony_ci this.__fontSize.aboutToBeDeleted(); 121723b3eb3cSopenharmony_ci this.__maxLines.aboutToBeDeleted(); 121823b3eb3cSopenharmony_ci this.__windowStandardHeight.aboutToBeDeleted(); 121923b3eb3cSopenharmony_ci SubscriberManager.Get().delete(this.id__()); 122023b3eb3cSopenharmony_ci this.aboutToBeDeletedInternal(); 122123b3eb3cSopenharmony_ci } 122223b3eb3cSopenharmony_ci setController(k1) { 122323b3eb3cSopenharmony_ci this.controller = k1; 122423b3eb3cSopenharmony_ci } 122523b3eb3cSopenharmony_ci get mainWindow() { 122623b3eb3cSopenharmony_ci return this.__mainWindow.get(); 122723b3eb3cSopenharmony_ci } 122823b3eb3cSopenharmony_ci set mainWindow(j1) { 122923b3eb3cSopenharmony_ci this.__mainWindow.set(j1); 123023b3eb3cSopenharmony_ci } 123123b3eb3cSopenharmony_ci get fontSize() { 123223b3eb3cSopenharmony_ci return this.__fontSize.get(); 123323b3eb3cSopenharmony_ci } 123423b3eb3cSopenharmony_ci set fontSize(i1) { 123523b3eb3cSopenharmony_ci this.__fontSize.set(i1); 123623b3eb3cSopenharmony_ci } 123723b3eb3cSopenharmony_ci get maxLines() { 123823b3eb3cSopenharmony_ci return this.__maxLines.get(); 123923b3eb3cSopenharmony_ci } 124023b3eb3cSopenharmony_ci set maxLines(h1) { 124123b3eb3cSopenharmony_ci this.__maxLines.set(h1); 124223b3eb3cSopenharmony_ci } 124323b3eb3cSopenharmony_ci get windowStandardHeight() { 124423b3eb3cSopenharmony_ci return this.__windowStandardHeight.get(); 124523b3eb3cSopenharmony_ci } 124623b3eb3cSopenharmony_ci set windowStandardHeight(g1) { 124723b3eb3cSopenharmony_ci this.__windowStandardHeight.set(g1); 124823b3eb3cSopenharmony_ci } 124923b3eb3cSopenharmony_ci initialRender() { 125023b3eb3cSopenharmony_ci this.observeComponentCreation2((k, l) => { 125123b3eb3cSopenharmony_ci If.create(); 125223b3eb3cSopenharmony_ci if (this.textEditableTitleBarDialog) { 125323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 125423b3eb3cSopenharmony_ci this.observeComponentCreation2((e1, f1) => { 125523b3eb3cSopenharmony_ci Column.create(); 125623b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 125723b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 125823b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 125923b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 126023b3eb3cSopenharmony_ci Column.borderRadius(({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' })); 126123b3eb3cSopenharmony_ci }, Column); 126223b3eb3cSopenharmony_ci this.observeComponentCreation2((c1, d1) => { 126323b3eb3cSopenharmony_ci If.create(); 126423b3eb3cSopenharmony_ci if (this.useSymbol) { 126523b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 126623b3eb3cSopenharmony_ci this.observeComponentCreation2((k3, l3) => { 126723b3eb3cSopenharmony_ci SymbolGlyph.create(this.itemEditableDialog.value); 126823b3eb3cSopenharmony_ci SymbolGlyph.width(SYMBOL_TITLE_SIZE); 126923b3eb3cSopenharmony_ci SymbolGlyph.height(SYMBOL_TITLE_SIZE); 127023b3eb3cSopenharmony_ci SymbolGlyph.margin({ 127123b3eb3cSopenharmony_ci top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 127223b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 127323b3eb3cSopenharmony_ci }); 127423b3eb3cSopenharmony_ci SymbolGlyph.fontSize(SYMBOL_TITLE_SIZE); 127523b3eb3cSopenharmony_ci SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 127623b3eb3cSopenharmony_ci }, SymbolGlyph); 127723b3eb3cSopenharmony_ci }); 127823b3eb3cSopenharmony_ci } 127923b3eb3cSopenharmony_ci else { 128023b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 128123b3eb3cSopenharmony_ci this.observeComponentCreation2((k2, l2) => { 128223b3eb3cSopenharmony_ci Image.create(this.itemEditableDialog.value); 128323b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 128423b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 128523b3eb3cSopenharmony_ci Image.margin({ 128623b3eb3cSopenharmony_ci top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 128723b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 128823b3eb3cSopenharmony_ci }); 128923b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 129023b3eb3cSopenharmony_ci }, Image); 129123b3eb3cSopenharmony_ci }); 129223b3eb3cSopenharmony_ci } 129323b3eb3cSopenharmony_ci }, If); 129423b3eb3cSopenharmony_ci If.pop(); 129523b3eb3cSopenharmony_ci this.observeComponentCreation2((a1, b1) => { 129623b3eb3cSopenharmony_ci Column.create(); 129723b3eb3cSopenharmony_ci Column.width('100%'); 129823b3eb3cSopenharmony_ci Column.padding({ 129923b3eb3cSopenharmony_ci left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130023b3eb3cSopenharmony_ci right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130123b3eb3cSopenharmony_ci bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 130223b3eb3cSopenharmony_ci }); 130323b3eb3cSopenharmony_ci }, Column); 130423b3eb3cSopenharmony_ci this.observeComponentCreation2((y, z) => { 130523b3eb3cSopenharmony_ci Text.create(this.textEditableTitleBarDialog); 130623b3eb3cSopenharmony_ci Text.fontSize(TEXT_EDITABLE_DIALOG); 130723b3eb3cSopenharmony_ci Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 130823b3eb3cSopenharmony_ci Text.maxLines(this.maxLines); 130923b3eb3cSopenharmony_ci Text.width('100%'); 131023b3eb3cSopenharmony_ci Text.textAlign(TextAlign.Center); 131123b3eb3cSopenharmony_ci Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 131223b3eb3cSopenharmony_ci }, Text); 131323b3eb3cSopenharmony_ci Text.pop(); 131423b3eb3cSopenharmony_ci Column.pop(); 131523b3eb3cSopenharmony_ci Column.pop(); 131623b3eb3cSopenharmony_ci }); 131723b3eb3cSopenharmony_ci } 131823b3eb3cSopenharmony_ci else { 131923b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 132023b3eb3cSopenharmony_ci this.observeComponentCreation2((r, s) => { 132123b3eb3cSopenharmony_ci Column.create(); 132223b3eb3cSopenharmony_ci Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 132323b3eb3cSopenharmony_ci Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 132423b3eb3cSopenharmony_ci Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 132523b3eb3cSopenharmony_ci Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 132623b3eb3cSopenharmony_ci Column.borderRadius(({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' })); 132723b3eb3cSopenharmony_ci Column.justifyContent(FlexAlign.Center); 132823b3eb3cSopenharmony_ci }, Column); 132923b3eb3cSopenharmony_ci this.observeComponentCreation2((p, q) => { 133023b3eb3cSopenharmony_ci If.create(); 133123b3eb3cSopenharmony_ci if (this.useSymbol) { 133223b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 133323b3eb3cSopenharmony_ci this.observeComponentCreation2((d2, h2) => { 133423b3eb3cSopenharmony_ci SymbolGlyph.create(this.itemEditableDialog.value); 133523b3eb3cSopenharmony_ci SymbolGlyph.width(SYMBOL_TITLE_SIZE); 133623b3eb3cSopenharmony_ci SymbolGlyph.height(SYMBOL_TITLE_SIZE); 133723b3eb3cSopenharmony_ci SymbolGlyph.fontSize(SYMBOL_TITLE_SIZE); 133823b3eb3cSopenharmony_ci SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 133923b3eb3cSopenharmony_ci }, SymbolGlyph); 134023b3eb3cSopenharmony_ci }); 134123b3eb3cSopenharmony_ci } 134223b3eb3cSopenharmony_ci else { 134323b3eb3cSopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 134423b3eb3cSopenharmony_ci this.observeComponentCreation2((v, w) => { 134523b3eb3cSopenharmony_ci Image.create(this.itemEditableDialog.value); 134623b3eb3cSopenharmony_ci Image.width(IMAGE_SIZE); 134723b3eb3cSopenharmony_ci Image.height(IMAGE_SIZE); 134823b3eb3cSopenharmony_ci Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 134923b3eb3cSopenharmony_ci }, Image); 135023b3eb3cSopenharmony_ci }); 135123b3eb3cSopenharmony_ci } 135223b3eb3cSopenharmony_ci }, If); 135323b3eb3cSopenharmony_ci If.pop(); 135423b3eb3cSopenharmony_ci Column.pop(); 135523b3eb3cSopenharmony_ci }); 135623b3eb3cSopenharmony_ci } 135723b3eb3cSopenharmony_ci }, If); 135823b3eb3cSopenharmony_ci If.pop(); 135923b3eb3cSopenharmony_ci } 136023b3eb3cSopenharmony_ci async aboutToAppear() { 136123b3eb3cSopenharmony_ci let g = this.getUIContext().getHostContext(); 136223b3eb3cSopenharmony_ci this.mainWindowStage = g.windowStage.getMainWindowSync(); 136323b3eb3cSopenharmony_ci let h = this.mainWindowStage.getWindowProperties(); 136423b3eb3cSopenharmony_ci let i = h.windowRect; 136523b3eb3cSopenharmony_ci if (px2vp(i.height) > this.screenWidth) { 136623b3eb3cSopenharmony_ci this.maxLines = this.verticalScreenLines; 136723b3eb3cSopenharmony_ci } 136823b3eb3cSopenharmony_ci else { 136923b3eb3cSopenharmony_ci this.maxLines = this.horizontalsScreenLines; 137023b3eb3cSopenharmony_ci } 137123b3eb3cSopenharmony_ci } 137223b3eb3cSopenharmony_ci rerender() { 137323b3eb3cSopenharmony_ci this.updateDirtyElements(); 137423b3eb3cSopenharmony_ci } 137523b3eb3cSopenharmony_ci} 137623b3eb3cSopenharmony_cifunction getNumberByResource(a, b) { 137723b3eb3cSopenharmony_ci try { 137823b3eb3cSopenharmony_ci let f = resourceManager.getSystemResourceManager().getNumber(a); 137923b3eb3cSopenharmony_ci if (f === 0) { 138023b3eb3cSopenharmony_ci return b; 138123b3eb3cSopenharmony_ci } 138223b3eb3cSopenharmony_ci else { 138323b3eb3cSopenharmony_ci return f; 138423b3eb3cSopenharmony_ci } 138523b3eb3cSopenharmony_ci } 138623b3eb3cSopenharmony_ci catch (c) { 138723b3eb3cSopenharmony_ci let d = c.code; 138823b3eb3cSopenharmony_ci let e = c.message; 138923b3eb3cSopenharmony_ci hilog.error(0x3900, 'Ace', `EditableTitleBar getNumberByResource error, code: ${d},message:${e}`); 139023b3eb3cSopenharmony_ci return 0; 139123b3eb3cSopenharmony_ci } 139223b3eb3cSopenharmony_ci} 139323b3eb3cSopenharmony_ci 139423b3eb3cSopenharmony_ciexport default { 139523b3eb3cSopenharmony_ci EditableLeftIconType: EditableLeftIconType, 139623b3eb3cSopenharmony_ci EditableTitleBar: EditableTitleBar, 139723b3eb3cSopenharmony_ci};