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_ciif (PUV2ViewBase.contextStack === undefined) {
2023b3eb3cSopenharmony_ci  Reflect.set(PUV2ViewBase, 'contextStack', []);
2123b3eb3cSopenharmony_ci}
2223b3eb3cSopenharmony_ciconst KeyCode = requireNapi('multimodalInput.keyCode').KeyCode;
2323b3eb3cSopenharmony_ciconst hilog = requireNapi('hilog');
2423b3eb3cSopenharmony_ciconst PUBLIC_MORE = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_more'],
2523b3eb3cSopenharmony_ci  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
2623b3eb3cSopenharmony_ciconst PUBLIC_BACK = { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_back'],
2723b3eb3cSopenharmony_ci  'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' };
2823b3eb3cSopenharmony_ciconst TEXT_EDITABLE_DIALOG = '18.3fp';
2923b3eb3cSopenharmony_ciconst IMAGE_SIZE = '64vp';
3023b3eb3cSopenharmony_ciconst MAX_DIALOG = '256vp';
3123b3eb3cSopenharmony_ciconst MIN_DIALOG = '216vp';
3223b3eb3cSopenharmony_ci
3323b3eb3cSopenharmony_ciexport class SelectTitleBar extends ViewPU {
3423b3eb3cSopenharmony_ci  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
3523b3eb3cSopenharmony_ci    super(parent, __localStorage, elmtId, extraInfo);
3623b3eb3cSopenharmony_ci    if (typeof paramsLambda === 'function') {
3723b3eb3cSopenharmony_ci      this.paramsGenerator_ = paramsLambda;
3823b3eb3cSopenharmony_ci    }
3923b3eb3cSopenharmony_ci    this.__selected = new SynchedPropertySimpleOneWayPU(params.selected, this, 'selected');
4023b3eb3cSopenharmony_ci    this.options = [];
4123b3eb3cSopenharmony_ci    this.menuItems = [];
4223b3eb3cSopenharmony_ci    this.subtitle = '';
4323b3eb3cSopenharmony_ci    this.badgeValue = 0;
4423b3eb3cSopenharmony_ci    this.hidesBackButton = false;
4523b3eb3cSopenharmony_ci    this.onSelected = () => { };
4623b3eb3cSopenharmony_ci    this.__selectMaxWidth = new ObservedPropertySimplePU(0, this, 'selectMaxWidth');
4723b3eb3cSopenharmony_ci    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
4823b3eb3cSopenharmony_ci    this.setInitiallyProvidedValue(params);
4923b3eb3cSopenharmony_ci    this.finalizeConstruction();
5023b3eb3cSopenharmony_ci  }
5123b3eb3cSopenharmony_ci
5223b3eb3cSopenharmony_ci  setInitiallyProvidedValue(params) {
5323b3eb3cSopenharmony_ci    if (params.selected === undefined) {
5423b3eb3cSopenharmony_ci      this.__selected.set(0);
5523b3eb3cSopenharmony_ci    }
5623b3eb3cSopenharmony_ci    if (params.options !== undefined) {
5723b3eb3cSopenharmony_ci      this.options = params.options;
5823b3eb3cSopenharmony_ci    }
5923b3eb3cSopenharmony_ci    if (params.menuItems !== undefined) {
6023b3eb3cSopenharmony_ci      this.menuItems = params.menuItems;
6123b3eb3cSopenharmony_ci    }
6223b3eb3cSopenharmony_ci    if (params.subtitle !== undefined) {
6323b3eb3cSopenharmony_ci      this.subtitle = params.subtitle;
6423b3eb3cSopenharmony_ci    }
6523b3eb3cSopenharmony_ci    if (params.badgeValue !== undefined) {
6623b3eb3cSopenharmony_ci      this.badgeValue = params.badgeValue;
6723b3eb3cSopenharmony_ci    }
6823b3eb3cSopenharmony_ci    if (params.hidesBackButton !== undefined) {
6923b3eb3cSopenharmony_ci      this.hidesBackButton = params.hidesBackButton;
7023b3eb3cSopenharmony_ci    }
7123b3eb3cSopenharmony_ci    if (params.onSelected !== undefined) {
7223b3eb3cSopenharmony_ci      this.onSelected = params.onSelected;
7323b3eb3cSopenharmony_ci    }
7423b3eb3cSopenharmony_ci    if (params.selectMaxWidth !== undefined) {
7523b3eb3cSopenharmony_ci      this.selectMaxWidth = params.selectMaxWidth;
7623b3eb3cSopenharmony_ci    }
7723b3eb3cSopenharmony_ci    if (params.fontSize !== undefined) {
7823b3eb3cSopenharmony_ci      this.fontSize = params.fontSize;
7923b3eb3cSopenharmony_ci    }
8023b3eb3cSopenharmony_ci  }
8123b3eb3cSopenharmony_ci
8223b3eb3cSopenharmony_ci  updateStateVars(params) {
8323b3eb3cSopenharmony_ci    this.__selected.reset(params.selected);
8423b3eb3cSopenharmony_ci  }
8523b3eb3cSopenharmony_ci
8623b3eb3cSopenharmony_ci  purgeVariableDependenciesOnElmtId(rmElmtId) {
8723b3eb3cSopenharmony_ci    this.__selected.purgeDependencyOnElmtId(rmElmtId);
8823b3eb3cSopenharmony_ci    this.__selectMaxWidth.purgeDependencyOnElmtId(rmElmtId);
8923b3eb3cSopenharmony_ci    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
9023b3eb3cSopenharmony_ci  }
9123b3eb3cSopenharmony_ci
9223b3eb3cSopenharmony_ci  aboutToBeDeleted() {
9323b3eb3cSopenharmony_ci    this.__selected.aboutToBeDeleted();
9423b3eb3cSopenharmony_ci    this.__selectMaxWidth.aboutToBeDeleted();
9523b3eb3cSopenharmony_ci    this.__fontSize.aboutToBeDeleted();
9623b3eb3cSopenharmony_ci    SubscriberManager.Get().delete(this.id__());
9723b3eb3cSopenharmony_ci    this.aboutToBeDeletedInternal();
9823b3eb3cSopenharmony_ci  }
9923b3eb3cSopenharmony_ci
10023b3eb3cSopenharmony_ci  get selected() {
10123b3eb3cSopenharmony_ci    return this.__selected.get();
10223b3eb3cSopenharmony_ci  }
10323b3eb3cSopenharmony_ci
10423b3eb3cSopenharmony_ci  set selected(newValue) {
10523b3eb3cSopenharmony_ci    this.__selected.set(newValue);
10623b3eb3cSopenharmony_ci  }
10723b3eb3cSopenharmony_ci
10823b3eb3cSopenharmony_ci  get selectMaxWidth() {
10923b3eb3cSopenharmony_ci    return this.__selectMaxWidth.get();
11023b3eb3cSopenharmony_ci  }
11123b3eb3cSopenharmony_ci
11223b3eb3cSopenharmony_ci  set selectMaxWidth(newValue) {
11323b3eb3cSopenharmony_ci    this.__selectMaxWidth.set(newValue);
11423b3eb3cSopenharmony_ci  }
11523b3eb3cSopenharmony_ci
11623b3eb3cSopenharmony_ci  get fontSize() {
11723b3eb3cSopenharmony_ci    return this.__fontSize.get();
11823b3eb3cSopenharmony_ci  }
11923b3eb3cSopenharmony_ci
12023b3eb3cSopenharmony_ci  set fontSize(newValue) {
12123b3eb3cSopenharmony_ci    this.__fontSize.set(newValue);
12223b3eb3cSopenharmony_ci  }
12323b3eb3cSopenharmony_ci
12423b3eb3cSopenharmony_ci  initialRender() {
12523b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
12623b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
12723b3eb3cSopenharmony_ci      Flex.create({
12823b3eb3cSopenharmony_ci        justifyContent: FlexAlign.SpaceBetween,
12923b3eb3cSopenharmony_ci        alignItems: ItemAlign.Stretch
13023b3eb3cSopenharmony_ci      });
13123b3eb3cSopenharmony_ci      Flex.width('100%');
13223b3eb3cSopenharmony_ci      Flex.height(SelectTitleBar.totalHeight);
13323b3eb3cSopenharmony_ci      Flex.backgroundColor({
13423b3eb3cSopenharmony_ci        'id': -1,
13523b3eb3cSopenharmony_ci        'type': 10001,
13623b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_background'],
13723b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
13823b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
13923b3eb3cSopenharmony_ci      });
14023b3eb3cSopenharmony_ci      Flex.onAreaChange((_oldValue, newValue) => {
14123b3eb3cSopenharmony_ci        let newWidth = Number(newValue.width);
14223b3eb3cSopenharmony_ci        if (!this.hidesBackButton) {
14323b3eb3cSopenharmony_ci          newWidth -= ImageMenuItem.imageHotZoneWidth;
14423b3eb3cSopenharmony_ci          newWidth += SelectTitleBar.leftPadding;
14523b3eb3cSopenharmony_ci          newWidth -= SelectTitleBar.leftPaddingWithBack;
14623b3eb3cSopenharmony_ci        }
14723b3eb3cSopenharmony_ci        if (this.menuItems !== undefined) {
14823b3eb3cSopenharmony_ci          let menusLength = this.menuItems.length;
14923b3eb3cSopenharmony_ci          if (menusLength >= CollapsibleMenuSection.maxCountOfVisibleItems) {
15023b3eb3cSopenharmony_ci            newWidth -= ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems;
15123b3eb3cSopenharmony_ci          } else if (menusLength > 0) {
15223b3eb3cSopenharmony_ci            newWidth -= ImageMenuItem.imageHotZoneWidth * menusLength;
15323b3eb3cSopenharmony_ci          }
15423b3eb3cSopenharmony_ci        }
15523b3eb3cSopenharmony_ci        if (this.badgeValue) {
15623b3eb3cSopenharmony_ci          this.selectMaxWidth = newWidth - SelectTitleBar.badgeSize - SelectTitleBar.leftPadding -
15723b3eb3cSopenharmony_ci          SelectTitleBar.rightPadding - SelectTitleBar.badgePadding;
15823b3eb3cSopenharmony_ci        } else {
15923b3eb3cSopenharmony_ci          this.selectMaxWidth = newWidth - SelectTitleBar.leftPadding - SelectTitleBar.rightPadding;
16023b3eb3cSopenharmony_ci        }
16123b3eb3cSopenharmony_ci      });
16223b3eb3cSopenharmony_ci    }, Flex);
16323b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
16423b3eb3cSopenharmony_ci      Row.create();
16523b3eb3cSopenharmony_ci      Row.margin({
16623b3eb3cSopenharmony_ci        left: this.hidesBackButton ? {
16723b3eb3cSopenharmony_ci          'id': -1,
16823b3eb3cSopenharmony_ci          'type': 10002,
16923b3eb3cSopenharmony_ci          params: ['sys.float.ohos_id_max_padding_start'],
17023b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
17123b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
17223b3eb3cSopenharmony_ci        } : {
17323b3eb3cSopenharmony_ci          'id': -1,
17423b3eb3cSopenharmony_ci          'type': 10002,
17523b3eb3cSopenharmony_ci          params: ['sys.float.ohos_id_default_padding_start'],
17623b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
17723b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
17823b3eb3cSopenharmony_ci        }
17923b3eb3cSopenharmony_ci      });
18023b3eb3cSopenharmony_ci    }, Row);
18123b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
18223b3eb3cSopenharmony_ci      If.create();
18323b3eb3cSopenharmony_ci      if (!this.hidesBackButton) {
18423b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
18523b3eb3cSopenharmony_ci          {
18623b3eb3cSopenharmony_ci            this.observeComponentCreation2((elmtId, isInitialRender) => {
18723b3eb3cSopenharmony_ci              if (isInitialRender) {
18823b3eb3cSopenharmony_ci                let componentCall = new ImageMenuItem(this, { item: {
18923b3eb3cSopenharmony_ci                  value: PUBLIC_BACK,
19023b3eb3cSopenharmony_ci                  isEnabled: true,
19123b3eb3cSopenharmony_ci                  action: () => this.getUIContext()?.getRouter()?.back()
19223b3eb3cSopenharmony_ci                }, index: -1 }, undefined, elmtId, () => {
19323b3eb3cSopenharmony_ci                }, {
19423b3eb3cSopenharmony_ci                  page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets',
19523b3eb3cSopenharmony_ci                  line: 71,
19623b3eb3cSopenharmony_ci                  col: 11
19723b3eb3cSopenharmony_ci                });
19823b3eb3cSopenharmony_ci                ViewPU.create(componentCall);
19923b3eb3cSopenharmony_ci                let paramsLambda = () => {
20023b3eb3cSopenharmony_ci                  return {
20123b3eb3cSopenharmony_ci                    item: {
20223b3eb3cSopenharmony_ci                      value: PUBLIC_BACK,
20323b3eb3cSopenharmony_ci                      isEnabled: true,
20423b3eb3cSopenharmony_ci                      action: () => this.getUIContext()?.getRouter()?.back()
20523b3eb3cSopenharmony_ci                    },
20623b3eb3cSopenharmony_ci                    index: -1
20723b3eb3cSopenharmony_ci                  };
20823b3eb3cSopenharmony_ci                };
20923b3eb3cSopenharmony_ci                componentCall.paramsGenerator_ = paramsLambda;
21023b3eb3cSopenharmony_ci              } else {
21123b3eb3cSopenharmony_ci                this.updateStateVarsOfChildByElmtId(elmtId, {});
21223b3eb3cSopenharmony_ci              }
21323b3eb3cSopenharmony_ci            }, { name: 'ImageMenuItem' });
21423b3eb3cSopenharmony_ci          }
21523b3eb3cSopenharmony_ci        });
21623b3eb3cSopenharmony_ci      } else {
21723b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
21823b3eb3cSopenharmony_ci        });
21923b3eb3cSopenharmony_ci      }
22023b3eb3cSopenharmony_ci    }, If);
22123b3eb3cSopenharmony_ci    If.pop();
22223b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
22323b3eb3cSopenharmony_ci      Column.create();
22423b3eb3cSopenharmony_ci      Column.justifyContent(FlexAlign.Start);
22523b3eb3cSopenharmony_ci      Column.alignItems(HorizontalAlign.Start);
22623b3eb3cSopenharmony_ci      Column.constraintSize({ maxWidth: this.selectMaxWidth });
22723b3eb3cSopenharmony_ci    }, Column);
22823b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
22923b3eb3cSopenharmony_ci      If.create();
23023b3eb3cSopenharmony_ci      if (this.badgeValue) {
23123b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
23223b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
23323b3eb3cSopenharmony_ci            Badge.create({
23423b3eb3cSopenharmony_ci              count: this.badgeValue,
23523b3eb3cSopenharmony_ci              position: BadgePosition.Right,
23623b3eb3cSopenharmony_ci              style: {
23723b3eb3cSopenharmony_ci                badgeSize: SelectTitleBar.badgeSize,
23823b3eb3cSopenharmony_ci                badgeColor: {
23923b3eb3cSopenharmony_ci                  'id': -1,
24023b3eb3cSopenharmony_ci                  'type': 10001,
24123b3eb3cSopenharmony_ci                  params: ['sys.color.ohos_id_color_emphasize'],
24223b3eb3cSopenharmony_ci                  'bundleName': '__harDefaultBundleName__',
24323b3eb3cSopenharmony_ci                  'moduleName': '__harDefaultModuleName__'
24423b3eb3cSopenharmony_ci                },
24523b3eb3cSopenharmony_ci                borderColor: {
24623b3eb3cSopenharmony_ci                  'id': -1,
24723b3eb3cSopenharmony_ci                  'type': 10001,
24823b3eb3cSopenharmony_ci                  params: ['sys.color.ohos_id_color_emphasize'],
24923b3eb3cSopenharmony_ci                  'bundleName': '__harDefaultBundleName__',
25023b3eb3cSopenharmony_ci                  'moduleName': '__harDefaultModuleName__'
25123b3eb3cSopenharmony_ci                },
25223b3eb3cSopenharmony_ci                borderWidth: 0
25323b3eb3cSopenharmony_ci              }
25423b3eb3cSopenharmony_ci            });
25523b3eb3cSopenharmony_ci          }, Badge);
25623b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
25723b3eb3cSopenharmony_ci            Row.create();
25823b3eb3cSopenharmony_ci            Row.justifyContent(FlexAlign.Start);
25923b3eb3cSopenharmony_ci            Row.margin({
26023b3eb3cSopenharmony_ci              right: {
26123b3eb3cSopenharmony_ci                'id': -1,
26223b3eb3cSopenharmony_ci                'type': 10002,
26323b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_elements_margin_horizontal_l'],
26423b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
26523b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
26623b3eb3cSopenharmony_ci              }
26723b3eb3cSopenharmony_ci            });
26823b3eb3cSopenharmony_ci          }, Row);
26923b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
27023b3eb3cSopenharmony_ci            Select.create(this.options);
27123b3eb3cSopenharmony_ci            Select.selected(this.selected);
27223b3eb3cSopenharmony_ci            Select.value(this.selected >= 0 && this.selected < this.options.length ?
27323b3eb3cSopenharmony_ci              this.options[this.selected].value : '');
27423b3eb3cSopenharmony_ci            Select.font({ size: this.hidesBackButton && !this.subtitle
27523b3eb3cSopenharmony_ci              ? {
27623b3eb3cSopenharmony_ci                'id': -1,
27723b3eb3cSopenharmony_ci                'type': 10002,
27823b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_text_size_headline7'],
27923b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
28023b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
28123b3eb3cSopenharmony_ci              } : {
28223b3eb3cSopenharmony_ci                'id': -1,
28323b3eb3cSopenharmony_ci                'type': 10002,
28423b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_text_size_headline8'],
28523b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
28623b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
28723b3eb3cSopenharmony_ci              } });
28823b3eb3cSopenharmony_ci            Select.fontColor({
28923b3eb3cSopenharmony_ci              'id': -1,
29023b3eb3cSopenharmony_ci              'type': 10001,
29123b3eb3cSopenharmony_ci              params: ['sys.color.ohos_id_color_titlebar_text'],
29223b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
29323b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
29423b3eb3cSopenharmony_ci            });
29523b3eb3cSopenharmony_ci            Select.backgroundColor(Color.Transparent);
29623b3eb3cSopenharmony_ci            Select.onSelect(this.onSelected);
29723b3eb3cSopenharmony_ci            Select.constraintSize({ maxWidth: this.selectMaxWidth });
29823b3eb3cSopenharmony_ci            Select.offset({ x: -4 });
29923b3eb3cSopenharmony_ci          }, Select);
30023b3eb3cSopenharmony_ci          Select.pop();
30123b3eb3cSopenharmony_ci          Row.pop();
30223b3eb3cSopenharmony_ci          Badge.pop();
30323b3eb3cSopenharmony_ci        });
30423b3eb3cSopenharmony_ci      } else {
30523b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
30623b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
30723b3eb3cSopenharmony_ci            Row.create();
30823b3eb3cSopenharmony_ci            Row.justifyContent(FlexAlign.Start);
30923b3eb3cSopenharmony_ci          }, Row);
31023b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
31123b3eb3cSopenharmony_ci            Select.create(this.options);
31223b3eb3cSopenharmony_ci            Select.selected(this.selected);
31323b3eb3cSopenharmony_ci            Select.value(this.selected >= 0 && this.selected < this.options.length ?
31423b3eb3cSopenharmony_ci              this.options[this.selected].value : '');
31523b3eb3cSopenharmony_ci            Select.font({ size: this.hidesBackButton && !this.subtitle ?
31623b3eb3cSopenharmony_ci              {
31723b3eb3cSopenharmony_ci                'id': -1,
31823b3eb3cSopenharmony_ci                'type': 10002,
31923b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_text_size_headline7'],
32023b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
32123b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
32223b3eb3cSopenharmony_ci              } : {
32323b3eb3cSopenharmony_ci                'id': -1,
32423b3eb3cSopenharmony_ci                'type': 10002,
32523b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_text_size_headline8'],
32623b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
32723b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
32823b3eb3cSopenharmony_ci              } });
32923b3eb3cSopenharmony_ci            Select.fontColor({
33023b3eb3cSopenharmony_ci              'id': -1,
33123b3eb3cSopenharmony_ci              'type': 10001,
33223b3eb3cSopenharmony_ci              params: ['sys.color.ohos_id_color_titlebar_text'],
33323b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
33423b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
33523b3eb3cSopenharmony_ci            });
33623b3eb3cSopenharmony_ci            Select.backgroundColor(Color.Transparent);
33723b3eb3cSopenharmony_ci            Select.onSelect(this.onSelected);
33823b3eb3cSopenharmony_ci            Select.constraintSize({ maxWidth: this.selectMaxWidth });
33923b3eb3cSopenharmony_ci            Select.offset({ x: -4 });
34023b3eb3cSopenharmony_ci          }, Select);
34123b3eb3cSopenharmony_ci          Select.pop();
34223b3eb3cSopenharmony_ci          Row.pop();
34323b3eb3cSopenharmony_ci        });
34423b3eb3cSopenharmony_ci      }
34523b3eb3cSopenharmony_ci    }, If);
34623b3eb3cSopenharmony_ci    If.pop();
34723b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
34823b3eb3cSopenharmony_ci      If.create();
34923b3eb3cSopenharmony_ci      if (this.subtitle !== undefined) {
35023b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
35123b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
35223b3eb3cSopenharmony_ci            Row.create();
35323b3eb3cSopenharmony_ci            Row.justifyContent(FlexAlign.Start);
35423b3eb3cSopenharmony_ci            Row.margin({ left: SelectTitleBar.subtitleLeftPadding });
35523b3eb3cSopenharmony_ci          }, Row);
35623b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
35723b3eb3cSopenharmony_ci            Text.create(this.subtitle);
35823b3eb3cSopenharmony_ci            Text.fontSize({
35923b3eb3cSopenharmony_ci              'id': -1,
36023b3eb3cSopenharmony_ci              'type': 10002,
36123b3eb3cSopenharmony_ci              params: ['sys.float.ohos_id_text_size_over_line'],
36223b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
36323b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
36423b3eb3cSopenharmony_ci            });
36523b3eb3cSopenharmony_ci            Text.fontColor({
36623b3eb3cSopenharmony_ci              'id': -1,
36723b3eb3cSopenharmony_ci              'type': 10001,
36823b3eb3cSopenharmony_ci              params: ['sys.color.ohos_id_color_titlebar_subtitle_text'],
36923b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
37023b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
37123b3eb3cSopenharmony_ci            });
37223b3eb3cSopenharmony_ci            Text.maxLines(1);
37323b3eb3cSopenharmony_ci            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
37423b3eb3cSopenharmony_ci            Text.constraintSize({ maxWidth: this.selectMaxWidth });
37523b3eb3cSopenharmony_ci            Text.offset({ y: -4 });
37623b3eb3cSopenharmony_ci          }, Text);
37723b3eb3cSopenharmony_ci          Text.pop();
37823b3eb3cSopenharmony_ci          Row.pop();
37923b3eb3cSopenharmony_ci        });
38023b3eb3cSopenharmony_ci      } else {
38123b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
38223b3eb3cSopenharmony_ci        });
38323b3eb3cSopenharmony_ci      }
38423b3eb3cSopenharmony_ci    }, If);
38523b3eb3cSopenharmony_ci    If.pop();
38623b3eb3cSopenharmony_ci    Column.pop();
38723b3eb3cSopenharmony_ci    Row.pop();
38823b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
38923b3eb3cSopenharmony_ci      If.create();
39023b3eb3cSopenharmony_ci      if (this.menuItems !== undefined && this.menuItems.length > 0) {
39123b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
39223b3eb3cSopenharmony_ci          {
39323b3eb3cSopenharmony_ci            this.observeComponentCreation2((elmtId, isInitialRender) => {
39423b3eb3cSopenharmony_ci              if (isInitialRender) {
39523b3eb3cSopenharmony_ci                let componentCall = new CollapsibleMenuSection(this, {
39623b3eb3cSopenharmony_ci                  menuItems: this.menuItems,
39723b3eb3cSopenharmony_ci                  index: 1 + SelectTitleBar.instanceCount++
39823b3eb3cSopenharmony_ci                }, undefined, elmtId, () => {
39923b3eb3cSopenharmony_ci                }, {
40023b3eb3cSopenharmony_ci                  page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets',
40123b3eb3cSopenharmony_ci                  line: 146,
40223b3eb3cSopenharmony_ci                  col: 9
40323b3eb3cSopenharmony_ci                });
40423b3eb3cSopenharmony_ci                ViewPU.create(componentCall);
40523b3eb3cSopenharmony_ci                let paramsLambda = () => {
40623b3eb3cSopenharmony_ci                  return {
40723b3eb3cSopenharmony_ci                    menuItems: this.menuItems,
40823b3eb3cSopenharmony_ci                    index: 1 + SelectTitleBar.instanceCount++
40923b3eb3cSopenharmony_ci                  };
41023b3eb3cSopenharmony_ci                };
41123b3eb3cSopenharmony_ci                componentCall.paramsGenerator_ = paramsLambda;
41223b3eb3cSopenharmony_ci              } else {
41323b3eb3cSopenharmony_ci                this.updateStateVarsOfChildByElmtId(elmtId, {});
41423b3eb3cSopenharmony_ci              }
41523b3eb3cSopenharmony_ci            }, { name: 'CollapsibleMenuSection' });
41623b3eb3cSopenharmony_ci          }
41723b3eb3cSopenharmony_ci        });
41823b3eb3cSopenharmony_ci      } else {
41923b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
42023b3eb3cSopenharmony_ci        });
42123b3eb3cSopenharmony_ci      }
42223b3eb3cSopenharmony_ci    }, If);
42323b3eb3cSopenharmony_ci    If.pop();
42423b3eb3cSopenharmony_ci    Flex.pop();
42523b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
42623b3eb3cSopenharmony_ci  }
42723b3eb3cSopenharmony_ci
42823b3eb3cSopenharmony_ci  rerender() {
42923b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
43023b3eb3cSopenharmony_ci    this.updateDirtyElements();
43123b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
43223b3eb3cSopenharmony_ci  }
43323b3eb3cSopenharmony_ci}
43423b3eb3cSopenharmony_ciSelectTitleBar.badgeSize = 16;
43523b3eb3cSopenharmony_ciSelectTitleBar.totalHeight = 56;
43623b3eb3cSopenharmony_ciSelectTitleBar.leftPadding = 24;
43723b3eb3cSopenharmony_ciSelectTitleBar.leftPaddingWithBack = 12;
43823b3eb3cSopenharmony_ciSelectTitleBar.rightPadding = 24;
43923b3eb3cSopenharmony_ciSelectTitleBar.badgePadding = 16;
44023b3eb3cSopenharmony_ciSelectTitleBar.subtitleLeftPadding = 4;
44123b3eb3cSopenharmony_ciSelectTitleBar.instanceCount = 0;
44223b3eb3cSopenharmony_ci
44323b3eb3cSopenharmony_ciclass CollapsibleMenuSection extends ViewPU {
44423b3eb3cSopenharmony_ci  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
44523b3eb3cSopenharmony_ci    super(parent, __localStorage, elmtId, extraInfo);
44623b3eb3cSopenharmony_ci    if (typeof paramsLambda === 'function') {
44723b3eb3cSopenharmony_ci      this.paramsGenerator_ = paramsLambda;
44823b3eb3cSopenharmony_ci    }
44923b3eb3cSopenharmony_ci    this.menuItems = [];
45023b3eb3cSopenharmony_ci    this.item = {
45123b3eb3cSopenharmony_ci      value: PUBLIC_MORE,
45223b3eb3cSopenharmony_ci      label: {
45323b3eb3cSopenharmony_ci        'id': -1,
45423b3eb3cSopenharmony_ci        'type': 10003,
45523b3eb3cSopenharmony_ci        params: ['sys.string.ohos_toolbar_more'],
45623b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
45723b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
45823b3eb3cSopenharmony_ci      },
45923b3eb3cSopenharmony_ci    };
46023b3eb3cSopenharmony_ci    this.index = 0;
46123b3eb3cSopenharmony_ci    this.longPressTime = 500;
46223b3eb3cSopenharmony_ci    this.minFontSize = 1.75;
46323b3eb3cSopenharmony_ci    this.isFollowingSystemFontScale = false;
46423b3eb3cSopenharmony_ci    this.maxFontScale = 1;
46523b3eb3cSopenharmony_ci    this.systemFontScale = 1;
46623b3eb3cSopenharmony_ci    this.firstFocusableIndex = -1;
46723b3eb3cSopenharmony_ci    this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown');
46823b3eb3cSopenharmony_ci    this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus');
46923b3eb3cSopenharmony_ci    this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover');
47023b3eb3cSopenharmony_ci    this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick');
47123b3eb3cSopenharmony_ci    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
47223b3eb3cSopenharmony_ci    this.dialogController = new CustomDialogController({
47323b3eb3cSopenharmony_ci      builder: () => {
47423b3eb3cSopenharmony_ci        let jsDialog = new SelectTitleBarDialog(this, {
47523b3eb3cSopenharmony_ci          cancel: () => {
47623b3eb3cSopenharmony_ci          },
47723b3eb3cSopenharmony_ci          confirm: () => {
47823b3eb3cSopenharmony_ci          },
47923b3eb3cSopenharmony_ci          selectTitleDialog: this.item,
48023b3eb3cSopenharmony_ci          selectTitleBarDialog: this.item.label ? this.item.label : '',
48123b3eb3cSopenharmony_ci          fontSize: this.fontSize,
48223b3eb3cSopenharmony_ci        }, undefined, -1, () => {
48323b3eb3cSopenharmony_ci        }, { page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets', line: 204, col: 14 });
48423b3eb3cSopenharmony_ci        jsDialog.setController(this.dialogController);
48523b3eb3cSopenharmony_ci        ViewPU.create(jsDialog);
48623b3eb3cSopenharmony_ci        let paramsLambda = () => {
48723b3eb3cSopenharmony_ci          return {
48823b3eb3cSopenharmony_ci            cancel: () => {
48923b3eb3cSopenharmony_ci            },
49023b3eb3cSopenharmony_ci            confirm: () => {
49123b3eb3cSopenharmony_ci            },
49223b3eb3cSopenharmony_ci            selectTitleDialog: this.item,
49323b3eb3cSopenharmony_ci            selectTitleBarDialog: this.item.label ? this.item.label : '',
49423b3eb3cSopenharmony_ci            fontSize: this.fontSize
49523b3eb3cSopenharmony_ci          };
49623b3eb3cSopenharmony_ci        };
49723b3eb3cSopenharmony_ci        jsDialog.paramsGenerator_ = paramsLambda;
49823b3eb3cSopenharmony_ci      },
49923b3eb3cSopenharmony_ci      maskColor: Color.Transparent,
50023b3eb3cSopenharmony_ci      isModal: true,
50123b3eb3cSopenharmony_ci      customStyle: true
50223b3eb3cSopenharmony_ci    }, this);
50323b3eb3cSopenharmony_ci    this.setInitiallyProvidedValue(params);
50423b3eb3cSopenharmony_ci    this.finalizeConstruction();
50523b3eb3cSopenharmony_ci  }
50623b3eb3cSopenharmony_ci
50723b3eb3cSopenharmony_ci  setInitiallyProvidedValue(params) {
50823b3eb3cSopenharmony_ci    if (params.menuItems !== undefined) {
50923b3eb3cSopenharmony_ci      this.menuItems = params.menuItems;
51023b3eb3cSopenharmony_ci    }
51123b3eb3cSopenharmony_ci    if (params.item !== undefined) {
51223b3eb3cSopenharmony_ci      this.item = params.item;
51323b3eb3cSopenharmony_ci    }
51423b3eb3cSopenharmony_ci    if (params.index !== undefined) {
51523b3eb3cSopenharmony_ci      this.index = params.index;
51623b3eb3cSopenharmony_ci    }
51723b3eb3cSopenharmony_ci    if (params.longPressTime !== undefined) {
51823b3eb3cSopenharmony_ci      this.longPressTime = params.longPressTime;
51923b3eb3cSopenharmony_ci    }
52023b3eb3cSopenharmony_ci    if (params.minFontSize !== undefined) {
52123b3eb3cSopenharmony_ci      this.minFontSize = params.minFontSize;
52223b3eb3cSopenharmony_ci    }
52323b3eb3cSopenharmony_ci    if (params.isFollowingSystemFontScale !== undefined) {
52423b3eb3cSopenharmony_ci      this.isFollowingSystemFontScale = params.isFollowingSystemFontScale;
52523b3eb3cSopenharmony_ci    }
52623b3eb3cSopenharmony_ci    if (params.maxFontScale !== undefined) {
52723b3eb3cSopenharmony_ci      this.maxFontScale = params.maxFontScale;
52823b3eb3cSopenharmony_ci    }
52923b3eb3cSopenharmony_ci    if (params.systemFontScale !== undefined) {
53023b3eb3cSopenharmony_ci      this.systemFontScale = params.systemFontScale;
53123b3eb3cSopenharmony_ci    }
53223b3eb3cSopenharmony_ci    if (params.firstFocusableIndex !== undefined) {
53323b3eb3cSopenharmony_ci      this.firstFocusableIndex = params.firstFocusableIndex;
53423b3eb3cSopenharmony_ci    }
53523b3eb3cSopenharmony_ci    if (params.isPopupShown !== undefined) {
53623b3eb3cSopenharmony_ci      this.isPopupShown = params.isPopupShown;
53723b3eb3cSopenharmony_ci    }
53823b3eb3cSopenharmony_ci    if (params.isMoreIconOnFocus !== undefined) {
53923b3eb3cSopenharmony_ci      this.isMoreIconOnFocus = params.isMoreIconOnFocus;
54023b3eb3cSopenharmony_ci    }
54123b3eb3cSopenharmony_ci    if (params.isMoreIconOnHover !== undefined) {
54223b3eb3cSopenharmony_ci      this.isMoreIconOnHover = params.isMoreIconOnHover;
54323b3eb3cSopenharmony_ci    }
54423b3eb3cSopenharmony_ci    if (params.isMoreIconOnClick !== undefined) {
54523b3eb3cSopenharmony_ci      this.isMoreIconOnClick = params.isMoreIconOnClick;
54623b3eb3cSopenharmony_ci    }
54723b3eb3cSopenharmony_ci    if (params.fontSize !== undefined) {
54823b3eb3cSopenharmony_ci      this.fontSize = params.fontSize;
54923b3eb3cSopenharmony_ci    }
55023b3eb3cSopenharmony_ci    if (params.dialogController !== undefined) {
55123b3eb3cSopenharmony_ci      this.dialogController = params.dialogController;
55223b3eb3cSopenharmony_ci    }
55323b3eb3cSopenharmony_ci  }
55423b3eb3cSopenharmony_ci
55523b3eb3cSopenharmony_ci  updateStateVars(params) {
55623b3eb3cSopenharmony_ci  }
55723b3eb3cSopenharmony_ci
55823b3eb3cSopenharmony_ci  purgeVariableDependenciesOnElmtId(rmElmtId) {
55923b3eb3cSopenharmony_ci    this.__isPopupShown.purgeDependencyOnElmtId(rmElmtId);
56023b3eb3cSopenharmony_ci    this.__isMoreIconOnFocus.purgeDependencyOnElmtId(rmElmtId);
56123b3eb3cSopenharmony_ci    this.__isMoreIconOnHover.purgeDependencyOnElmtId(rmElmtId);
56223b3eb3cSopenharmony_ci    this.__isMoreIconOnClick.purgeDependencyOnElmtId(rmElmtId);
56323b3eb3cSopenharmony_ci    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
56423b3eb3cSopenharmony_ci  }
56523b3eb3cSopenharmony_ci
56623b3eb3cSopenharmony_ci  aboutToBeDeleted() {
56723b3eb3cSopenharmony_ci    this.__isPopupShown.aboutToBeDeleted();
56823b3eb3cSopenharmony_ci    this.__isMoreIconOnFocus.aboutToBeDeleted();
56923b3eb3cSopenharmony_ci    this.__isMoreIconOnHover.aboutToBeDeleted();
57023b3eb3cSopenharmony_ci    this.__isMoreIconOnClick.aboutToBeDeleted();
57123b3eb3cSopenharmony_ci    this.__fontSize.aboutToBeDeleted();
57223b3eb3cSopenharmony_ci    SubscriberManager.Get().delete(this.id__());
57323b3eb3cSopenharmony_ci    this.aboutToBeDeletedInternal();
57423b3eb3cSopenharmony_ci  }
57523b3eb3cSopenharmony_ci
57623b3eb3cSopenharmony_ci  get isPopupShown() {
57723b3eb3cSopenharmony_ci    return this.__isPopupShown.get();
57823b3eb3cSopenharmony_ci  }
57923b3eb3cSopenharmony_ci
58023b3eb3cSopenharmony_ci  set isPopupShown(newValue) {
58123b3eb3cSopenharmony_ci    this.__isPopupShown.set(newValue);
58223b3eb3cSopenharmony_ci  }
58323b3eb3cSopenharmony_ci
58423b3eb3cSopenharmony_ci  get isMoreIconOnFocus() {
58523b3eb3cSopenharmony_ci    return this.__isMoreIconOnFocus.get();
58623b3eb3cSopenharmony_ci  }
58723b3eb3cSopenharmony_ci
58823b3eb3cSopenharmony_ci  set isMoreIconOnFocus(newValue) {
58923b3eb3cSopenharmony_ci    this.__isMoreIconOnFocus.set(newValue);
59023b3eb3cSopenharmony_ci  }
59123b3eb3cSopenharmony_ci
59223b3eb3cSopenharmony_ci  get isMoreIconOnHover() {
59323b3eb3cSopenharmony_ci    return this.__isMoreIconOnHover.get();
59423b3eb3cSopenharmony_ci  }
59523b3eb3cSopenharmony_ci
59623b3eb3cSopenharmony_ci  set isMoreIconOnHover(newValue) {
59723b3eb3cSopenharmony_ci    this.__isMoreIconOnHover.set(newValue);
59823b3eb3cSopenharmony_ci  }
59923b3eb3cSopenharmony_ci
60023b3eb3cSopenharmony_ci  get isMoreIconOnClick() {
60123b3eb3cSopenharmony_ci    return this.__isMoreIconOnClick.get();
60223b3eb3cSopenharmony_ci  }
60323b3eb3cSopenharmony_ci
60423b3eb3cSopenharmony_ci  set isMoreIconOnClick(newValue) {
60523b3eb3cSopenharmony_ci    this.__isMoreIconOnClick.set(newValue);
60623b3eb3cSopenharmony_ci  }
60723b3eb3cSopenharmony_ci
60823b3eb3cSopenharmony_ci  get fontSize() {
60923b3eb3cSopenharmony_ci    return this.__fontSize.get();
61023b3eb3cSopenharmony_ci  }
61123b3eb3cSopenharmony_ci
61223b3eb3cSopenharmony_ci  set fontSize(newValue) {
61323b3eb3cSopenharmony_ci    this.__fontSize.set(newValue);
61423b3eb3cSopenharmony_ci  }
61523b3eb3cSopenharmony_ci
61623b3eb3cSopenharmony_ci  getMoreIconFgColor() {
61723b3eb3cSopenharmony_ci    return this.isMoreIconOnClick ?
61823b3eb3cSopenharmony_ci      {
61923b3eb3cSopenharmony_ci        'id': -1,
62023b3eb3cSopenharmony_ci        'type': 10001,
62123b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_titlebar_icon_pressed'],
62223b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
62323b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
62423b3eb3cSopenharmony_ci      } : {
62523b3eb3cSopenharmony_ci        'id': -1,
62623b3eb3cSopenharmony_ci        'type': 10001,
62723b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_titlebar_icon'],
62823b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
62923b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
63023b3eb3cSopenharmony_ci      };
63123b3eb3cSopenharmony_ci  }
63223b3eb3cSopenharmony_ci
63323b3eb3cSopenharmony_ci  getMoreIconBgColor() {
63423b3eb3cSopenharmony_ci    if (this.isMoreIconOnClick) {
63523b3eb3cSopenharmony_ci      return {
63623b3eb3cSopenharmony_ci        'id': -1,
63723b3eb3cSopenharmony_ci        'type': 10001,
63823b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_click_effect'],
63923b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
64023b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
64123b3eb3cSopenharmony_ci      };
64223b3eb3cSopenharmony_ci    } else if (this.isMoreIconOnHover) {
64323b3eb3cSopenharmony_ci      return {
64423b3eb3cSopenharmony_ci        'id': -1,
64523b3eb3cSopenharmony_ci        'type': 10001,
64623b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_hover'],
64723b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
64823b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
64923b3eb3cSopenharmony_ci      };
65023b3eb3cSopenharmony_ci    } else {
65123b3eb3cSopenharmony_ci      return Color.Transparent;
65223b3eb3cSopenharmony_ci    }
65323b3eb3cSopenharmony_ci  }
65423b3eb3cSopenharmony_ci
65523b3eb3cSopenharmony_ci  aboutToAppear() {
65623b3eb3cSopenharmony_ci    try {
65723b3eb3cSopenharmony_ci      let uiContent = this.getUIContext();
65823b3eb3cSopenharmony_ci      this.isFollowingSystemFontScale = uiContent.isFollowingSystemFontScale();
65923b3eb3cSopenharmony_ci      this.maxFontScale = uiContent.getMaxFontScale();
66023b3eb3cSopenharmony_ci    } catch (exception) {
66123b3eb3cSopenharmony_ci      let code = exception.code;
66223b3eb3cSopenharmony_ci      let message = exception.message;
66323b3eb3cSopenharmony_ci      hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${code}, message: ${message}`);
66423b3eb3cSopenharmony_ci    }
66523b3eb3cSopenharmony_ci    this.menuItems.forEach((item, index) => {
66623b3eb3cSopenharmony_ci      if (item.isEnabled && this.firstFocusableIndex == -1 &&
66723b3eb3cSopenharmony_ci        index > CollapsibleMenuSection.maxCountOfVisibleItems - 2) {
66823b3eb3cSopenharmony_ci        this.firstFocusableIndex = this.index * 1000 + index + 1;
66923b3eb3cSopenharmony_ci      }
67023b3eb3cSopenharmony_ci    });
67123b3eb3cSopenharmony_ci  }
67223b3eb3cSopenharmony_ci
67323b3eb3cSopenharmony_ci  decideFontScale() {
67423b3eb3cSopenharmony_ci    let uiContent = this.getUIContext();
67523b3eb3cSopenharmony_ci    this.systemFontScale = uiContent.getHostContext()?.config?.fontSizeScale ?? 1;
67623b3eb3cSopenharmony_ci    if (!this.isFollowingSystemFontScale) {
67723b3eb3cSopenharmony_ci      return 1;
67823b3eb3cSopenharmony_ci    }
67923b3eb3cSopenharmony_ci    return Math.min(this.systemFontScale, this.maxFontScale);
68023b3eb3cSopenharmony_ci  }
68123b3eb3cSopenharmony_ci
68223b3eb3cSopenharmony_ci  initialRender() {
68323b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
68423b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
68523b3eb3cSopenharmony_ci      Column.create();
68623b3eb3cSopenharmony_ci      Column.height('100%');
68723b3eb3cSopenharmony_ci      Column.margin({
68823b3eb3cSopenharmony_ci        right: {
68923b3eb3cSopenharmony_ci          'id': -1,
69023b3eb3cSopenharmony_ci          'type': 10002,
69123b3eb3cSopenharmony_ci          params: ['sys.float.ohos_id_default_padding_end'],
69223b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
69323b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
69423b3eb3cSopenharmony_ci        }
69523b3eb3cSopenharmony_ci      });
69623b3eb3cSopenharmony_ci      Column.justifyContent(FlexAlign.Center);
69723b3eb3cSopenharmony_ci    }, Column);
69823b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
69923b3eb3cSopenharmony_ci      Row.create();
70023b3eb3cSopenharmony_ci    }, Row);
70123b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
70223b3eb3cSopenharmony_ci      If.create();
70323b3eb3cSopenharmony_ci      if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) {
70423b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
70523b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
70623b3eb3cSopenharmony_ci            ForEach.create();
70723b3eb3cSopenharmony_ci            const forEachItemGenFunction = (_item, index) => {
70823b3eb3cSopenharmony_ci              const item = _item;
70923b3eb3cSopenharmony_ci              {
71023b3eb3cSopenharmony_ci                this.observeComponentCreation2((elmtId, isInitialRender) => {
71123b3eb3cSopenharmony_ci                  if (isInitialRender) {
71223b3eb3cSopenharmony_ci                    let componentCall = new ImageMenuItem(this, {
71323b3eb3cSopenharmony_ci                      item: item,
71423b3eb3cSopenharmony_ci                      index: this.index * 1000 + index + 1
71523b3eb3cSopenharmony_ci                    }, undefined, elmtId, () => {
71623b3eb3cSopenharmony_ci                    }, {
71723b3eb3cSopenharmony_ci                      page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets',
71823b3eb3cSopenharmony_ci                      line: 266,
71923b3eb3cSopenharmony_ci                      col: 13
72023b3eb3cSopenharmony_ci                    });
72123b3eb3cSopenharmony_ci                    ViewPU.create(componentCall);
72223b3eb3cSopenharmony_ci                    let paramsLambda = () => {
72323b3eb3cSopenharmony_ci                      return {
72423b3eb3cSopenharmony_ci                        item: item,
72523b3eb3cSopenharmony_ci                        index: this.index * 1000 + index + 1
72623b3eb3cSopenharmony_ci                      };
72723b3eb3cSopenharmony_ci                    };
72823b3eb3cSopenharmony_ci                    componentCall.paramsGenerator_ = paramsLambda;
72923b3eb3cSopenharmony_ci                  } else {
73023b3eb3cSopenharmony_ci                    this.updateStateVarsOfChildByElmtId(elmtId, {});
73123b3eb3cSopenharmony_ci                  }
73223b3eb3cSopenharmony_ci                }, { name: 'ImageMenuItem' });
73323b3eb3cSopenharmony_ci              }
73423b3eb3cSopenharmony_ci            };
73523b3eb3cSopenharmony_ci            this.forEachUpdateFunction(elmtId, this.menuItems, forEachItemGenFunction, undefined, true, false);
73623b3eb3cSopenharmony_ci          }, ForEach);
73723b3eb3cSopenharmony_ci          ForEach.pop();
73823b3eb3cSopenharmony_ci        });
73923b3eb3cSopenharmony_ci      } else {
74023b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
74123b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
74223b3eb3cSopenharmony_ci            ForEach.create();
74323b3eb3cSopenharmony_ci            const forEachItemGenFunction = (_item, index) => {
74423b3eb3cSopenharmony_ci              const item = _item;
74523b3eb3cSopenharmony_ci              {
74623b3eb3cSopenharmony_ci                this.observeComponentCreation2((elmtId, isInitialRender) => {
74723b3eb3cSopenharmony_ci                  if (isInitialRender) {
74823b3eb3cSopenharmony_ci                    let componentCall = new ImageMenuItem(this, {
74923b3eb3cSopenharmony_ci                      item: item,
75023b3eb3cSopenharmony_ci                      index: this.index * 1000 + index + 1
75123b3eb3cSopenharmony_ci                    }, undefined, elmtId, () => {
75223b3eb3cSopenharmony_ci                    }, {
75323b3eb3cSopenharmony_ci                      page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets',
75423b3eb3cSopenharmony_ci                      line: 271,
75523b3eb3cSopenharmony_ci                      col: 15
75623b3eb3cSopenharmony_ci                    });
75723b3eb3cSopenharmony_ci                    ViewPU.create(componentCall);
75823b3eb3cSopenharmony_ci                    let paramsLambda = () => {
75923b3eb3cSopenharmony_ci                      return {
76023b3eb3cSopenharmony_ci                        item: item,
76123b3eb3cSopenharmony_ci                        index: this.index * 1000 + index + 1
76223b3eb3cSopenharmony_ci                      };
76323b3eb3cSopenharmony_ci                    };
76423b3eb3cSopenharmony_ci                    componentCall.paramsGenerator_ = paramsLambda;
76523b3eb3cSopenharmony_ci                  } else {
76623b3eb3cSopenharmony_ci                    this.updateStateVarsOfChildByElmtId(elmtId, {});
76723b3eb3cSopenharmony_ci                  }
76823b3eb3cSopenharmony_ci                }, { name: 'ImageMenuItem' });
76923b3eb3cSopenharmony_ci              }
77023b3eb3cSopenharmony_ci            };
77123b3eb3cSopenharmony_ci            this.forEachUpdateFunction(elmtId, this.menuItems.slice(0,
77223b3eb3cSopenharmony_ci              CollapsibleMenuSection.maxCountOfVisibleItems - 1), forEachItemGenFunction, undefined, true, false);
77323b3eb3cSopenharmony_ci          }, ForEach);
77423b3eb3cSopenharmony_ci          ForEach.pop();
77523b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
77623b3eb3cSopenharmony_ci            Row.create();
77723b3eb3cSopenharmony_ci            Row.width(ImageMenuItem.imageHotZoneWidth);
77823b3eb3cSopenharmony_ci            Row.height(ImageMenuItem.imageHotZoneWidth);
77923b3eb3cSopenharmony_ci            Row.borderRadius(ImageMenuItem.buttonBorderRadius);
78023b3eb3cSopenharmony_ci            Row.foregroundColor(this.getMoreIconFgColor());
78123b3eb3cSopenharmony_ci            Row.backgroundColor(this.getMoreIconBgColor());
78223b3eb3cSopenharmony_ci            Row.justifyContent(FlexAlign.Center);
78323b3eb3cSopenharmony_ci            ViewStackProcessor.visualState('focused');
78423b3eb3cSopenharmony_ci            Row.border({
78523b3eb3cSopenharmony_ci              radius: {
78623b3eb3cSopenharmony_ci                'id': -1,
78723b3eb3cSopenharmony_ci                'type': 10002,
78823b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_corner_radius_clicked'],
78923b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
79023b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
79123b3eb3cSopenharmony_ci              },
79223b3eb3cSopenharmony_ci              width: ImageMenuItem.focusBorderWidth,
79323b3eb3cSopenharmony_ci              color: {
79423b3eb3cSopenharmony_ci                'id': -1,
79523b3eb3cSopenharmony_ci                'type': 10001,
79623b3eb3cSopenharmony_ci                params: ['sys.color.ohos_id_color_focused_outline'],
79723b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
79823b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
79923b3eb3cSopenharmony_ci              },
80023b3eb3cSopenharmony_ci              style: BorderStyle.Solid
80123b3eb3cSopenharmony_ci            });
80223b3eb3cSopenharmony_ci            ViewStackProcessor.visualState('normal');
80323b3eb3cSopenharmony_ci            Row.border({
80423b3eb3cSopenharmony_ci              radius: {
80523b3eb3cSopenharmony_ci                'id': -1,
80623b3eb3cSopenharmony_ci                'type': 10002,
80723b3eb3cSopenharmony_ci                params: ['sys.float.ohos_id_corner_radius_clicked'],
80823b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
80923b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
81023b3eb3cSopenharmony_ci              },
81123b3eb3cSopenharmony_ci              width: 0
81223b3eb3cSopenharmony_ci            });
81323b3eb3cSopenharmony_ci            ViewStackProcessor.visualState();
81423b3eb3cSopenharmony_ci            Row.onFocus(() => this.isMoreIconOnFocus = true);
81523b3eb3cSopenharmony_ci            Row.onBlur(() => this.isMoreIconOnFocus = false);
81623b3eb3cSopenharmony_ci            Row.onHover((isOn) => this.isMoreIconOnHover = isOn);
81723b3eb3cSopenharmony_ci            Row.onKeyEvent((event) => {
81823b3eb3cSopenharmony_ci              if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
81923b3eb3cSopenharmony_ci                return;
82023b3eb3cSopenharmony_ci              }
82123b3eb3cSopenharmony_ci              if (event.type === KeyType.Down) {
82223b3eb3cSopenharmony_ci                this.isMoreIconOnClick = true;
82323b3eb3cSopenharmony_ci              }
82423b3eb3cSopenharmony_ci              if (event.type === KeyType.Up) {
82523b3eb3cSopenharmony_ci                this.isMoreIconOnClick = false;
82623b3eb3cSopenharmony_ci              }
82723b3eb3cSopenharmony_ci            });
82823b3eb3cSopenharmony_ci            Row.onTouch((event) => {
82923b3eb3cSopenharmony_ci              if (event.type === TouchType.Down) {
83023b3eb3cSopenharmony_ci                this.isMoreIconOnClick = true;
83123b3eb3cSopenharmony_ci              }
83223b3eb3cSopenharmony_ci              if (event.type === TouchType.Up || event.type === TouchType.Cancel) {
83323b3eb3cSopenharmony_ci                this.isMoreIconOnClick = false;
83423b3eb3cSopenharmony_ci                if (this.fontSize >= this.minFontSize) {
83523b3eb3cSopenharmony_ci                  this.dialogController?.close();
83623b3eb3cSopenharmony_ci                }
83723b3eb3cSopenharmony_ci              }
83823b3eb3cSopenharmony_ci            });
83923b3eb3cSopenharmony_ci            Row.onClick(() => this.isPopupShown = true);
84023b3eb3cSopenharmony_ci            Gesture.create(GesturePriority.Low);
84123b3eb3cSopenharmony_ci            LongPressGesture.create({ repeat: false, duration: this.longPressTime });
84223b3eb3cSopenharmony_ci            LongPressGesture.onAction((event) => {
84323b3eb3cSopenharmony_ci              this.fontSize = this.decideFontScale();
84423b3eb3cSopenharmony_ci              if (event) {
84523b3eb3cSopenharmony_ci                if (this.fontSize >= this.minFontSize) {
84623b3eb3cSopenharmony_ci                  this.dialogController?.open();
84723b3eb3cSopenharmony_ci                }
84823b3eb3cSopenharmony_ci              }
84923b3eb3cSopenharmony_ci            });
85023b3eb3cSopenharmony_ci            LongPressGesture.pop();
85123b3eb3cSopenharmony_ci            Gesture.pop();
85223b3eb3cSopenharmony_ci            Row.bindPopup(this.isPopupShown, {
85323b3eb3cSopenharmony_ci              builder: { builder: this.popupBuilder.bind(this) },
85423b3eb3cSopenharmony_ci              placement: Placement.Bottom,
85523b3eb3cSopenharmony_ci              popupColor: Color.White,
85623b3eb3cSopenharmony_ci              enableArrow: false,
85723b3eb3cSopenharmony_ci              onStateChange: (e) => {
85823b3eb3cSopenharmony_ci                this.isPopupShown = e.isVisible;
85923b3eb3cSopenharmony_ci                if (!e.isVisible) {
86023b3eb3cSopenharmony_ci                  this.isMoreIconOnClick = false;
86123b3eb3cSopenharmony_ci                }
86223b3eb3cSopenharmony_ci              }
86323b3eb3cSopenharmony_ci            });
86423b3eb3cSopenharmony_ci          }, Row);
86523b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
86623b3eb3cSopenharmony_ci            Image.create(PUBLIC_MORE);
86723b3eb3cSopenharmony_ci            Image.width(ImageMenuItem.imageSize);
86823b3eb3cSopenharmony_ci            Image.height(ImageMenuItem.imageSize);
86923b3eb3cSopenharmony_ci            Image.focusable(true);
87023b3eb3cSopenharmony_ci            Image.draggable(false);
87123b3eb3cSopenharmony_ci            Image.fillColor({
87223b3eb3cSopenharmony_ci              'id': -1,
87323b3eb3cSopenharmony_ci              'type': 10001,
87423b3eb3cSopenharmony_ci              params: ['sys.color.icon_primary'],
87523b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
87623b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
87723b3eb3cSopenharmony_ci            });
87823b3eb3cSopenharmony_ci          }, Image);
87923b3eb3cSopenharmony_ci          Row.pop();
88023b3eb3cSopenharmony_ci        });
88123b3eb3cSopenharmony_ci      }
88223b3eb3cSopenharmony_ci    }, If);
88323b3eb3cSopenharmony_ci    If.pop();
88423b3eb3cSopenharmony_ci    Row.pop();
88523b3eb3cSopenharmony_ci    Column.pop();
88623b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
88723b3eb3cSopenharmony_ci  }
88823b3eb3cSopenharmony_ci
88923b3eb3cSopenharmony_ci  popupBuilder(parent = null) {
89023b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
89123b3eb3cSopenharmony_ci      Column.create();
89223b3eb3cSopenharmony_ci      Column.width(
89323b3eb3cSopenharmony_ci        ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum
89423b3eb3cSopenharmony_ci      );
89523b3eb3cSopenharmony_ci      Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding });
89623b3eb3cSopenharmony_ci      Column.onAppear(() => {
89723b3eb3cSopenharmony_ci        focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex);
89823b3eb3cSopenharmony_ci      });
89923b3eb3cSopenharmony_ci    }, Column);
90023b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
90123b3eb3cSopenharmony_ci      ForEach.create();
90223b3eb3cSopenharmony_ci      const forEachItemGenFunction = (_item, index) => {
90323b3eb3cSopenharmony_ci        const item = _item;
90423b3eb3cSopenharmony_ci        {
90523b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
90623b3eb3cSopenharmony_ci            if (isInitialRender) {
90723b3eb3cSopenharmony_ci              let componentCall = new ImageMenuItem(this, {
90823b3eb3cSopenharmony_ci                item: item,
90923b3eb3cSopenharmony_ci                index: this.index * 1000 +
91023b3eb3cSopenharmony_ci                CollapsibleMenuSection.maxCountOfVisibleItems + index,
91123b3eb3cSopenharmony_ci                isPopup: true
91223b3eb3cSopenharmony_ci              }, undefined, elmtId, () => {
91323b3eb3cSopenharmony_ci              }, {
91423b3eb3cSopenharmony_ci                page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets',
91523b3eb3cSopenharmony_ci                line: 365,
91623b3eb3cSopenharmony_ci                col: 11
91723b3eb3cSopenharmony_ci              });
91823b3eb3cSopenharmony_ci              ViewPU.create(componentCall);
91923b3eb3cSopenharmony_ci              let paramsLambda = () => {
92023b3eb3cSopenharmony_ci                return {
92123b3eb3cSopenharmony_ci                  item: item,
92223b3eb3cSopenharmony_ci                  index: this.index * 1000 +
92323b3eb3cSopenharmony_ci                  CollapsibleMenuSection.maxCountOfVisibleItems + index,
92423b3eb3cSopenharmony_ci                  isPopup: true
92523b3eb3cSopenharmony_ci                };
92623b3eb3cSopenharmony_ci              };
92723b3eb3cSopenharmony_ci              componentCall.paramsGenerator_ = paramsLambda;
92823b3eb3cSopenharmony_ci            } else {
92923b3eb3cSopenharmony_ci              this.updateStateVarsOfChildByElmtId(elmtId, {});
93023b3eb3cSopenharmony_ci            }
93123b3eb3cSopenharmony_ci          }, { name: 'ImageMenuItem' });
93223b3eb3cSopenharmony_ci        }
93323b3eb3cSopenharmony_ci      };
93423b3eb3cSopenharmony_ci      this.forEachUpdateFunction(elmtId, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1,
93523b3eb3cSopenharmony_ci        this.menuItems.length), forEachItemGenFunction, undefined, true, false);
93623b3eb3cSopenharmony_ci    }, ForEach);
93723b3eb3cSopenharmony_ci    ForEach.pop();
93823b3eb3cSopenharmony_ci    Column.pop();
93923b3eb3cSopenharmony_ci  }
94023b3eb3cSopenharmony_ci
94123b3eb3cSopenharmony_ci  rerender() {
94223b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
94323b3eb3cSopenharmony_ci    this.updateDirtyElements();
94423b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
94523b3eb3cSopenharmony_ci  }
94623b3eb3cSopenharmony_ci}
94723b3eb3cSopenharmony_ci
94823b3eb3cSopenharmony_ciCollapsibleMenuSection.maxCountOfVisibleItems = 3;
94923b3eb3cSopenharmony_ciCollapsibleMenuSection.focusPadding = 4;
95023b3eb3cSopenharmony_ciCollapsibleMenuSection.marginsNum = 2;
95123b3eb3cSopenharmony_ci
95223b3eb3cSopenharmony_ciclass ImageMenuItem extends ViewPU {
95323b3eb3cSopenharmony_ci  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
95423b3eb3cSopenharmony_ci    super(parent, __localStorage, elmtId, extraInfo);
95523b3eb3cSopenharmony_ci    if (typeof paramsLambda === 'function') {
95623b3eb3cSopenharmony_ci      this.paramsGenerator_ = paramsLambda;
95723b3eb3cSopenharmony_ci    }
95823b3eb3cSopenharmony_ci    this.item = {};
95923b3eb3cSopenharmony_ci    this.index = 0;
96023b3eb3cSopenharmony_ci    this.longPressTime = 500;
96123b3eb3cSopenharmony_ci    this.minFontSize = 1.75;
96223b3eb3cSopenharmony_ci    this.isFollowingSystemFontScale = false;
96323b3eb3cSopenharmony_ci    this.maxFontScale = 1;
96423b3eb3cSopenharmony_ci    this.systemFontScale = 1;
96523b3eb3cSopenharmony_ci    this.isPopup = false;
96623b3eb3cSopenharmony_ci    this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus');
96723b3eb3cSopenharmony_ci    this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover');
96823b3eb3cSopenharmony_ci    this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick');
96923b3eb3cSopenharmony_ci    this.__fontSize = new SynchedPropertySimpleOneWayPU(params.fontSize, this, 'fontSize');
97023b3eb3cSopenharmony_ci    this.dialogController = new CustomDialogController({
97123b3eb3cSopenharmony_ci      builder: () => {
97223b3eb3cSopenharmony_ci        let jsDialog = new SelectTitleBarDialog(this, {
97323b3eb3cSopenharmony_ci          cancel: () => {
97423b3eb3cSopenharmony_ci          },
97523b3eb3cSopenharmony_ci          confirm: () => {
97623b3eb3cSopenharmony_ci          },
97723b3eb3cSopenharmony_ci          selectTitleDialog: this.item,
97823b3eb3cSopenharmony_ci          selectTitleBarDialog: this.item.label ? this.item.label : this.textDialog(),
97923b3eb3cSopenharmony_ci          fontSize: this.fontSize,
98023b3eb3cSopenharmony_ci        }, undefined, -1, () => {
98123b3eb3cSopenharmony_ci        }, { page: 'library/src/main/ets/components/mainpage/selecttitlebar.ets', line: 401, col: 14 });
98223b3eb3cSopenharmony_ci        jsDialog.setController(this.dialogController);
98323b3eb3cSopenharmony_ci        ViewPU.create(jsDialog);
98423b3eb3cSopenharmony_ci        let paramsLambda = () => {
98523b3eb3cSopenharmony_ci          return {
98623b3eb3cSopenharmony_ci            cancel: () => {
98723b3eb3cSopenharmony_ci            },
98823b3eb3cSopenharmony_ci            confirm: () => {
98923b3eb3cSopenharmony_ci            },
99023b3eb3cSopenharmony_ci            selectTitleDialog: this.item,
99123b3eb3cSopenharmony_ci            selectTitleBarDialog: this.item.label ? this.item.label : this.textDialog(),
99223b3eb3cSopenharmony_ci            fontSize: this.fontSize
99323b3eb3cSopenharmony_ci          };
99423b3eb3cSopenharmony_ci        };
99523b3eb3cSopenharmony_ci        jsDialog.paramsGenerator_ = paramsLambda;
99623b3eb3cSopenharmony_ci      },
99723b3eb3cSopenharmony_ci      maskColor: Color.Transparent,
99823b3eb3cSopenharmony_ci      isModal: true,
99923b3eb3cSopenharmony_ci      customStyle: true
100023b3eb3cSopenharmony_ci    }, this);
100123b3eb3cSopenharmony_ci    this.setInitiallyProvidedValue(params);
100223b3eb3cSopenharmony_ci    this.finalizeConstruction();
100323b3eb3cSopenharmony_ci  }
100423b3eb3cSopenharmony_ci
100523b3eb3cSopenharmony_ci  setInitiallyProvidedValue(params) {
100623b3eb3cSopenharmony_ci    if (params.item !== undefined) {
100723b3eb3cSopenharmony_ci      this.item = params.item;
100823b3eb3cSopenharmony_ci    }
100923b3eb3cSopenharmony_ci    if (params.index !== undefined) {
101023b3eb3cSopenharmony_ci      this.index = params.index;
101123b3eb3cSopenharmony_ci    }
101223b3eb3cSopenharmony_ci    if (params.longPressTime !== undefined) {
101323b3eb3cSopenharmony_ci      this.longPressTime = params.longPressTime;
101423b3eb3cSopenharmony_ci    }
101523b3eb3cSopenharmony_ci    if (params.minFontSize !== undefined) {
101623b3eb3cSopenharmony_ci      this.minFontSize = params.minFontSize;
101723b3eb3cSopenharmony_ci    }
101823b3eb3cSopenharmony_ci    if (params.isFollowingSystemFontScale !== undefined) {
101923b3eb3cSopenharmony_ci      this.isFollowingSystemFontScale = params.isFollowingSystemFontScale;
102023b3eb3cSopenharmony_ci    }
102123b3eb3cSopenharmony_ci    if (params.maxFontScale !== undefined) {
102223b3eb3cSopenharmony_ci      this.maxFontScale = params.maxFontScale;
102323b3eb3cSopenharmony_ci    }
102423b3eb3cSopenharmony_ci    if (params.systemFontScale !== undefined) {
102523b3eb3cSopenharmony_ci      this.systemFontScale = params.systemFontScale;
102623b3eb3cSopenharmony_ci    }
102723b3eb3cSopenharmony_ci    if (params.isPopup !== undefined) {
102823b3eb3cSopenharmony_ci      this.isPopup = params.isPopup;
102923b3eb3cSopenharmony_ci    }
103023b3eb3cSopenharmony_ci    if (params.isOnFocus !== undefined) {
103123b3eb3cSopenharmony_ci      this.isOnFocus = params.isOnFocus;
103223b3eb3cSopenharmony_ci    }
103323b3eb3cSopenharmony_ci    if (params.isOnHover !== undefined) {
103423b3eb3cSopenharmony_ci      this.isOnHover = params.isOnHover;
103523b3eb3cSopenharmony_ci    }
103623b3eb3cSopenharmony_ci    if (params.isOnClick !== undefined) {
103723b3eb3cSopenharmony_ci      this.isOnClick = params.isOnClick;
103823b3eb3cSopenharmony_ci    }
103923b3eb3cSopenharmony_ci    if (params.fontSize === undefined) {
104023b3eb3cSopenharmony_ci      this.__fontSize.set(1);
104123b3eb3cSopenharmony_ci    }
104223b3eb3cSopenharmony_ci    if (params.dialogController !== undefined) {
104323b3eb3cSopenharmony_ci      this.dialogController = params.dialogController;
104423b3eb3cSopenharmony_ci    }
104523b3eb3cSopenharmony_ci  }
104623b3eb3cSopenharmony_ci
104723b3eb3cSopenharmony_ci  updateStateVars(params) {
104823b3eb3cSopenharmony_ci    this.__fontSize.reset(params.fontSize);
104923b3eb3cSopenharmony_ci  }
105023b3eb3cSopenharmony_ci
105123b3eb3cSopenharmony_ci  purgeVariableDependenciesOnElmtId(rmElmtId) {
105223b3eb3cSopenharmony_ci    this.__isOnFocus.purgeDependencyOnElmtId(rmElmtId);
105323b3eb3cSopenharmony_ci    this.__isOnHover.purgeDependencyOnElmtId(rmElmtId);
105423b3eb3cSopenharmony_ci    this.__isOnClick.purgeDependencyOnElmtId(rmElmtId);
105523b3eb3cSopenharmony_ci    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
105623b3eb3cSopenharmony_ci  }
105723b3eb3cSopenharmony_ci
105823b3eb3cSopenharmony_ci  aboutToBeDeleted() {
105923b3eb3cSopenharmony_ci    this.__isOnFocus.aboutToBeDeleted();
106023b3eb3cSopenharmony_ci    this.__isOnHover.aboutToBeDeleted();
106123b3eb3cSopenharmony_ci    this.__isOnClick.aboutToBeDeleted();
106223b3eb3cSopenharmony_ci    this.__fontSize.aboutToBeDeleted();
106323b3eb3cSopenharmony_ci    SubscriberManager.Get().delete(this.id__());
106423b3eb3cSopenharmony_ci    this.aboutToBeDeletedInternal();
106523b3eb3cSopenharmony_ci  }
106623b3eb3cSopenharmony_ci
106723b3eb3cSopenharmony_ci  get isOnFocus() {
106823b3eb3cSopenharmony_ci    return this.__isOnFocus.get();
106923b3eb3cSopenharmony_ci  }
107023b3eb3cSopenharmony_ci
107123b3eb3cSopenharmony_ci  set isOnFocus(newValue) {
107223b3eb3cSopenharmony_ci    this.__isOnFocus.set(newValue);
107323b3eb3cSopenharmony_ci  }
107423b3eb3cSopenharmony_ci
107523b3eb3cSopenharmony_ci  get isOnHover() {
107623b3eb3cSopenharmony_ci    return this.__isOnHover.get();
107723b3eb3cSopenharmony_ci  }
107823b3eb3cSopenharmony_ci
107923b3eb3cSopenharmony_ci  set isOnHover(newValue) {
108023b3eb3cSopenharmony_ci    this.__isOnHover.set(newValue);
108123b3eb3cSopenharmony_ci  }
108223b3eb3cSopenharmony_ci
108323b3eb3cSopenharmony_ci  get isOnClick() {
108423b3eb3cSopenharmony_ci    return this.__isOnClick.get();
108523b3eb3cSopenharmony_ci  }
108623b3eb3cSopenharmony_ci
108723b3eb3cSopenharmony_ci  set isOnClick(newValue) {
108823b3eb3cSopenharmony_ci    this.__isOnClick.set(newValue);
108923b3eb3cSopenharmony_ci  }
109023b3eb3cSopenharmony_ci
109123b3eb3cSopenharmony_ci  get fontSize() {
109223b3eb3cSopenharmony_ci    return this.__fontSize.get();
109323b3eb3cSopenharmony_ci  }
109423b3eb3cSopenharmony_ci
109523b3eb3cSopenharmony_ci  set fontSize(newValue) {
109623b3eb3cSopenharmony_ci    this.__fontSize.set(newValue);
109723b3eb3cSopenharmony_ci  }
109823b3eb3cSopenharmony_ci
109923b3eb3cSopenharmony_ci  textDialog() {
110023b3eb3cSopenharmony_ci    if (this.item.value === PUBLIC_MORE) {
110123b3eb3cSopenharmony_ci      return {
110223b3eb3cSopenharmony_ci        'id': -1,
110323b3eb3cSopenharmony_ci        'type': 10003,
110423b3eb3cSopenharmony_ci        params: ['sys.string.ohos_toolbar_more'],
110523b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
110623b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
110723b3eb3cSopenharmony_ci      };
110823b3eb3cSopenharmony_ci    } else if (this.item.value === PUBLIC_BACK) {
110923b3eb3cSopenharmony_ci      return {
111023b3eb3cSopenharmony_ci        'id': -1,
111123b3eb3cSopenharmony_ci        'type': 10003,
111223b3eb3cSopenharmony_ci        params: ['sys.string.icon_back'],
111323b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
111423b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
111523b3eb3cSopenharmony_ci      };
111623b3eb3cSopenharmony_ci    } else {
111723b3eb3cSopenharmony_ci      return this.item.label ? this.item.label : '';
111823b3eb3cSopenharmony_ci    }
111923b3eb3cSopenharmony_ci  }
112023b3eb3cSopenharmony_ci
112123b3eb3cSopenharmony_ci  getFgColor() {
112223b3eb3cSopenharmony_ci    return this.isOnClick ?
112323b3eb3cSopenharmony_ci      {
112423b3eb3cSopenharmony_ci        'id': -1,
112523b3eb3cSopenharmony_ci        'type': 10001,
112623b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_titlebar_icon_pressed'],
112723b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
112823b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
112923b3eb3cSopenharmony_ci      } : {
113023b3eb3cSopenharmony_ci        'id': -1,
113123b3eb3cSopenharmony_ci        'type': 10001,
113223b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_titlebar_icon'],
113323b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
113423b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
113523b3eb3cSopenharmony_ci      };
113623b3eb3cSopenharmony_ci  }
113723b3eb3cSopenharmony_ci
113823b3eb3cSopenharmony_ci  getBgColor() {
113923b3eb3cSopenharmony_ci    if (this.isOnClick) {
114023b3eb3cSopenharmony_ci      return {
114123b3eb3cSopenharmony_ci        'id': -1,
114223b3eb3cSopenharmony_ci        'type': 10001,
114323b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_click_effect'],
114423b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
114523b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
114623b3eb3cSopenharmony_ci      };
114723b3eb3cSopenharmony_ci    } else if (this.isOnHover) {
114823b3eb3cSopenharmony_ci      return {
114923b3eb3cSopenharmony_ci        'id': -1,
115023b3eb3cSopenharmony_ci        'type': 10001,
115123b3eb3cSopenharmony_ci        params: ['sys.color.ohos_id_color_hover'],
115223b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
115323b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
115423b3eb3cSopenharmony_ci      };
115523b3eb3cSopenharmony_ci    } else {
115623b3eb3cSopenharmony_ci      return Color.Transparent;
115723b3eb3cSopenharmony_ci    }
115823b3eb3cSopenharmony_ci  }
115923b3eb3cSopenharmony_ci
116023b3eb3cSopenharmony_ci  aboutToAppear() {
116123b3eb3cSopenharmony_ci    try {
116223b3eb3cSopenharmony_ci      let uiContent = this.getUIContext();
116323b3eb3cSopenharmony_ci      this.isFollowingSystemFontScale = uiContent.isFollowingSystemFontScale();
116423b3eb3cSopenharmony_ci      this.maxFontScale = uiContent.getMaxFontScale();
116523b3eb3cSopenharmony_ci    }
116623b3eb3cSopenharmony_ci    catch (exception) {
116723b3eb3cSopenharmony_ci      let code = exception.code;
116823b3eb3cSopenharmony_ci      let message = exception.message;
116923b3eb3cSopenharmony_ci      hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${code}, message: ${message}`);
117023b3eb3cSopenharmony_ci    }
117123b3eb3cSopenharmony_ci  }
117223b3eb3cSopenharmony_ci
117323b3eb3cSopenharmony_ci  decideFontScale() {
117423b3eb3cSopenharmony_ci    let uiContent = this.getUIContext();
117523b3eb3cSopenharmony_ci    this.systemFontScale = uiContent.getHostContext()?.config?.fontSizeScale ?? 1;
117623b3eb3cSopenharmony_ci    if (!this.isFollowingSystemFontScale) {
117723b3eb3cSopenharmony_ci      return 1;
117823b3eb3cSopenharmony_ci    }
117923b3eb3cSopenharmony_ci    return Math.min(this.systemFontScale, this.maxFontScale);
118023b3eb3cSopenharmony_ci  }
118123b3eb3cSopenharmony_ci
118223b3eb3cSopenharmony_ci  initialRender() {
118323b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
118423b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
118523b3eb3cSopenharmony_ci      Row.create();
118623b3eb3cSopenharmony_ci      Row.width(ImageMenuItem.imageHotZoneWidth);
118723b3eb3cSopenharmony_ci      Row.height(ImageMenuItem.imageHotZoneWidth);
118823b3eb3cSopenharmony_ci      Row.borderRadius(ImageMenuItem.buttonBorderRadius);
118923b3eb3cSopenharmony_ci      Row.foregroundColor(this.getFgColor());
119023b3eb3cSopenharmony_ci      Row.backgroundColor(this.getBgColor());
119123b3eb3cSopenharmony_ci      Row.justifyContent(FlexAlign.Center);
119223b3eb3cSopenharmony_ci      Row.opacity(this.item.isEnabled ? 1 : ImageMenuItem.disabledImageOpacity);
119323b3eb3cSopenharmony_ci      ViewStackProcessor.visualState('focused');
119423b3eb3cSopenharmony_ci      Row.border({
119523b3eb3cSopenharmony_ci        radius: {
119623b3eb3cSopenharmony_ci          'id': -1,
119723b3eb3cSopenharmony_ci          'type': 10002,
119823b3eb3cSopenharmony_ci          params: ['sys.float.ohos_id_corner_radius_clicked'],
119923b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
120023b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
120123b3eb3cSopenharmony_ci        },
120223b3eb3cSopenharmony_ci        width: ImageMenuItem.focusBorderWidth,
120323b3eb3cSopenharmony_ci        color: {
120423b3eb3cSopenharmony_ci          'id': -1,
120523b3eb3cSopenharmony_ci          'type': 10001,
120623b3eb3cSopenharmony_ci          params: ['sys.color.ohos_id_color_focused_outline'],
120723b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
120823b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
120923b3eb3cSopenharmony_ci        },
121023b3eb3cSopenharmony_ci        style: BorderStyle.Solid
121123b3eb3cSopenharmony_ci      });
121223b3eb3cSopenharmony_ci      ViewStackProcessor.visualState('normal');
121323b3eb3cSopenharmony_ci      Row.border({
121423b3eb3cSopenharmony_ci        radius: {
121523b3eb3cSopenharmony_ci          'id': -1,
121623b3eb3cSopenharmony_ci          'type': 10002,
121723b3eb3cSopenharmony_ci          params: ['sys.float.ohos_id_corner_radius_clicked'],
121823b3eb3cSopenharmony_ci          'bundleName': '__harDefaultBundleName__',
121923b3eb3cSopenharmony_ci          'moduleName': '__harDefaultModuleName__'
122023b3eb3cSopenharmony_ci        },
122123b3eb3cSopenharmony_ci        width: 0
122223b3eb3cSopenharmony_ci      });
122323b3eb3cSopenharmony_ci      ViewStackProcessor.visualState();
122423b3eb3cSopenharmony_ci      Row.onFocus(() => {
122523b3eb3cSopenharmony_ci        if (!this.item.isEnabled) {
122623b3eb3cSopenharmony_ci          return;
122723b3eb3cSopenharmony_ci        }
122823b3eb3cSopenharmony_ci        this.isOnFocus = true;
122923b3eb3cSopenharmony_ci      });
123023b3eb3cSopenharmony_ci      Row.onBlur(() => this.isOnFocus = false);
123123b3eb3cSopenharmony_ci      Row.onHover((isOn) => {
123223b3eb3cSopenharmony_ci        if (!this.item.isEnabled) {
123323b3eb3cSopenharmony_ci          return;
123423b3eb3cSopenharmony_ci        }
123523b3eb3cSopenharmony_ci        this.isOnHover = isOn;
123623b3eb3cSopenharmony_ci      });
123723b3eb3cSopenharmony_ci      Row.onKeyEvent((event) => {
123823b3eb3cSopenharmony_ci        if (!this.item.isEnabled) {
123923b3eb3cSopenharmony_ci          return;
124023b3eb3cSopenharmony_ci        }
124123b3eb3cSopenharmony_ci        if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) {
124223b3eb3cSopenharmony_ci          return;
124323b3eb3cSopenharmony_ci        }
124423b3eb3cSopenharmony_ci        if (event.type === KeyType.Down) {
124523b3eb3cSopenharmony_ci          this.isOnClick = true;
124623b3eb3cSopenharmony_ci        }
124723b3eb3cSopenharmony_ci        if (event.type === KeyType.Up) {
124823b3eb3cSopenharmony_ci          this.isOnClick = false;
124923b3eb3cSopenharmony_ci        }
125023b3eb3cSopenharmony_ci      });
125123b3eb3cSopenharmony_ci      Row.onTouch((event) => {
125223b3eb3cSopenharmony_ci        if (!this.item.isEnabled) {
125323b3eb3cSopenharmony_ci          return;
125423b3eb3cSopenharmony_ci        }
125523b3eb3cSopenharmony_ci        if (event.type === TouchType.Down) {
125623b3eb3cSopenharmony_ci          this.isOnClick = true;
125723b3eb3cSopenharmony_ci        }
125823b3eb3cSopenharmony_ci        if (event.type === TouchType.Up || event.type === TouchType.Cancel) {
125923b3eb3cSopenharmony_ci          this.isOnClick = false;
126023b3eb3cSopenharmony_ci          if (this.fontSize >= this.minFontSize && this.isPopup === false) {
126123b3eb3cSopenharmony_ci            this.dialogController?.close();
126223b3eb3cSopenharmony_ci          }
126323b3eb3cSopenharmony_ci        }
126423b3eb3cSopenharmony_ci      });
126523b3eb3cSopenharmony_ci      Row.onClick(() => this.item.isEnabled && this.item.action && this.item.action());
126623b3eb3cSopenharmony_ci      Gesture.create(GesturePriority.Low);
126723b3eb3cSopenharmony_ci      LongPressGesture.create({ repeat: false, duration: this.longPressTime });
126823b3eb3cSopenharmony_ci      LongPressGesture.onAction((event) => {
126923b3eb3cSopenharmony_ci        this.fontSize = this.decideFontScale();
127023b3eb3cSopenharmony_ci        if (event) {
127123b3eb3cSopenharmony_ci          if (this.fontSize >= this.minFontSize && this.isPopup === false) {
127223b3eb3cSopenharmony_ci            this.dialogController?.open();
127323b3eb3cSopenharmony_ci          }
127423b3eb3cSopenharmony_ci        }
127523b3eb3cSopenharmony_ci      });
127623b3eb3cSopenharmony_ci      LongPressGesture.pop();
127723b3eb3cSopenharmony_ci      Gesture.pop();
127823b3eb3cSopenharmony_ci    }, Row);
127923b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
128023b3eb3cSopenharmony_ci      Image.create(this.item.value);
128123b3eb3cSopenharmony_ci      Image.draggable(false);
128223b3eb3cSopenharmony_ci      Image.width(ImageMenuItem.imageSize);
128323b3eb3cSopenharmony_ci      Image.height(ImageMenuItem.imageSize);
128423b3eb3cSopenharmony_ci      Image.focusable(this.item.isEnabled);
128523b3eb3cSopenharmony_ci      Image.key(ImageMenuItem.focusablePrefix + this.index);
128623b3eb3cSopenharmony_ci      Image.fillColor({
128723b3eb3cSopenharmony_ci        'id': -1,
128823b3eb3cSopenharmony_ci        'type': 10001,
128923b3eb3cSopenharmony_ci        params: ['sys.color.icon_primary'],
129023b3eb3cSopenharmony_ci        'bundleName': '__harDefaultBundleName__',
129123b3eb3cSopenharmony_ci        'moduleName': '__harDefaultModuleName__'
129223b3eb3cSopenharmony_ci      });
129323b3eb3cSopenharmony_ci    }, Image);
129423b3eb3cSopenharmony_ci    Row.pop();
129523b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
129623b3eb3cSopenharmony_ci  }
129723b3eb3cSopenharmony_ci
129823b3eb3cSopenharmony_ci  rerender() {
129923b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
130023b3eb3cSopenharmony_ci    this.updateDirtyElements();
130123b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
130223b3eb3cSopenharmony_ci  }
130323b3eb3cSopenharmony_ci}
130423b3eb3cSopenharmony_ci
130523b3eb3cSopenharmony_ciImageMenuItem.imageSize = 24;
130623b3eb3cSopenharmony_ciImageMenuItem.imageHotZoneWidth = 48;
130723b3eb3cSopenharmony_ciImageMenuItem.buttonBorderRadius = 8;
130823b3eb3cSopenharmony_ciImageMenuItem.focusBorderWidth = 2;
130923b3eb3cSopenharmony_ciImageMenuItem.disabledImageOpacity = 0.4;
131023b3eb3cSopenharmony_ciImageMenuItem.focusablePrefix = 'Id-SelectTitleBar-ImageMenuItem-';
131123b3eb3cSopenharmony_ci
131223b3eb3cSopenharmony_ciclass SelectTitleBarDialog extends ViewPU {
131323b3eb3cSopenharmony_ci  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
131423b3eb3cSopenharmony_ci    super(parent, __localStorage, elmtId, extraInfo);
131523b3eb3cSopenharmony_ci    if (typeof paramsLambda === 'function') {
131623b3eb3cSopenharmony_ci      this.paramsGenerator_ = paramsLambda;
131723b3eb3cSopenharmony_ci    }
131823b3eb3cSopenharmony_ci    this.selectTitleDialog = {};
131923b3eb3cSopenharmony_ci    this.callbackId = undefined;
132023b3eb3cSopenharmony_ci    this.selectTitleBarDialog = '';
132123b3eb3cSopenharmony_ci    this.mainWindowStage = undefined;
132223b3eb3cSopenharmony_ci    this.controller = undefined;
132323b3eb3cSopenharmony_ci    this.minFontSize = 1.75;
132423b3eb3cSopenharmony_ci    this.maxFontSize = 3.2;
132523b3eb3cSopenharmony_ci    this.screenWidth = 640;
132623b3eb3cSopenharmony_ci    this.verticalScreenLines = 6;
132723b3eb3cSopenharmony_ci    this.horizontalsScreenLines = 1;
132823b3eb3cSopenharmony_ci    this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow');
132923b3eb3cSopenharmony_ci    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
133023b3eb3cSopenharmony_ci    this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines');
133123b3eb3cSopenharmony_ci    this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight');
133223b3eb3cSopenharmony_ci    this.cancel = () => {
133323b3eb3cSopenharmony_ci    };
133423b3eb3cSopenharmony_ci    this.confirm = () => {
133523b3eb3cSopenharmony_ci    };
133623b3eb3cSopenharmony_ci    this.setInitiallyProvidedValue(params);
133723b3eb3cSopenharmony_ci    this.finalizeConstruction();
133823b3eb3cSopenharmony_ci  }
133923b3eb3cSopenharmony_ci
134023b3eb3cSopenharmony_ci  setInitiallyProvidedValue(params) {
134123b3eb3cSopenharmony_ci    if (params.selectTitleDialog !== undefined) {
134223b3eb3cSopenharmony_ci      this.selectTitleDialog = params.selectTitleDialog;
134323b3eb3cSopenharmony_ci    }
134423b3eb3cSopenharmony_ci    if (params.callbackId !== undefined) {
134523b3eb3cSopenharmony_ci      this.callbackId = params.callbackId;
134623b3eb3cSopenharmony_ci    }
134723b3eb3cSopenharmony_ci    if (params.selectTitleBarDialog !== undefined) {
134823b3eb3cSopenharmony_ci      this.selectTitleBarDialog = params.selectTitleBarDialog;
134923b3eb3cSopenharmony_ci    }
135023b3eb3cSopenharmony_ci    if (params.mainWindowStage !== undefined) {
135123b3eb3cSopenharmony_ci      this.mainWindowStage = params.mainWindowStage;
135223b3eb3cSopenharmony_ci    }
135323b3eb3cSopenharmony_ci    if (params.controller !== undefined) {
135423b3eb3cSopenharmony_ci      this.controller = params.controller;
135523b3eb3cSopenharmony_ci    }
135623b3eb3cSopenharmony_ci    if (params.minFontSize !== undefined) {
135723b3eb3cSopenharmony_ci      this.minFontSize = params.minFontSize;
135823b3eb3cSopenharmony_ci    }
135923b3eb3cSopenharmony_ci    if (params.maxFontSize !== undefined) {
136023b3eb3cSopenharmony_ci      this.maxFontSize = params.maxFontSize;
136123b3eb3cSopenharmony_ci    }
136223b3eb3cSopenharmony_ci    if (params.screenWidth !== undefined) {
136323b3eb3cSopenharmony_ci      this.screenWidth = params.screenWidth;
136423b3eb3cSopenharmony_ci    }
136523b3eb3cSopenharmony_ci    if (params.verticalScreenLines !== undefined) {
136623b3eb3cSopenharmony_ci      this.verticalScreenLines = params.verticalScreenLines;
136723b3eb3cSopenharmony_ci    }
136823b3eb3cSopenharmony_ci    if (params.horizontalsScreenLines !== undefined) {
136923b3eb3cSopenharmony_ci      this.horizontalsScreenLines = params.horizontalsScreenLines;
137023b3eb3cSopenharmony_ci    }
137123b3eb3cSopenharmony_ci    if (params.fontSize !== undefined) {
137223b3eb3cSopenharmony_ci      this.fontSize = params.fontSize;
137323b3eb3cSopenharmony_ci    }
137423b3eb3cSopenharmony_ci    if (params.maxLines !== undefined) {
137523b3eb3cSopenharmony_ci      this.maxLines = params.maxLines;
137623b3eb3cSopenharmony_ci    }
137723b3eb3cSopenharmony_ci    if (params.cancel !== undefined) {
137823b3eb3cSopenharmony_ci      this.cancel = params.cancel;
137923b3eb3cSopenharmony_ci    }
138023b3eb3cSopenharmony_ci    if (params.confirm !== undefined) {
138123b3eb3cSopenharmony_ci      this.confirm = params.confirm;
138223b3eb3cSopenharmony_ci    }
138323b3eb3cSopenharmony_ci  }
138423b3eb3cSopenharmony_ci
138523b3eb3cSopenharmony_ci  updateStateVars(params) {
138623b3eb3cSopenharmony_ci  }
138723b3eb3cSopenharmony_ci
138823b3eb3cSopenharmony_ci  purgeVariableDependenciesOnElmtId(rmElmtId) {
138923b3eb3cSopenharmony_ci    this.__mainWindow.purgeDependencyOnElmtId(rmElmtId);
139023b3eb3cSopenharmony_ci    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
139123b3eb3cSopenharmony_ci    this.__maxLines.purgeDependencyOnElmtId(rmElmtId);
139223b3eb3cSopenharmony_ci    this.__windowStandardHeight.purgeDependencyOnElmtId(rmElmtId);
139323b3eb3cSopenharmony_ci  }
139423b3eb3cSopenharmony_ci
139523b3eb3cSopenharmony_ci  aboutToBeDeleted() {
139623b3eb3cSopenharmony_ci    this.__mainWindow.aboutToBeDeleted();
139723b3eb3cSopenharmony_ci    this.__fontSize.aboutToBeDeleted();
139823b3eb3cSopenharmony_ci    this.__maxLines.aboutToBeDeleted();
139923b3eb3cSopenharmony_ci    this.__windowStandardHeight.aboutToBeDeleted();
140023b3eb3cSopenharmony_ci    SubscriberManager.Get().delete(this.id__());
140123b3eb3cSopenharmony_ci    this.aboutToBeDeletedInternal();
140223b3eb3cSopenharmony_ci  }
140323b3eb3cSopenharmony_ci
140423b3eb3cSopenharmony_ci  setController(ctr) {
140523b3eb3cSopenharmony_ci    this.controller = ctr;
140623b3eb3cSopenharmony_ci  }
140723b3eb3cSopenharmony_ci
140823b3eb3cSopenharmony_ci  get mainWindow() {
140923b3eb3cSopenharmony_ci    return this.__mainWindow.get();
141023b3eb3cSopenharmony_ci  }
141123b3eb3cSopenharmony_ci
141223b3eb3cSopenharmony_ci  set mainWindow(newValue) {
141323b3eb3cSopenharmony_ci    this.__mainWindow.set(newValue);
141423b3eb3cSopenharmony_ci  }
141523b3eb3cSopenharmony_ci
141623b3eb3cSopenharmony_ci  get fontSize() {
141723b3eb3cSopenharmony_ci    return this.__fontSize.get();
141823b3eb3cSopenharmony_ci  }
141923b3eb3cSopenharmony_ci
142023b3eb3cSopenharmony_ci  set fontSize(newValue) {
142123b3eb3cSopenharmony_ci    this.__fontSize.set(newValue);
142223b3eb3cSopenharmony_ci  }
142323b3eb3cSopenharmony_ci
142423b3eb3cSopenharmony_ci  get maxLines() {
142523b3eb3cSopenharmony_ci    return this.__maxLines.get();
142623b3eb3cSopenharmony_ci  }
142723b3eb3cSopenharmony_ci
142823b3eb3cSopenharmony_ci  set maxLines(newValue) {
142923b3eb3cSopenharmony_ci    this.__maxLines.set(newValue);
143023b3eb3cSopenharmony_ci  }
143123b3eb3cSopenharmony_ci
143223b3eb3cSopenharmony_ci  get windowStandardHeight() {
143323b3eb3cSopenharmony_ci    return this.__windowStandardHeight.get();
143423b3eb3cSopenharmony_ci  }
143523b3eb3cSopenharmony_ci
143623b3eb3cSopenharmony_ci  set windowStandardHeight(newValue) {
143723b3eb3cSopenharmony_ci    this.__windowStandardHeight.set(newValue);
143823b3eb3cSopenharmony_ci  }
143923b3eb3cSopenharmony_ci
144023b3eb3cSopenharmony_ci  initialRender() {
144123b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
144223b3eb3cSopenharmony_ci    this.observeComponentCreation2((elmtId, isInitialRender) => {
144323b3eb3cSopenharmony_ci      If.create();
144423b3eb3cSopenharmony_ci      if (this.selectTitleBarDialog) {
144523b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(0, () => {
144623b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
144723b3eb3cSopenharmony_ci            Column.create();
144823b3eb3cSopenharmony_ci            Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG);
144923b3eb3cSopenharmony_ci            Column.constraintSize({
145023b3eb3cSopenharmony_ci              minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG
145123b3eb3cSopenharmony_ci            });
145223b3eb3cSopenharmony_ci            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
145323b3eb3cSopenharmony_ci            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
145423b3eb3cSopenharmony_ci            Column.borderRadius({
145523b3eb3cSopenharmony_ci              'id': -1,
145623b3eb3cSopenharmony_ci              'type': 10002,
145723b3eb3cSopenharmony_ci              params: ['sys.float.corner_radius_level10'],
145823b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
145923b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
146023b3eb3cSopenharmony_ci            });
146123b3eb3cSopenharmony_ci          }, Column);
146223b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
146323b3eb3cSopenharmony_ci            Image.create(this.selectTitleDialog.value);
146423b3eb3cSopenharmony_ci            Image.width(IMAGE_SIZE);
146523b3eb3cSopenharmony_ci            Image.height(IMAGE_SIZE);
146623b3eb3cSopenharmony_ci            Image.margin({
146723b3eb3cSopenharmony_ci              top: {
146823b3eb3cSopenharmony_ci                'id': -1,
146923b3eb3cSopenharmony_ci                'type': 10002,
147023b3eb3cSopenharmony_ci                params: ['sys.float.padding_level24'],
147123b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
147223b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
147323b3eb3cSopenharmony_ci              },
147423b3eb3cSopenharmony_ci              bottom: {
147523b3eb3cSopenharmony_ci                'id': -1,
147623b3eb3cSopenharmony_ci                'type': 10002,
147723b3eb3cSopenharmony_ci                params: ['sys.float.padding_level8'],
147823b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
147923b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
148023b3eb3cSopenharmony_ci              },
148123b3eb3cSopenharmony_ci            });
148223b3eb3cSopenharmony_ci            Image.fillColor({
148323b3eb3cSopenharmony_ci              'id': -1,
148423b3eb3cSopenharmony_ci              'type': 10001,
148523b3eb3cSopenharmony_ci              params: ['sys.color.icon_primary'],
148623b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
148723b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
148823b3eb3cSopenharmony_ci            });
148923b3eb3cSopenharmony_ci          }, Image);
149023b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
149123b3eb3cSopenharmony_ci            Column.create();
149223b3eb3cSopenharmony_ci            Column.width('100%');
149323b3eb3cSopenharmony_ci            Column.padding({
149423b3eb3cSopenharmony_ci              left: {
149523b3eb3cSopenharmony_ci                'id': -1,
149623b3eb3cSopenharmony_ci                'type': 10002,
149723b3eb3cSopenharmony_ci                params: ['sys.float.padding_level4'],
149823b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
149923b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
150023b3eb3cSopenharmony_ci              },
150123b3eb3cSopenharmony_ci              right: {
150223b3eb3cSopenharmony_ci                'id': -1,
150323b3eb3cSopenharmony_ci                'type': 10002,
150423b3eb3cSopenharmony_ci                params: ['sys.float.padding_level4'],
150523b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
150623b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
150723b3eb3cSopenharmony_ci              },
150823b3eb3cSopenharmony_ci              bottom: {
150923b3eb3cSopenharmony_ci                'id': -1,
151023b3eb3cSopenharmony_ci                'type': 10002,
151123b3eb3cSopenharmony_ci                params: ['sys.float.padding_level12'],
151223b3eb3cSopenharmony_ci                'bundleName': '__harDefaultBundleName__',
151323b3eb3cSopenharmony_ci                'moduleName': '__harDefaultModuleName__'
151423b3eb3cSopenharmony_ci              },
151523b3eb3cSopenharmony_ci            });
151623b3eb3cSopenharmony_ci          }, Column);
151723b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
151823b3eb3cSopenharmony_ci            Text.create(this.selectTitleBarDialog);
151923b3eb3cSopenharmony_ci            Text.fontSize(TEXT_EDITABLE_DIALOG);
152023b3eb3cSopenharmony_ci            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
152123b3eb3cSopenharmony_ci            Text.maxLines(this.maxLines);
152223b3eb3cSopenharmony_ci            Text.width('100%');
152323b3eb3cSopenharmony_ci            Text.textAlign(TextAlign.Center);
152423b3eb3cSopenharmony_ci            Text.fontColor({
152523b3eb3cSopenharmony_ci              'id': -1,
152623b3eb3cSopenharmony_ci              'type': 10001,
152723b3eb3cSopenharmony_ci              params: ['sys.color.font_primary'],
152823b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
152923b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
153023b3eb3cSopenharmony_ci            });
153123b3eb3cSopenharmony_ci          }, Text);
153223b3eb3cSopenharmony_ci          Text.pop();
153323b3eb3cSopenharmony_ci          Column.pop();
153423b3eb3cSopenharmony_ci          Column.pop();
153523b3eb3cSopenharmony_ci        });
153623b3eb3cSopenharmony_ci      } else {
153723b3eb3cSopenharmony_ci        this.ifElseBranchUpdateFunction(1, () => {
153823b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
153923b3eb3cSopenharmony_ci            Column.create();
154023b3eb3cSopenharmony_ci            Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG);
154123b3eb3cSopenharmony_ci            Column.constraintSize({
154223b3eb3cSopenharmony_ci              minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG
154323b3eb3cSopenharmony_ci            });
154423b3eb3cSopenharmony_ci            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
154523b3eb3cSopenharmony_ci            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
154623b3eb3cSopenharmony_ci            Column.borderRadius({
154723b3eb3cSopenharmony_ci              'id': -1,
154823b3eb3cSopenharmony_ci              'type': 10002,
154923b3eb3cSopenharmony_ci              params: ['sys.float.corner_radius_level10'],
155023b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
155123b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
155223b3eb3cSopenharmony_ci            });
155323b3eb3cSopenharmony_ci            Column.justifyContent(FlexAlign.Center);
155423b3eb3cSopenharmony_ci          }, Column);
155523b3eb3cSopenharmony_ci          this.observeComponentCreation2((elmtId, isInitialRender) => {
155623b3eb3cSopenharmony_ci            Image.create(this.selectTitleDialog.value);
155723b3eb3cSopenharmony_ci            Image.width(IMAGE_SIZE);
155823b3eb3cSopenharmony_ci            Image.height(IMAGE_SIZE);
155923b3eb3cSopenharmony_ci            Image.fillColor({
156023b3eb3cSopenharmony_ci              'id': -1,
156123b3eb3cSopenharmony_ci              'type': 10001,
156223b3eb3cSopenharmony_ci              params: ['sys.color.icon_primary'],
156323b3eb3cSopenharmony_ci              'bundleName': '__harDefaultBundleName__',
156423b3eb3cSopenharmony_ci              'moduleName': '__harDefaultModuleName__'
156523b3eb3cSopenharmony_ci            });
156623b3eb3cSopenharmony_ci          }, Image);
156723b3eb3cSopenharmony_ci          Column.pop();
156823b3eb3cSopenharmony_ci        });
156923b3eb3cSopenharmony_ci      }
157023b3eb3cSopenharmony_ci    }, If);
157123b3eb3cSopenharmony_ci    If.pop();
157223b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
157323b3eb3cSopenharmony_ci  }
157423b3eb3cSopenharmony_ci
157523b3eb3cSopenharmony_ci  async aboutToAppear() {
157623b3eb3cSopenharmony_ci    let context = this.getUIContext().getHostContext();
157723b3eb3cSopenharmony_ci    this.mainWindowStage = context.windowStage.getMainWindowSync();
157823b3eb3cSopenharmony_ci    let properties = this.mainWindowStage.getWindowProperties();
157923b3eb3cSopenharmony_ci    let rect = properties.windowRect;
158023b3eb3cSopenharmony_ci    if (px2vp(rect.height) > this.screenWidth) {
158123b3eb3cSopenharmony_ci      this.maxLines = this.verticalScreenLines;
158223b3eb3cSopenharmony_ci    } else {
158323b3eb3cSopenharmony_ci      this.maxLines = this.horizontalsScreenLines;
158423b3eb3cSopenharmony_ci    }
158523b3eb3cSopenharmony_ci  }
158623b3eb3cSopenharmony_ci
158723b3eb3cSopenharmony_ci  rerender() {
158823b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.push(this);
158923b3eb3cSopenharmony_ci    this.updateDirtyElements();
159023b3eb3cSopenharmony_ci    PUV2ViewBase.contextStack && PUV2ViewBase.contextStack.pop();
159123b3eb3cSopenharmony_ci  }
159223b3eb3cSopenharmony_ci}
159323b3eb3cSopenharmony_ciexport default {
159423b3eb3cSopenharmony_ci  SelectTitleBar: SelectTitleBar,
159523b3eb3cSopenharmony_ci};
1596