From c7eae0dc4f72cbe736385d3826bfc3d307f5fe75 Mon Sep 17 00:00:00 2001 From: twx1284053 Date: Wed, 25 Jun 2025 16:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E7=BA=A7=E7=BB=84=E4=BB=B6TabTitleBar?= =?UTF-8?q?=E3=80=81GridObjectSortComponent=E6=A0=BC=E5=BC=8F=E8=A7=84?= =?UTF-8?q?=E8=8C=83=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: twx1284053 --- .../interfaces/gridobjectsortcomponent.js | 933 ++++++++++++++---- .../source/GridObjectSortComponent.ets | 72 +- .../subheader/interfaces/subheader.js | 90 +- .../tabtitlebar/interfaces/tabtitlebar.js | 722 +++++++++++--- .../tabtitlebar/source/tabtitlebar.ets | 126 +-- 5 files changed, 1448 insertions(+), 495 deletions(-) diff --git a/advanced_ui_component/gridobjectsortcomponent/interfaces/gridobjectsortcomponent.js b/advanced_ui_component/gridobjectsortcomponent/interfaces/gridobjectsortcomponent.js index 8a3e5f26523..51cecb61d1e 100644 --- a/advanced_ui_component/gridobjectsortcomponent/interfaces/gridobjectsortcomponent.js +++ b/advanced_ui_component/gridobjectsortcomponent/interfaces/gridobjectsortcomponent.js @@ -14,7 +14,8 @@ */ if (!('finalizeConstruction' in ViewPU.prototype)) { - Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); + Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { + }); } const vibrator = requireNativeModule('ohos.vibrator'); const curves = requireNativeModule('ohos.curves'); @@ -87,11 +88,13 @@ const NO = 'no'; const ADD = 'add'; const EDIT = 'edit'; const DELETE = 'delete'; + export var GridObjectSortComponentType; (function (w107) { w107['IMAGE_TEXT'] = 'image_text'; w107['TEXT'] = 'text'; })(GridObjectSortComponentType || (GridObjectSortComponentType = {})); + export class GridObjectSortComponent extends ViewPU { constructor(n107, o107, p107, q107 = -1, r107 = undefined, s107) { super(n107, p107, q107, s107); @@ -158,13 +161,32 @@ export class GridObjectSortComponent extends ViewPU { this.__editGridHeight = new ObservedPropertySimplePU(0, this, 'editGridHeight'); this.__addGridHeight = new ObservedPropertySimplePU(0, this, 'addGridHeight'); this.__subTitleHeight = new ObservedPropertySimplePU(0, this, 'subTitleHeight'); - this.__isOpenAccessibility = new ObservedPropertySimplePU(accessibility.isScreenReaderOpenSync(), this, 'isOpenAccessibility'); + this.__isOpenAccessibility = + new ObservedPropertySimplePU(accessibility.isScreenReaderOpenSync(), this, 'isOpenAccessibility'); this.callbackId = undefined; this.colNum = COL_IMAGE_TEXT; this.vibrationDone = false; - this.touchDown = { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - this.touchBorderRadius = { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - this.hoverBackgroundColor = { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; + this.touchDown = { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_click_effect'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + this.touchBorderRadius = { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + this.hoverBackgroundColor = { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_hover'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; this.imageText = false; this.onSave = undefined; this.onCancel = undefined; @@ -174,8 +196,10 @@ export class GridObjectSortComponent extends ViewPU { this.__readFlag = new ObservedPropertySimplePU(true, this, 'readFlag'); this.__readIndex4AddArea = new ObservedPropertySimplePU(-1, this, 'readIndex4AddArea'); this.__readIndex4EditArea = new ObservedPropertySimplePU(-1, this, 'readIndex4EditArea'); - this.__isPointToAddTitleBarEditButton = new ObservedPropertySimplePU(false, this, 'isPointToAddTitleBarEditButton'); - this.__isPointToEditTitleBarSaveButton = new ObservedPropertySimplePU(false, this, 'isPointToEditTitleBarSaveButton'); + this.__isPointToAddTitleBarEditButton = + new ObservedPropertySimplePU(false, this, 'isPointToAddTitleBarEditButton'); + this.__isPointToEditTitleBarSaveButton = + new ObservedPropertySimplePU(false, this, 'isPointToEditTitleBarSaveButton'); this.preTextAnnouncedForAccessibility = ''; this.textAnnouncedForAccessibility = ''; this.envCallback = { @@ -184,13 +208,15 @@ export class GridObjectSortComponent extends ViewPU { this.fontSizeScale = this.decideFontScale(v107); this.fontWeightScale = u107.fontWeightScale; }, - onMemoryLevel: (t107) => { } + onMemoryLevel: (t107) => { + } }; this.setInitiallyProvidedValue(o107); this.declareWatch('gridComState', this.onGridComStateChange); this.declareWatch('fontSizeScale', this.calcAreaInfo); this.finalizeConstruction(); } + setInitiallyProvidedValue(m107) { if (m107.options === undefined) { this.__options.set({}); @@ -406,9 +432,11 @@ export class GridObjectSortComponent extends ViewPU { this.envCallback = m107.envCallback; } } + updateStateVars(l107) { this.__options.reset(l107.options); } + purgeVariableDependenciesOnElmtId(k107) { this.__options.purgeDependencyOnElmtId(k107); this.__selected.purgeDependencyOnElmtId(k107); @@ -466,6 +494,7 @@ export class GridObjectSortComponent extends ViewPU { this.__isPointToAddTitleBarEditButton.purgeDependencyOnElmtId(k107); this.__isPointToEditTitleBarSaveButton.purgeDependencyOnElmtId(k107); } + aboutToBeDeleted() { this.__options.aboutToBeDeleted(); this.__selected.aboutToBeDeleted(); @@ -525,340 +554,453 @@ export class GridObjectSortComponent extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + get options() { return this.__options.get(); } + set options(j107) { this.__options.set(j107); } + get selected() { return this.__selected.get(); } + set selected(i107) { this.__selected.set(i107); } + get unSelected() { return this.__unSelected.get(); } + set unSelected(h107) { this.__unSelected.set(h107); } + get copySelected() { return this.__copySelected.get(); } + set copySelected(g107) { this.__copySelected.set(g107); } + get copyUnSelected() { return this.__copyUnSelected.get(); } + set copyUnSelected(f107) { this.__copyUnSelected.set(f107); } + get content() { return this.__content.get(); } + set content(e107) { this.__content.set(e107); } + get dragContent() { return this.__dragContent.get(); } + set dragContent(d107) { this.__dragContent.set(d107); } + get dragContentIndex() { return this.__dragContentIndex.get(); } + set dragContentIndex(c107) { this.__dragContentIndex.set(c107); } + get hoverId() { return this.__hoverId.get(); } + set hoverId(b107) { this.__hoverId.set(b107); } + get gridComState() { return this.__gridComState.get(); } + set gridComState(a107) { this.__gridComState.set(a107); } + get menuSwitch() { return this.__menuSwitch.get(); } + set menuSwitch(z106) { this.__menuSwitch.set(z106); } + get areaWidth() { return this.__areaWidth.get(); } + set areaWidth(y106) { this.__areaWidth.set(y106); } + get blockWidth() { return this.__blockWidth.get(); } + set blockWidth(x106) { this.__blockWidth.set(x106); } + get blockHeight() { return this.__blockHeight.get(); } + set blockHeight(w106) { this.__blockHeight.set(w106); } + get longScaleOnePointTwo() { return this.__longScaleOnePointTwo.get(); } + set longScaleOnePointTwo(v106) { this.__longScaleOnePointTwo.set(v106); } + get scaleGridItemNinetyPercent() { return this.__scaleGridItemNinetyPercent.get(); } + set scaleGridItemNinetyPercent(u106) { this.__scaleGridItemNinetyPercent.set(u106); } + get reboundSize() { return this.__reboundSize.get(); } + set reboundSize(t106) { this.__reboundSize.set(t106); } + get scaleIcon() { return this.__scaleIcon.get(); } + set scaleIcon(s106) { this.__scaleIcon.set(s106); } + get addIconShow() { return this.__addIconShow.get(); } + set addIconShow(r106) { this.__addIconShow.set(r106); } + get scaleAddIcon() { return this.__scaleAddIcon.get(); } + set scaleAddIcon(q106) { this.__scaleAddIcon.set(q106); } + get isStartDrag() { return this.__isStartDrag.get(); } + set isStartDrag(p106) { this.__isStartDrag.set(p106); } + get insertIndex() { return this.__insertIndex.get(); } + set insertIndex(o106) { this.__insertIndex.set(o106); } + get itemIndex() { return this.__itemIndex.get(); } + set itemIndex(n106) { this.__itemIndex.set(n106); } + get editGridDataLength() { return this.__editGridDataLength.get(); } + set editGridDataLength(m106) { this.__editGridDataLength.set(m106); } + get isTouchDown() { return this.__isTouchDown.get(); } + set isTouchDown(l106) { this.__isTouchDown.set(l106); } + get addItemMoveX() { return this.__addItemMoveX.get(); } + set addItemMoveX(k106) { this.__addItemMoveX.set(k106); } + get addItemMoveY() { return this.__addItemMoveY.get(); } + set addItemMoveY(j106) { this.__addItemMoveY.set(j106); } + get editItemMoveX() { return this.__editItemMoveX.get(); } + set editItemMoveX(i106) { this.__editItemMoveX.set(i106); } + get editItemMoveY() { return this.__editItemMoveY.get(); } + set editItemMoveY(h106) { this.__editItemMoveY.set(h106); } + get unSelectedIndex() { return this.__unSelectedIndex.get(); } + set unSelectedIndex(g106) { this.__unSelectedIndex.set(g106); } + get clickAddBtn() { return this.__clickAddBtn.get(); } + set clickAddBtn(f106) { this.__clickAddBtn.set(f106); } + get selectedIndex() { return this.__selectedIndex.get(); } + set selectedIndex(e106) { this.__selectedIndex.set(e106); } + get clickRemoveBtn() { return this.__clickRemoveBtn.get(); } + set clickRemoveBtn(d106) { this.__clickRemoveBtn.set(d106); } + get addAreaLongPressGesture() { return this.__addAreaLongPressGesture.get(); } + set addAreaLongPressGesture(c106) { this.__addAreaLongPressGesture.set(c106); } + get arraySelectIsChange() { return this.__arraySelectIsChange.get(); } + set arraySelectIsChange(b106) { this.__arraySelectIsChange.set(b106); } + get arrayUnSelectIsChange() { return this.__arrayUnSelectIsChange.get(); } + set arrayUnSelectIsChange(a106) { this.__arrayUnSelectIsChange.set(a106); } + get textItemEditWidth() { return this.__textItemEditWidth.get(); } + set textItemEditWidth(z105) { this.__textItemEditWidth.set(z105); } + get textItemEditHeight() { return this.__textItemEditHeight.get(); } + set textItemEditHeight(y105) { this.__textItemEditHeight.set(y105); } + get imageItemWidth() { return this.__imageItemWidth.get(); } + set imageItemWidth(x105) { this.__imageItemWidth.set(x105); } + get saveClick() { return this.__saveClick.get(); } + set saveClick(w105) { this.__saveClick.set(w105); } + get imageTextAddIconShow() { return this.__imageTextAddIconShow.get(); } + set imageTextAddIconShow(v105) { this.__imageTextAddIconShow.set(v105); } + get imageTextRemoveIconShow() { return this.__imageTextRemoveIconShow.get(); } + set imageTextRemoveIconShow(u105) { this.__imageTextRemoveIconShow.set(u105); } + get firstIn() { return this.__firstIn.get(); } + set firstIn(t105) { this.__firstIn.set(t105); } + get fontSizeScale() { return this.__fontSizeScale.get(); } + set fontSizeScale(s105) { this.__fontSizeScale.set(s105); } + get fontWeightScale() { return this.__fontWeightScale.get(); } + set fontWeightScale(r105) { this.__fontWeightScale.set(r105); } + get customColumns() { return this.__customColumns.get(); } + set customColumns(q105) { this.__customColumns.set(q105); } + get editGridHeight() { return this.__editGridHeight.get(); } + set editGridHeight(p105) { this.__editGridHeight.set(p105); } + get addGridHeight() { return this.__addGridHeight.get(); } + set addGridHeight(o105) { this.__addGridHeight.set(o105); } + get subTitleHeight() { return this.__subTitleHeight.get(); } + set subTitleHeight(n105) { this.__subTitleHeight.set(n105); } + get isOpenAccessibility() { return this.__isOpenAccessibility.get(); } + set isOpenAccessibility(m105) { this.__isOpenAccessibility.set(m105); } + get readFlag() { return this.__readFlag.get(); } + set readFlag(l105) { this.__readFlag.set(l105); } + get readIndex4AddArea() { return this.__readIndex4AddArea.get(); } + set readIndex4AddArea(k105) { this.__readIndex4AddArea.set(k105); } + get readIndex4EditArea() { return this.__readIndex4EditArea.get(); } + set readIndex4EditArea(j105) { this.__readIndex4EditArea.set(j105); } + get isPointToAddTitleBarEditButton() { return this.__isPointToAddTitleBarEditButton.get(); } + set isPointToAddTitleBarEditButton(i105) { this.__isPointToAddTitleBarEditButton.set(i105); } + get isPointToEditTitleBarSaveButton() { return this.__isPointToEditTitleBarSaveButton.get(); } + set isPointToEditTitleBarSaveButton(h105) { this.__isPointToEditTitleBarSaveButton.set(h105); } + aboutToAppear() { this.dataList.length = 50; - this.selected = this.dataList && this.deduplicate(this.dataList).filter(g105 => g105.selected).sort(this.sortBy()); - this.unSelected = this.dataList && this.deduplicate(this.dataList).filter(f105 => !f105.selected).sort(this.sortBy()); + this.selected = + this.dataList && this.deduplicate(this.dataList).filter(g105 => g105.selected).sort(this.sortBy()); + this.unSelected = + this.dataList && this.deduplicate(this.dataList).filter(f105 =>!f105.selected).sort(this.sortBy()); this.copySelected = this.selected.slice(); this.copyUnSelected = this.unSelected.slice(); this.editGridDataLength = this.selected.length; @@ -870,19 +1012,19 @@ export class GridObjectSortComponent extends ViewPU { this.fontSizeScale = this.decideFontScale(e105); this.fontWeightScale = e105.getHostContext()?.config?.fontWeightScale ?? DEFAULT_FONT_WEIGHT_SCALE; - } - catch (b105) { + } catch (b105) { let c105 = b105.code; let d105 = b105.message; - hilog.error(0x3900, 'Ace', `GridObjectSortComponent Faild to init fontsizescale info, code:${c105}, message: ${d105}`); + hilog.error(0x3900, 'Ace', + `GridObjectSortComponent Faild to init fontsizescale info, code:${c105}, message: ${d105}`); } try { this.callbackId = getContext()?.getApplicationContext()?.on('environment', this.envCallback); - } - catch (y104) { + } catch (y104) { let z104 = y104?.code; let a105 = y104?.message; - hilog.error(0x3900, 'Ace', `GridObjectSortComponent Faild to get environment param error: ${z104}, ${a105}`); + hilog.error(0x3900, 'Ace', + `GridObjectSortComponent Faild to get environment param error: ${z104}, ${a105}`); } this.calcGridHeight(); setTimeout(() => { @@ -893,6 +1035,7 @@ export class GridObjectSortComponent extends ViewPU { this.isOpenAccessibility = x104; }); } + getAdaptiveSymbolFontSize() { let w104 = this.fontSizeScale; if (!this.isFollowingSystemFontScale || w104 === undefined) { @@ -902,6 +1045,7 @@ export class GridObjectSortComponent extends ViewPU { w104 = Math.max(w104, MIN_FONT_SCALE); return (w104 * SYMBOL_SIZE_12FP).toString() + 'vp'; } + getSymbolFontSizeFrom(v104) { if (v104 === undefined) { return SYMBOL_DEFAULT; @@ -911,10 +1055,17 @@ export class GridObjectSortComponent extends ViewPU { } return v104; } + calcTextItemEditHeight() { let u104 = MeasureText.measureTextSize({ textContent: this.dataList[0]?.text ?? '', - fontSize: `${(LengthMetrics.resource({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' })?.value ?? + fontSize: `${(LengthMetrics.resource({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + })?.value ?? DEFAULT_TEXT_SIZE) * (this.fontSizeScale ?? DEFAULT_FONT_SIZE_SCALE)}vp`, overflow: TextOverflow.Ellipsis, maxLines: TEXT_MAX_LINES @@ -923,6 +1074,7 @@ export class GridObjectSortComponent extends ViewPU { GRID_ITEM_HEIGHT_TEXT : px2vp(u104.height); this.textItemEditHeight = this.textItemEditHeight + PADDING_EIGHT * 2; } + decideFontScale(s104) { if (!this.isFollowingSystemFontScale) { return 1; @@ -930,16 +1082,17 @@ export class GridObjectSortComponent extends ViewPU { let t104 = s104.getHostContext()?.config?.fontSizeScale ?? DEFAULT_FONT_SIZE_SCALE; return Math.min(t104, this.maxAppFontScale, MAX_FONT_SCALE); } + calcColNum() { if (this.imageText || (this.fontSizeScale && this.fontSizeScale > DEFAULT_FONT_SIZE_SCALE)) { this.customColumns = GRID_COL_3; this.colNum = COL_IMAGE_TEXT; - } - else { + } else { this.customColumns = GRID_COL_4; this.colNum = COL_TEXT; } } + aboutToDisappear() { Context.animateTo({ duration: ENTER_EXIT_ICON_DURATION, @@ -958,6 +1111,7 @@ export class GridObjectSortComponent extends ViewPU { this.callbackId = void (0); } } + deduplicate(o104) { const p104 = []; o104.forEach(q104 => { @@ -967,6 +1121,7 @@ export class GridObjectSortComponent extends ViewPU { }); return p104; } + onGridComStateChange() { this.textItemEditWidth = this.gridComState ? this.blockWidth - 24 : this.blockWidth - 16; if (!this.imageText) { @@ -975,11 +1130,13 @@ export class GridObjectSortComponent extends ViewPU { this.textItemEditHeight + DEFAULT_BLOCK_TEXT_ITEM_SAFE_MARGIN; } } + sortBy() { return (m104, n104) => { return m104.order - n104.order; }; } + cancelEdit() { if (this.isStartDrag || this.clickAddBtn || this.clickRemoveBtn) { return; @@ -1004,6 +1161,7 @@ export class GridObjectSortComponent extends ViewPU { this.isPointToAddTitleBarEditButton = true; this.onCancel && this.onCancel(); } + goEdit() { Context.animateTo({ duration: ENTER_EXIT_ICON_DURATION, @@ -1015,6 +1173,7 @@ export class GridObjectSortComponent extends ViewPU { this.isPointToEditTitleBarSaveButton = true; this.calcGridHeight(); } + pointToEditTitleBarSaveButton() { if (this.isPointToEditTitleBarSaveButton) { let k104 = this.getUIContext().getFrameNodeById(EDIT_TITLE_BAR_ID)?.getFirstChild()?.getUniqueId(); @@ -1033,6 +1192,7 @@ export class GridObjectSortComponent extends ViewPU { }, SEND_EVENT_DURATION); } } + onSaveEdit() { if (this.isStartDrag) { return; @@ -1064,6 +1224,7 @@ export class GridObjectSortComponent extends ViewPU { this.menuSwitch = false; this.isPointToAddTitleBarEditButton = true; } + pointToAddTitleBarEditButton() { if (this.isPointToAddTitleBarEditButton) { let g104 = this.getUIContext()?.getFrameNodeById(ADD_TITLE_BAR_ID)?.getFirstChild()?.getUniqueId(); @@ -1080,6 +1241,7 @@ export class GridObjectSortComponent extends ViewPU { }); } } + onDragMoveEvent(c104, d104, e104) { if (!this.gridComState || (c104.x < this.blockWidth / 3 && c104.y < this.blockHeight / 3)) { return; @@ -1087,9 +1249,9 @@ export class GridObjectSortComponent extends ViewPU { let f104 = e104; if (f104 < 0) { f104 = this.selected.length - 1; - } - else { - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_MOVING, Math.floor(e104 / this.colNum) + 1, e104 % this.colNum + 1); + } else { + this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_MOVING, + Math.floor(e104 / this.colNum) + 1, e104 % this.colNum + 1); } if (this.dragContent.visibility !== Visibility.Hidden) { this.dragContent.visibility = Visibility.Hidden; @@ -1099,6 +1261,7 @@ export class GridObjectSortComponent extends ViewPU { } this.insertIndex = e104; } + sendAccessibility() { if (this.preTextAnnouncedForAccessibility !== this.textAnnouncedForAccessibility) { let b104 = ({ @@ -1111,6 +1274,7 @@ export class GridObjectSortComponent extends ViewPU { this.preTextAnnouncedForAccessibility = this.textAnnouncedForAccessibility; } } + handleDeleteClick(x103) { if (this.clickAddBtn || this.clickRemoveBtn) { return; @@ -1122,25 +1286,29 @@ export class GridObjectSortComponent extends ViewPU { this.content = x103; this.selectedIndex = y103; this.calcGridHeight(); - Context.animateTo({ curve: REMOVE_ADD_SPRING, onFinish: () => { - this.scaleIcon = 1; - this.selected.splice(y103, 1); - this.unSelected.unshift(x103); - this.calcGridHeight(); - this.editGridDataLength = this.editGridDataLength - 1; - this.editItemMoveX = 0; - this.editItemMoveY = 0; - this.arraySelectIsChange = 2; - this.clickRemoveBtn = false; - this.readFlag = false; - this.readIndex4AddArea = 0; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_DELETED, this.getAccessibilityText(this.content?.text ?? ' ')); - } }, () => { + Context.animateTo({ + curve: REMOVE_ADD_SPRING, onFinish: () => { + this.scaleIcon = 1; + this.selected.splice(y103, 1); + this.unSelected.unshift(x103); + this.calcGridHeight(); + this.editGridDataLength = this.editGridDataLength - 1; + this.editItemMoveX = 0; + this.editItemMoveY = 0; + this.arraySelectIsChange = 2; + this.clickRemoveBtn = false; + this.readFlag = false; + this.readIndex4AddArea = 0; + this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_DELETED, + this.getAccessibilityText(this.content?.text ?? ' ')); + } + }, () => { let z103 = this.getAddItemGridPosition(); this.editItemMoveX = z103.x; this.editItemMoveY = z103.y; }); } + pointToAddArea() { let w103 = ({ type: 'requestFocusForAccessibility', @@ -1155,6 +1323,7 @@ export class GridObjectSortComponent extends ViewPU { }, ENTER_EXIT_ICON_DURATION); }); } + getNewData(r103, s103, t103) { return r103.map((u103, v103) => { u103.selected = s103; @@ -1163,14 +1332,17 @@ export class GridObjectSortComponent extends ViewPU { return u103; }); } + getBlockWidth() { const q103 = (this.areaWidth - 32) / this.colNum; return q103; } + calcGridHeight() { this.editGridHeight = this.getGridHeight(this.selected, EDIT); this.addGridHeight = this.getGridHeight(this.unSelected); } + getGridHeight(i103, j103) { let k103 = 0; let l103 = i103.length; @@ -1183,14 +1355,11 @@ export class GridObjectSortComponent extends ViewPU { let n103 = l103 % this.colNum === 0; if (this.clickAddBtn && n103) { m103 = 1; - } - else if (this.isStartDrag && n103 && j103) { + } else if (this.isStartDrag && n103 && j103) { m103 = 1; - } - else if (this.clickRemoveBtn && n103 && !j103) { + } else if (this.clickRemoveBtn && n103 && !j103) { m103 = 1; - } - else { + } else { m103 = 0; } let o103 = Math.ceil(l103 / this.colNum) + m103; @@ -1200,21 +1369,49 @@ export class GridObjectSortComponent extends ViewPU { } return k103; } + imageTextRemoveIcon(f103) { const g103 = this.clickRemoveBtn && this.content.id === f103.id; - const h103 = g103 ? { 'id': -1, 'type': 40000, params: ['sys.symbol.plus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; + const h103 = g103 ? { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.plus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; return h103; } + imageTextAddIcon(c103) { const d103 = this.clickAddBtn && this.content.id === c103.id && this.gridComState; - const e103 = d103 ? { 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 40000, params: ['sys.symbol.plus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; + const e103 = d103 ? { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.plus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; return e103; } + imageTextAddIconVisible(z102) { const a103 = this.clickAddBtn && this.content.id === z102.id && !this.gridComState; const b103 = a103 ? Visibility.Hidden : Visibility.Visible; return b103; } + getCoodXY(u102) { let v102 = 0; let w102 = 0; @@ -1225,19 +1422,16 @@ export class GridObjectSortComponent extends ViewPU { if (y102 === 0) { v102 = v102 + this.blockWidth * (x102 - 1); w102 = w102 - this.blockHeight; - } - else { + } else { v102 = v102 - this.blockWidth; } } - } - else { + } else { if (u102 >= this.insertIndex) { if (y102 === x102 - 1) { v102 = v102 - this.blockWidth * (x102 - 1); w102 = w102 + this.blockHeight; - } - else { + } else { v102 = v102 + this.blockWidth; } } @@ -1248,6 +1442,7 @@ export class GridObjectSortComponent extends ViewPU { } return { x: v102, y: w102 }; } + getAddItemGridPosition() { const i102 = this.selected.length; const j102 = this.colNum; @@ -1258,8 +1453,7 @@ export class GridObjectSortComponent extends ViewPU { let o102 = 0; if (k102 === 0) { o102 = n102 || (this.fontSizeScale && this.fontSizeScale > 1) ? -this.blockWidth * 2 : -this.blockWidth * 3; - } - else { + } else { o102 = -this.blockWidth * (k102 - 1); } let p102 = SUBTITLE_HEIGHT; @@ -1276,6 +1470,7 @@ export class GridObjectSortComponent extends ViewPU { y: q102 }; } + getCoveringGridPosition(f102) { let g102 = 0; let h102 = 0; @@ -1288,6 +1483,7 @@ export class GridObjectSortComponent extends ViewPU { y: h102 }; } + getEditItemGridPosition(t101, u101) { const v101 = t101.length; const w101 = this.colNum; @@ -1296,11 +1492,9 @@ export class GridObjectSortComponent extends ViewPU { let z101 = Math.abs(x101 - y101) * this.blockWidth; if (x101 < y101) { z101 = -z101; - } - else if (x101 > y101) { + } else if (x101 > y101) { z101 = z101; - } - else { + } else { z101 = 0; } let a102 = 0; @@ -1310,8 +1504,7 @@ export class GridObjectSortComponent extends ViewPU { const e102 = !this.imageText && this.gridComState && u101 > 3; if (e102) { b102 = (c102 + 1) * (this.blockHeight - 8) + 8; - } - else { + } else { b102 = (c102 + 1) * this.blockHeight; } if (this.fontSizeScale && this.fontSizeScale > 1) { @@ -1323,6 +1516,7 @@ export class GridObjectSortComponent extends ViewPU { y: a102 }; } + getCoveringGridPositionBottom(o101) { let p101 = 0; let q101 = 0; @@ -1337,6 +1531,7 @@ export class GridObjectSortComponent extends ViewPU { y: q101 }; } + getAddItemRightMove(k101) { let l101 = this.blockWidth; let m101 = 0; @@ -1347,6 +1542,7 @@ export class GridObjectSortComponent extends ViewPU { } return { x: l101, y: m101 }; } + getShowAreaItemTranslate(h101) { if (this.isStartDrag) { let j101 = this.getCoodXY(h101); @@ -1370,6 +1566,7 @@ export class GridObjectSortComponent extends ViewPU { } return { x: 0, y: 0 }; } + getAddAreaItemTranslate(e101) { if (this.clickRemoveBtn) { let g101 = this.getAddItemRightMove(e101); @@ -1393,6 +1590,7 @@ export class GridObjectSortComponent extends ViewPU { } return { x: 0, y: 0 }; } + PixelMapBuilder(d100, e100, f100 = null) { this.observeComponentCreation2((c101, d101) => { Stack.create({ alignContent: Alignment.Center }); @@ -1427,8 +1625,7 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.fontSize(this.getSymbolFontSizeFrom(this.options.imageSize)); }, SymbolGlyph); }); - } - else if (d100 instanceof SymbolGlyphModifier) { + } else if (d100 instanceof SymbolGlyphModifier) { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((w100, x100) => { SymbolGlyph.create(); @@ -1440,8 +1637,7 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(2, () => { this.observeComponentCreation2((u100, v100) => { Image.create(d100); @@ -1456,7 +1652,13 @@ export class GridObjectSortComponent extends ViewPU { this.observeComponentCreation2((q100, r100) => { Text.create(e100); Text.textAlign(TextAlign.Center); - Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontSize({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.margin({ top: 2 }); Text.maxLines(TEXT_MAX_LINES); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); @@ -1465,11 +1667,23 @@ export class GridObjectSortComponent extends ViewPU { }, Text); Text.pop(); this.observeComponentCreation2((o100, p100) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); SymbolGlyph.fontSize(SYMBOL_SIZE_24VP); SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.width(ICON_SIZE); SymbolGlyph.height(ICON_SIZE); SymbolGlyph.position({ @@ -1479,8 +1693,7 @@ export class GridObjectSortComponent extends ViewPU { }, SymbolGlyph); Column.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((m100, n100) => { Row.create(); @@ -1492,14 +1705,32 @@ export class GridObjectSortComponent extends ViewPU { Row.scale({ x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo }); Row.alignItems(VerticalAlign.Center); Row.justifyContent(FlexAlign.Center); - Row.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_button_normal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Row.backgroundColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_button_normal'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Row.width(this.textItemEditWidth); Row.height(this.textItemEditHeight); }, Row); this.observeComponentCreation2((k100, l100) => { Text.create(e100); - Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); - Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_text_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); + Text.fontSize({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.textAlign(TextAlign.Center); Text.maxLines(TEXT_MAX_LINES); @@ -1508,11 +1739,23 @@ export class GridObjectSortComponent extends ViewPU { }, Text); Text.pop(); this.observeComponentCreation2((i100, j100) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); SymbolGlyph.fontSize(SYMBOL_SIZE_24VP); SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.width(ICON_SIZE); SymbolGlyph.height(ICON_SIZE); SymbolGlyph.position({ @@ -1527,6 +1770,7 @@ export class GridObjectSortComponent extends ViewPU { If.pop(); Stack.pop(); } + HeaderTitleBuilder(l99 = null) { this.observeComponentCreation2((y99, z99) => { __Common__.create(); @@ -1535,8 +1779,7 @@ export class GridObjectSortComponent extends ViewPU { __Common__.onVisibleAreaChange([0.0, 1.0], (a100, b100) => { if (a100) { this.pointToAddTitleBarEditButton(); - } - else { + } else { if (this.isPointToEditTitleBarSaveButton) { try { let c100 = ({ @@ -1561,28 +1804,89 @@ export class GridObjectSortComponent extends ViewPU { this.observeComponentCreation2((u99, v99) => { if (v99) { let w99 = new ComposeTitleBar(this, { - title: this.options.normalTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_title_chanel'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + title: this.options.normalTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_title_chanel'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, menuItems: [{ - value: { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_edit'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - symbolStyle: (new SymbolGlyphModifier({ 'id': -1, 'type': 40000, params: ['sys.symbol.square_and_pencil'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' })), + value: { + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_edit'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + symbolStyle: (new SymbolGlyphModifier({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.square_and_pencil'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + })), isEnabled: true, - label: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - accessibilityText: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + label: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + accessibilityText: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, action: () => { this.goEdit(); } }] - }, undefined, u99, () => { }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 948, col: 5 }); + }, undefined, u99, () => { + }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 948, col: 5 }); ViewPU.create(w99); let x99 = () => { return { - title: this.options.normalTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_title_chanel'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + title: this.options.normalTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_title_chanel'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, menuItems: [{ - value: { 'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_edit'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - symbolStyle: (new SymbolGlyphModifier({ 'id': -1, 'type': 40000, params: ['sys.symbol.square_and_pencil'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' })), + value: { + 'id': -1, + 'type': 20000, + params: ['sys.media.ohos_ic_public_edit'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + symbolStyle: (new SymbolGlyphModifier({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.square_and_pencil'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + })), isEnabled: true, - label: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - accessibilityText: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + label: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + accessibilityText: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_header_edit_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, action: () => { this.goEdit(); } @@ -1590,8 +1894,7 @@ export class GridObjectSortComponent extends ViewPU { }; }; w99.paramsGenerator_ = x99; - } - else { + } else { this.updateStateVarsOfChildByElmtId(u99, {}); } }, { name: 'ComposeTitleBar' }); @@ -1614,48 +1917,97 @@ export class GridObjectSortComponent extends ViewPU { leftIconStyle: EditableLeftIconType.Cancel, isSaveIconRequired: false, menuItems: [{ - value: { 'id': -1, 'type': 40000, params: ['sys.symbol.checkmark'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - label: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - accessibilityText: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + value: { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.checkmark'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + label: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + accessibilityText: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, action: () => { this.saveClick = true; this.onSaveEdit(); } }], - title: this.options.editTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_title_edit'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + title: this.options.editTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_title_edit'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, onCancel: () => { this.cancelEdit(); }, - }, undefined, m99, () => { }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 979, col: 5 }); + }, undefined, m99, () => { + }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 979, col: 5 }); ViewPU.create(o99); let p99 = () => { return { leftIconStyle: EditableLeftIconType.Cancel, isSaveIconRequired: false, menuItems: [{ - value: { 'id': -1, 'type': 40000, params: ['sys.symbol.checkmark'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - label: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - accessibilityText: { 'id': -1, 'type': 10003, params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + value: { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.checkmark'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + label: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + accessibilityText: { + 'id': -1, + 'type': 10003, + params: ['sys.string.gridobjectsortcomponent_accessibility_complete_button'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, action: () => { this.saveClick = true; this.onSaveEdit(); } }], - title: this.options.editTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_title_edit'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + title: this.options.editTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_title_edit'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, onCancel: () => { this.cancelEdit(); } }; }; o99.paramsGenerator_ = p99; - } - else { + } else { this.updateStateVarsOfChildByElmtId(m99, {}); } }, { name: 'EditableTitleBar' }); } __Common__.pop(); } + ImageTextBuilder(o98, p98, q98 = null) { this.observeComponentCreation2((j99, k99) => { Column.create(); @@ -1673,7 +2025,8 @@ export class GridObjectSortComponent extends ViewPU { o98.id === this.hoverId ? this.touchBorderRadius : 0); Column.backgroundColor(this.isTouchDown && o98.id === this.content.id ? this.touchDown : o98.id === this.hoverId ? this.hoverBackgroundColor : ''); - Column.scale(o98.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : {}); + Column.scale(o98.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : + {}); }, Column); this.observeComponentCreation2((x98, y98) => { If.create(); @@ -1687,8 +2040,7 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((z98, a99) => { If.create(); @@ -1700,8 +2052,7 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.fontSize(this.getSymbolFontSizeFrom(this.options.imageSize)); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((b99, c99) => { Image.create(o98.url); @@ -1720,7 +2071,13 @@ export class GridObjectSortComponent extends ViewPU { this.observeComponentCreation2((v98, w98) => { Text.create(o98.text); Text.textAlign(TextAlign.Center); - Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontSize({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.margin({ top: 2 }); Text.maxLines(TEXT_MAX_LINES); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); @@ -1738,7 +2095,13 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); SymbolGlyph.visibility(p98 === 'add' ? this.imageTextAddIconVisible(o98) : Visibility.Hidden); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.width(ICON_SIZE); SymbolGlyph.height(ICON_SIZE); SymbolGlyph.position({ @@ -1747,14 +2110,21 @@ export class GridObjectSortComponent extends ViewPU { }); SymbolGlyph.onClick(() => this.handleAddIconClick(o98)); SymbolGlyph.accessibilityLevel(YES); - SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_BUTTON, this.getAccessibilityText(o98.text))); + SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_BUTTON, + this.getAccessibilityText(o98.text))); }, SymbolGlyph); this.observeComponentCreation2((r98, s98) => { SymbolGlyph.create(this.imageTextRemoveIcon(o98)); SymbolGlyph.fontSize(SYMBOL_SIZE_24VP); SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.visibility(p98 === 'delete' && this.gridComState ? Visibility.Visible : Visibility.Hidden); SymbolGlyph.width(ICON_SIZE); @@ -1765,11 +2135,13 @@ export class GridObjectSortComponent extends ViewPU { }); SymbolGlyph.onClick(() => this.handleDeleteClick(o98)); SymbolGlyph.accessibilityLevel(YES); - SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DELETE, this.getAccessibilityText(o98.text))); + SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DELETE, + this.getAccessibilityText(o98.text))); }, SymbolGlyph); Column.pop(); Column.pop(); } + handleAddIconClick(j98) { if (this.clickAddBtn || this.clickRemoveBtn) { return; @@ -1806,12 +2178,16 @@ export class GridObjectSortComponent extends ViewPU { }); this.readFlag = false; this.readIndex4EditArea = this.editGridDataLength - 1; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, this.getAccessibilityText(this.content?.text ?? ''), Math.floor(this.readIndex4EditArea / this.colNum) + 1, this.readIndex4EditArea % this.colNum + 1); + this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, + this.getAccessibilityText(this.content?.text ?? ''), Math.floor(this.readIndex4EditArea / this.colNum) + 1, + this.readIndex4EditArea % this.colNum + 1); } + TextBlockBuilder(v97, w97 = null) { this.observeComponentCreation2((h98, i98) => { Stack.create(); - Stack.scale(v97.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : {}); + Stack.scale(v97.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : + {}); Stack.padding({ left: MARGIN_EIGHT, right: MARGIN_EIGHT @@ -1831,7 +2207,13 @@ export class GridObjectSortComponent extends ViewPU { v97.id === this.content.id ? { x: 0 } : { x: -4 } : { x: 0 }); Row.height('100%'); Context.animation(null); - Row.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_button_normal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Row.backgroundColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_button_normal'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); }, Row); Row.pop(); this.observeComponentCreation2((d98, e98) => { @@ -1856,23 +2238,48 @@ export class GridObjectSortComponent extends ViewPU { Context.animation(null); }, Flex); this.observeComponentCreation2((b98, c98) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.plus'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.plus'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Context.animation({ duration: ENTER_EXIT_ICON_DURATION, curve: COMMON_BEZIER }); SymbolGlyph.fontSize(this.getAdaptiveSymbolFontSize()); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); - SymbolGlyph.visibility(this.clickRemoveBtn && v97.id === this.content.id ? Visibility.Visible : Visibility.None); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_text_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); + SymbolGlyph.visibility(this.clickRemoveBtn && v97.id === this.content.id ? Visibility.Visible : + Visibility.None); SymbolGlyph.transition({ type: TransitionType.All, scale: { x: 0, y: 0, } }); SymbolGlyph.margin({ right: 4 }); Context.animation(null); }, SymbolGlyph); this.observeComponentCreation2((z97, a98) => { Text.create(v97.text); - Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); - Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_text_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); + Text.fontSize({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.textAlign(TextAlign.Center); Text.maxLines(TEXT_MAX_LINES); @@ -1881,7 +2288,13 @@ export class GridObjectSortComponent extends ViewPU { }, Text); Text.pop(); this.observeComponentCreation2((x97, y97) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Context.animation({ duration: ENTER_EXIT_ICON_DURATION, curve: COMMON_BEZIER, @@ -1889,7 +2302,13 @@ export class GridObjectSortComponent extends ViewPU { SymbolGlyph.fontSize(SYMBOL_SIZE_24VP); SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.width(ICON_SIZE); SymbolGlyph.transition({ type: TransitionType.All, scale: { x: 0, y: 0, centerX: '50%' } }); SymbolGlyph.scale(v97.id === this.content.id ? { x: this.scaleIcon, y: this.scaleIcon } : {}); @@ -1901,15 +2320,18 @@ export class GridObjectSortComponent extends ViewPU { Context.animation(null); SymbolGlyph.onClick(() => this.handleDeleteClick(v97)); SymbolGlyph.accessibilityLevel(YES); - SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DELETE, this.getAccessibilityText(v97.text))); + SymbolGlyph.accessibilityText(this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DELETE, + this.getAccessibilityText(v97.text))); }, SymbolGlyph); Flex.pop(); Stack.pop(); } + TextBlockAddItemBuilder(f97, g97 = null) { this.observeComponentCreation2((t97, u97) => { Stack.create(); - Stack.scale(f97.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : {}); + Stack.scale(f97.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : + {}); Stack.padding({ left: MARGIN_EIGHT, right: MARGIN_EIGHT @@ -1927,7 +2349,13 @@ export class GridObjectSortComponent extends ViewPU { Row.width(this.addIconShow && f97.id === this.content.id ? this.textItemEditWidth : '100%'); Row.translate(this.addIconShow && f97.id === this.content.id && this.gridComState ? { x: -4 } : { x: 0 }); Context.animation(null); - Row.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_button_normal'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Row.backgroundColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_button_normal'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); }, Row); Row.pop(); this.observeComponentCreation2((p97, q97) => { @@ -1949,22 +2377,41 @@ export class GridObjectSortComponent extends ViewPU { Flex.height('100%'); }, Flex); this.observeComponentCreation2((n97, o97) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.plus'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.plus'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Context.animation({ duration: ENTER_EXIT_ICON_DURATION, curve: COMMON_BEZIER }); SymbolGlyph.fontSize(this.getAdaptiveSymbolFontSize()); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); - SymbolGlyph.visibility(this.addIconShow && f97.id === this.content.id ? Visibility.None : Visibility.Visible); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_text_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); + SymbolGlyph.visibility(this.addIconShow && f97.id === this.content.id ? Visibility.None : + Visibility.Visible); SymbolGlyph.transition({ type: TransitionType.All, scale: { x: 0, y: 0 } }); SymbolGlyph.margin({ right: 4 }); Context.animation(null); }, SymbolGlyph); this.observeComponentCreation2((l97, m97) => { Text.create(f97.text); - Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_button3'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontSize({ + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_button3'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.textOverflow({ overflow: TextOverflow.Ellipsis }); Text.textAlign(TextAlign.Start); Text.maxLines(TEXT_MAX_LINES); @@ -1977,12 +2424,24 @@ export class GridObjectSortComponent extends ViewPU { if (this.gridComState && this.addIconShow && f97.id === this.content.id) { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((j97, k97) => { - SymbolGlyph.create({ 'id': -1, 'type': 40000, params: ['sys.symbol.minus_circle_fill'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + SymbolGlyph.create({ + 'id': -1, + 'type': 40000, + params: ['sys.symbol.minus_circle_fill'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); SymbolGlyph.fontSize(SYMBOL_SIZE_24VP); SymbolGlyph.fontWeight(SYMBOL_WEIGHT); SymbolGlyph.draggable(false); SymbolGlyph.transition({ type: TransitionType.All, scale: { x: 0, y: 0 } }); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_secondary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_secondary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.width(ICON_SIZE); SymbolGlyph.translate(this.gridComState ? { x: -MARGIN_EIGHT } : {}); SymbolGlyph.position({ @@ -1991,8 +2450,7 @@ export class GridObjectSortComponent extends ViewPU { }); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { }); } @@ -2001,6 +2459,7 @@ export class GridObjectSortComponent extends ViewPU { Flex.pop(); Stack.pop(); } + onAddTagLongPressEnd() { this.addAreaLongPressGesture = false; Context.animateTo({ @@ -2010,6 +2469,7 @@ export class GridObjectSortComponent extends ViewPU { this.longScaleOnePointTwo = 1; }); } + AddTagBuilder(k96 = null) { this.observeComponentCreation2((d97, e97) => { Grid.create(); @@ -2017,7 +2477,8 @@ export class GridObjectSortComponent extends ViewPU { duration: ENTER_EXIT_ICON_DURATION, curve: this.imageText ? REMOVE_ADD_SPRING : COMMON_BEZIER, }); - Grid.translate(this.clickRemoveBtn && this.selected.length % this.colNum === 1 ? { y: -this.blockHeight } : {}); + Grid.translate(this.clickRemoveBtn && this.selected.length % this.colNum === 1 ? { y: -this.blockHeight } : + {}); Context.animation(null); Grid.columnsTemplate(this.customColumns); Grid.padding({ @@ -2034,9 +2495,11 @@ export class GridObjectSortComponent extends ViewPU { const r96 = p96; { const s96 = (b97, c97) => { - GridItem.create(() => { }, false); + GridItem.create(() => { + }, false); Context.animation({ - curve: this.clickRemoveBtn ? DRAG_SPRING : q96 === this.unSelectedIndex ? REMOVE_ADD_SPRING : DRAG_SPRING + curve: this.clickRemoveBtn ? DRAG_SPRING : + q96 === this.unSelectedIndex ? REMOVE_ADD_SPRING : DRAG_SPRING }); GridItem.clip(false); GridItem.translate(this.getAddAreaItemTranslate(q96)); @@ -2049,8 +2512,7 @@ export class GridObjectSortComponent extends ViewPU { Stack.onHover((a97) => { if (a97) { this.hoverId = r96.id; - } - else { + } else { this.hoverId = ''; } }); @@ -2077,8 +2539,7 @@ export class GridObjectSortComponent extends ViewPU { setTimeout(() => { this.pointToRepeat(ADD); }, ENTER_EXIT_ICON_DURATION); - } - else { + } else { Context.animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: LONG_TOUCH_SCALE @@ -2105,8 +2566,10 @@ export class GridObjectSortComponent extends ViewPU { Stack.accessibilityGroup(true); Stack.accessibilityLevel(YES); Stack.accessibilityText(this.readFlag ? - this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM, this.getAccessibilityText(r96.text ?? '')) : this.textAnnouncedForAccessibility); - Stack.accessibilityDescription(this.readFlag ? this.getAddTagGridItemAccessibilityDesc() : ' '); + this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM, + this.getAccessibilityText(r96.text ?? '')) : this.textAnnouncedForAccessibility); + Stack.accessibilityDescription(this.readFlag ? this.getAddTagGridItemAccessibilityDesc() : + ' '); }, Stack); this.observeComponentCreation2((u96, v96) => { If.create(); @@ -2114,8 +2577,7 @@ export class GridObjectSortComponent extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.ImageTextBuilder.bind(this)(r96, ADD); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.TextBlockAddItemBuilder.bind(this)(r96); }); @@ -2133,12 +2595,14 @@ export class GridObjectSortComponent extends ViewPU { ForEach.pop(); Grid.pop(); } + getAddTagGridItemAccessibilityDesc() { return this.options?.type === GridObjectSortComponentType.IMAGE_TEXT ? this.menuSwitch ? ' ' : this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_IMAGE_ITEM_DESC) : this.menuSwitch ? this.getStringByResourceToken(ACCESSIBILITY_DOUBLE_CLICK) : this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_TEXT_ITEM_DESC); } + handleAddItemTouch(e96, f96) { if (this.clickAddBtn || this.clickRemoveBtn) { return; @@ -2174,36 +2638,41 @@ export class GridObjectSortComponent extends ViewPU { this.clickAddBtn = true; this.arrayUnSelectIsChange = 1; this.calcGridHeight(); - Context.animateTo({ curve: REMOVE_ADD_SPRING, onFinish: () => { - if (!this.selected.some(i96 => i96.id === f96.id)) { - this.scaleIcon = 1; - this.scaleAddIcon = 0; - this.selected.push(f96); - this.unSelected.splice(g96, 1); - this.calcGridHeight(); - this.arrayUnSelectIsChange = 2; - this.addItemMoveX = 0; - this.addItemMoveY = 0; - if (!this.gridComState) { - this.onSaveEdit(); + Context.animateTo({ + curve: REMOVE_ADD_SPRING, onFinish: () => { + if (!this.selected.some(i96 => i96.id === f96.id)) { + this.scaleIcon = 1; + this.scaleAddIcon = 0; + this.selected.push(f96); + this.unSelected.splice(g96, 1); + this.calcGridHeight(); + this.arrayUnSelectIsChange = 2; + this.addItemMoveX = 0; + this.addItemMoveY = 0; + if (!this.gridComState) { + this.onSaveEdit(); + } + Context.animateTo({ + duration: ENTER_EXIT_ICON_DURATION, + curve: COMMON_BEZIER + }, () => { + this.addIconShow = false; + }); + this.clickAddBtn = false; } - Context.animateTo({ - duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER - }, () => { - this.addIconShow = false; - }); - this.clickAddBtn = false; } - } }, () => { + }, () => { this.addItemMoveX = h96.x; this.addItemMoveY = h96.y; }); this.readFlag = false; this.readIndex4EditArea = this.editGridDataLength - 1; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, this.getAccessibilityText(this.content?.text ?? ''), Math.floor(this.readIndex4EditArea / this.colNum) + 1, this.readIndex4EditArea % this.colNum + 1); + this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, + this.getAccessibilityText(this.content?.text ?? ''), + Math.floor(this.readIndex4EditArea / this.colNum) + 1, this.readIndex4EditArea % this.colNum + 1); } } + handleAddItemClick(z95) { if (this.clickAddBtn || this.clickRemoveBtn) { return; @@ -2261,8 +2730,11 @@ export class GridObjectSortComponent extends ViewPU { }); this.readFlag = false; this.readIndex4EditArea = this.editGridDataLength - 1; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, this.getAccessibilityText(this.content?.text ?? ''), Math.floor(this.readIndex4EditArea / this.colNum) + 1, this.readIndex4EditArea % this.colNum + 1); + this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_UNSELECTED_ITEM_ADD, + this.getAccessibilityText(this.content?.text ?? ''), Math.floor(this.readIndex4EditArea / this.colNum) + 1, + this.readIndex4EditArea % this.colNum + 1); } + EditTagBuilder(o94 = null) { this.observeComponentCreation2((w95, x95) => { Column.create(); @@ -2299,8 +2771,7 @@ export class GridObjectSortComponent extends ViewPU { setTimeout(() => { this.pointToRepeat(EDIT); }, ENTER_EXIT_ICON_DURATION); - } - else { + } else { Context.animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: LONG_TOUCH_SCALE @@ -2318,8 +2789,7 @@ export class GridObjectSortComponent extends ViewPU { }).then(() => { this.vibrationDone = true; }); - } - catch { + } catch { this.vibrationDone = false; } } @@ -2352,11 +2822,16 @@ export class GridObjectSortComponent extends ViewPU { this.insertIndex = u95; this.dragContent = this.selected[u95]; this.dragContentIndex = u95; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_START, this.getAccessibilityText(this.dragContent?.text ?? '')); + this.textAnnouncedForAccessibility = + this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_START, + this.getAccessibilityText(this.dragContent?.text ?? '')); this.sendAccessibility(); - return { builder: () => { - this.PixelMapBuilder.call(this, this.dragContent?.symbolStyle || this.dragContent?.url, this.dragContent?.text); - } }; + return { + builder: () => { + this.PixelMapBuilder.call(this, this.dragContent?.symbolStyle || this.dragContent?.url, + this.dragContent?.text); + } + }; }); Grid.onItemDrop((p95, q95, r95, s95) => { this.insertItem(q95, r95); @@ -2373,9 +2848,11 @@ export class GridObjectSortComponent extends ViewPU { const v94 = t94; { const w94 = (g95, h95) => { - GridItem.create(() => { }, false); + GridItem.create(() => { + }, false); Context.animation({ - curve: this.isStartDrag ? DRAG_SPRING : u94 === this.selectedIndex ? REMOVE_ADD_SPRING : DRAG_SPRING, + curve: this.isStartDrag ? DRAG_SPRING : + u94 === this.selectedIndex ? REMOVE_ADD_SPRING : DRAG_SPRING, }); GridItem.clip(false); GridItem.translate(this.getShowAreaItemTranslate(u94)); @@ -2389,8 +2866,7 @@ export class GridObjectSortComponent extends ViewPU { Stack.onHover((f95) => { if (f95) { this.hoverId = v94.id; - } - else { + } else { this.hoverId = ''; } }); @@ -2428,7 +2904,8 @@ export class GridObjectSortComponent extends ViewPU { Stack.accessibilityGroup(true); Stack.accessibilityLevel(YES); Stack.accessibilityText(this.readFlag ? - this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM, this.getAccessibilityText(v94.text)) : + this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM, + this.getAccessibilityText(v94.text)) : this.textAnnouncedForAccessibility); Stack.accessibilityDescription(this.readFlag ? this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DESC) : ''); @@ -2439,8 +2916,7 @@ export class GridObjectSortComponent extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.ImageTextBuilder.bind(this)(v94, DELETE); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.TextBlockBuilder.bind(this)(v94); }); @@ -2459,6 +2935,7 @@ export class GridObjectSortComponent extends ViewPU { Grid.pop(); Column.pop(); } + pointToRepeat(i94) { this.readFlag = false; let j94 = ''; @@ -2467,8 +2944,7 @@ export class GridObjectSortComponent extends ViewPU { k94 = this.unSelected.findIndex(n94 => n94.id === this.content.id); this.readIndex4AddArea = k94; j94 = `add_grid_item_${k94}`; - } - else { + } else { k94 = this.selected.findIndex(m94 => m94.id === this.content.id); this.readIndex4EditArea = k94; j94 = `edit_grid_item_${k94}`; @@ -2490,6 +2966,7 @@ export class GridObjectSortComponent extends ViewPU { }, ENTER_EXIT_ICON_DURATION); }); } + insertItem(g94, h94) { if (!this.gridComState) { return; @@ -2505,11 +2982,14 @@ export class GridObjectSortComponent extends ViewPU { if (h94 !== -1) { this.selected.splice(g94, 1); this.selected.splice(h94, 0, this.dragContent); - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_STOP, Math.floor(h94 / this.colNum) + 1, h94 % this.colNum + 1); - } - else { + this.textAnnouncedForAccessibility = + this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_STOP, Math.floor(h94 / this.colNum) + 1, + h94 % this.colNum + 1); + } else { this.insertIndex = g94; - this.textAnnouncedForAccessibility = this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_STOP, Math.floor(g94 / this.colNum) + 1, g94 % this.colNum + 1); + this.textAnnouncedForAccessibility = + this.getStringByResourceToken(ACCESSIBILITY_SELECTED_ITEM_DRAG_STOP, Math.floor(g94 / this.colNum) + 1, + g94 % this.colNum + 1); } this.preTextAnnouncedForAccessibility = this.textAnnouncedForAccessibility; this.dragContent.visibility = Visibility.Visible; @@ -2517,6 +2997,7 @@ export class GridObjectSortComponent extends ViewPU { this.readFlag = false; this.readIndex4EditArea = this.insertIndex; } + pointToNextOne() { let f94 = ({ type: 'requestFocusForAccessibility', @@ -2533,6 +3014,7 @@ export class GridObjectSortComponent extends ViewPU { }, ENTER_EXIT_ICON_DURATION); }); } + calcAreaInfo() { this.calcColNum(); this.blockWidth = this.getBlockWidth(); @@ -2544,6 +3026,7 @@ export class GridObjectSortComponent extends ViewPU { this.textItemEditHeight + DEFAULT_BLOCK_TEXT_ITEM_SAFE_MARGIN; this.calcGridHeight(); } + initialRender() { this.observeComponentCreation2((d94, e94) => { Column.create(); @@ -2571,25 +3054,43 @@ export class GridObjectSortComponent extends ViewPU { if (s93) { let t93 = new SubHeader(this, { primaryTitle: '', - secondaryTitle: this.options.showAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_sort'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.showAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_sort'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON - }, undefined, r93, () => { }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 1846, col: 11 }); + }, undefined, r93, () => { + }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 1846, col: 11 }); ViewPU.create(t93); let u93 = () => { return { primaryTitle: '', - secondaryTitle: this.options.showAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_sort'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.showAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_sort'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON }; }; t93.paramsGenerator_ = u93; - } - else { + } else { this.updateStateVarsOfChildByElmtId(r93, { primaryTitle: '', - secondaryTitle: this.options.showAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_sort'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.showAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_sort'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON }); @@ -2604,7 +3105,8 @@ export class GridObjectSortComponent extends ViewPU { duration: ENTER_EXIT_ICON_DURATION, curve: this.imageText ? REMOVE_ADD_SPRING : COMMON_BEZIER, }); - __Common__.translate(this.clickRemoveBtn && this.selected.length % this.colNum === 1 ? { y: -this.blockHeight } : {}); + __Common__.translate(this.clickRemoveBtn && this.selected.length % this.colNum === 1 ? + { y: -this.blockHeight } : {}); Context.animation(null); __Common__.margin({ bottom: MARGIN_EIGHT }); __Common__.onAreaChange((p93, q93) => { @@ -2616,25 +3118,43 @@ export class GridObjectSortComponent extends ViewPU { if (k93) { let l93 = new SubHeader(this, { primaryTitle: '', - secondaryTitle: this.options.addAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_add'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.addAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_add'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON - }, undefined, j93, () => { }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 1855, col: 11 }); + }, undefined, j93, () => { + }, { page: 'library/src/main/ets/components/GridObjectSortComponent.ets', line: 1855, col: 11 }); ViewPU.create(l93); let m93 = () => { return { primaryTitle: '', - secondaryTitle: this.options.addAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_add'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.addAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_add'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON }; }; l93.paramsGenerator_ = m93; - } - else { + } else { this.updateStateVarsOfChildByElmtId(j93, { primaryTitle: '', - secondaryTitle: this.options.addAreaTitle || { 'id': -1, 'type': 10003, params: ['sys.string.ohos_grid_edit_subtitle_add'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + secondaryTitle: this.options.addAreaTitle || { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_grid_edit_subtitle_add'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, icon: '', operationType: OperationType.BUTTON }); @@ -2647,40 +3167,41 @@ export class GridObjectSortComponent extends ViewPU { Scroll.pop(); Column.pop(); } + getStringByResourceToken(g93, ...h93) { if (g93) { try { return getContext(this).resourceManager.getStringByNameSync(g93, ...h93); - } - catch (i93) { - hilog.error(0x3900, 'Ace', `GridObjectSortComponent getStringByResourceToken, error: ${i93.toString()}`); + } catch (i93) { + hilog.error(0x3900, 'Ace', + `GridObjectSortComponent getStringByResourceToken, error: ${i93.toString()}`); } } return ''; } + getAccessibilityText(b93) { try { let f93 = ''; if (typeof b93 === 'string') { f93 = b93; - } - else { + } else { if (b93.id === -1) { f93 = getContext()?.resourceManager?.getStringByNameSync(b93.params?.[0].split('.').pop()); - } - else { + } else { f93 = getContext()?.resourceManager?.getStringSync(b93); } } return f93; - } - catch (c93) { + } catch (c93) { let d93 = c93.code; let e93 = c93.message; - hilog.error(0x3900, 'Ace', `GridObjectSortComponent getAccessibilityText error, code: ${d93}, message: ${e93}`); + hilog.error(0x3900, 'Ace', + `GridObjectSortComponent getAccessibilityText error, code: ${d93}, message: ${e93}`); return ''; } } + rerender() { this.updateDirtyElements(); } diff --git a/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets b/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets index df70e31f936..d38abe521e0 100644 --- a/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets +++ b/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets @@ -471,7 +471,7 @@ export struct GridObjectSortComponent { type: 'requestFocusForAccessibility', bundleName: this.bundleName, triggerAction: 'common', - customId: `ComposeTitleBar_ImageMenuItem_${composeTittleBarUniqueId}_0` + customId: `ComposeTitleBar_ImageMenuItem_${composeTittleBarUniqueId}_0`, }); accessibility.sendAccessibilityEvent(eventInfo).then(() => { setTimeout(() => { @@ -703,7 +703,7 @@ export struct GridObjectSortComponent { yNew = line * this.blockHeight + subTitleHeight; return { x: xNew, - y: yNew + y: yNew, }; } @@ -717,7 +717,7 @@ export struct GridObjectSortComponent { } return { x: xNew, - y: yNew + y: yNew, }; } @@ -753,7 +753,7 @@ export struct GridObjectSortComponent { yNew = itemHeight + subTitleHeight; return { x: xNew, - y: yNew + y: yNew, }; } @@ -770,7 +770,7 @@ export struct GridObjectSortComponent { } return { x: xNew, - y: yNew + y: yNew, }; } @@ -793,7 +793,7 @@ export struct GridObjectSortComponent { let coodXY = this.getCoodXY(index); return { x: coodXY.x, - y: coodXY.y + y: coodXY.y, }; } @@ -801,7 +801,7 @@ export struct GridObjectSortComponent { if (!this.isStartDrag && index === this.selectedIndex) { return { x: this.editItemMoveX, - y: this.editItemMoveY + y: this.editItemMoveY, }; } @@ -810,7 +810,7 @@ export struct GridObjectSortComponent { let coveringGridPosition = this.getCoveringGridPosition(index); return { x: coveringGridPosition.x, - y: coveringGridPosition.y + y: coveringGridPosition.y, }; } @@ -824,7 +824,7 @@ export struct GridObjectSortComponent { let addItemRightMove = this.getAddItemRightMove(index); return { x: addItemRightMove.x, - y: addItemRightMove.y + y: addItemRightMove.y, }; } @@ -832,7 +832,7 @@ export struct GridObjectSortComponent { if (!this.clickRemoveBtn && index === this.unSelectedIndex) { return { x: this.addItemMoveX, - y: -this.addItemMoveY + y: -this.addItemMoveY, }; } @@ -841,7 +841,7 @@ export struct GridObjectSortComponent { let coveringGridPositionBottom = this.getCoveringGridPositionBottom(index); return { x: coveringGridPositionBottom.x, - y: coveringGridPositionBottom.y + y: coveringGridPositionBottom.y, }; } @@ -891,7 +891,7 @@ export struct GridObjectSortComponent { .height(ICON_SIZE) .position({ x: this.blockWidth - 40, - y: -MARGIN_EIGHT + y: -MARGIN_EIGHT, }) } .alignItems(HorizontalAlign.Center) @@ -922,7 +922,7 @@ export struct GridObjectSortComponent { .height(ICON_SIZE) .position({ x: this.blockWidth - 52, // gridItem-padding: 16,row-padding: 12,icon: 24 - 8 = 16 - y: -MARGIN_EIGHT + y: -MARGIN_EIGHT, }) } .borderRadius(50) @@ -971,7 +971,7 @@ export struct GridObjectSortComponent { bundleName: this.bundleName, // 目标应用名;不可缺省。 triggerAction: 'common', // 表示没有特定操作,用于主动聚焦、主动播报等场景。 textAnnouncedForAccessibility: getContext().resourceManager - .getStringByNameSync(ACCESSIBILITY_ITEM_LONG_PRESS_GESTURE) // 主动播报的内容。 + .getStringByNameSync(ACCESSIBILITY_ITEM_LONG_PRESS_GESTURE), // 主动播报的内容。 }); accessibility.sendAccessibilityEvent(eventInfo); } catch (paramError) { @@ -1041,7 +1041,7 @@ export struct GridObjectSortComponent { .maxFontScale(this.fontSizeScale) .padding({ top: PADDING_EIGHT, - bottom: PADDING_EIGHT + bottom: PADDING_EIGHT, }) SymbolGlyph(this.imageTextAddIcon(select)) @@ -1222,13 +1222,13 @@ export struct GridObjectSortComponent { .height('100%') .animation(!this.firstIn ? { duration: ENTER_EXIT_ICON_DURATION, - curve: this.gridComState ? DRAG_SPRING : COMMON_BEZIER + curve: this.gridComState ? DRAG_SPRING : COMMON_BEZIER, } : { duration: 0 }) } .scale(select.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : {}) .padding({ left: MARGIN_EIGHT, - right: MARGIN_EIGHT + right: MARGIN_EIGHT, }) .height(this.textItemEditHeight) } @@ -1259,7 +1259,7 @@ export struct GridObjectSortComponent { .margin({ right: 4 }) .animation({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }) Text(select.text) @@ -1281,7 +1281,7 @@ export struct GridObjectSortComponent { .translate(this.gridComState ? { x: -MARGIN_EIGHT } : {}) .position({ x: this.blockWidth - 44, - y: -MARGIN_EIGHT + y: -MARGIN_EIGHT, }) } } @@ -1296,14 +1296,14 @@ export struct GridObjectSortComponent { .translate(this.addIconShow && select.id === this.content.id && this.gridComState ? { x: -4 } : { x: 0 }) .animation({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }) .height('100%') } .scale(select.id === this.content.id ? { x: this.longScaleOnePointTwo, y: this.longScaleOnePointTwo } : {}) .padding({ left: MARGIN_EIGHT, - right: MARGIN_EIGHT + right: MARGIN_EIGHT, }) .height(this.textItemEditHeight) } @@ -1312,7 +1312,7 @@ export struct GridObjectSortComponent { this.addAreaLongPressGesture = false; animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: LONG_TOUCH_SCALE + curve: LONG_TOUCH_SCALE, }, () => { this.longScaleOnePointTwo = 1; }); @@ -1363,7 +1363,7 @@ export struct GridObjectSortComponent { } else { animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: LONG_TOUCH_SCALE + curve: LONG_TOUCH_SCALE, }, () => { this.longScaleOnePointTwo = 1.05; }) @@ -1444,7 +1444,7 @@ export struct GridObjectSortComponent { } animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }, () => { this.addIconShow = true; }) @@ -1508,7 +1508,7 @@ export struct GridObjectSortComponent { } animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }, () => { this.addIconShow = true; }) @@ -1540,7 +1540,7 @@ export struct GridObjectSortComponent { } animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }, () => { this.addIconShow = false; }); @@ -1601,7 +1601,7 @@ export struct GridObjectSortComponent { this.isTouchDown = false; animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: LONG_TOUCH_SCALE + curve: LONG_TOUCH_SCALE, }, () => { this.longScaleOnePointTwo = 1; }) @@ -1642,7 +1642,7 @@ export struct GridObjectSortComponent { if (!this.gridComState) { animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: COMMON_BEZIER + curve: COMMON_BEZIER, }, () => { this.gridComState = true; }); @@ -1653,7 +1653,7 @@ export struct GridObjectSortComponent { } else { animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: LONG_TOUCH_SCALE + curve: LONG_TOUCH_SCALE, }, () => { this.longScaleOnePointTwo = 1.05; }); @@ -1739,11 +1739,11 @@ export struct GridObjectSortComponent { if (type === ADD) { index = this.unSelected.findIndex(i => i.id === this.content.id); this.readIndex4AddArea = index; - customId = `add_grid_item_${index}` + customId = `add_grid_item_${index}`; } else { index = this.selected.findIndex(i => i.id === this.content.id); this.readIndex4EditArea = index; - customId = `edit_grid_item_${index}` + customId = `edit_grid_item_${index}`; } try { @@ -1760,7 +1760,7 @@ export struct GridObjectSortComponent { type: 'requestFocusForAccessibility', bundleName: this.bundleName, triggerAction: 'common', - customId: customId + customId: customId, }); accessibility.sendAccessibilityEvent(eventInfo).then(() => { @@ -1780,7 +1780,7 @@ export struct GridObjectSortComponent { this.vibrationDone = false; animateTo({ duration: ENTER_EXIT_ICON_DURATION, - curve: LONG_TOUCH_SCALE + curve: LONG_TOUCH_SCALE, }, () => { this.longScaleOnePointTwo = 1; }) @@ -1813,7 +1813,7 @@ export struct GridObjectSortComponent { type: 'requestFocusForAccessibility', bundleName: this.bundleName, triggerAction: 'common', - customId: `edit_grid_item_${this.readIndex4EditArea}` + customId: `edit_grid_item_${this.readIndex4EditArea}`, }); accessibility.sendAccessibilityEvent(eventInfo).then(() => { @@ -1851,7 +1851,7 @@ export struct GridObjectSortComponent { primaryTitle: '', secondaryTitle: this.options.showAreaTitle || $r('sys.string.ohos_grid_edit_subtitle_sort'), icon: '', - operationType: OperationType.BUTTON + operationType: OperationType.BUTTON, }) .margin({ bottom: MARGIN_EIGHT }) this.EditTagBuilder() @@ -1860,7 +1860,7 @@ export struct GridObjectSortComponent { primaryTitle: '', secondaryTitle: this.options.addAreaTitle || $r('sys.string.ohos_grid_edit_subtitle_add'), icon: '', - operationType: OperationType.BUTTON + operationType: OperationType.BUTTON, }) .translate(this.clickRemoveBtn && this.selected.length % this.colNum === 1 ? { y: -this.blockHeight } : {}) .animation({ diff --git a/advanced_ui_component/subheader/interfaces/subheader.js b/advanced_ui_component/subheader/interfaces/subheader.js index ffc18a6e7bb..6a62dbed41d 100644 --- a/advanced_ui_component/subheader/interfaces/subheader.js +++ b/advanced_ui_component/subheader/interfaces/subheader.js @@ -90,56 +90,56 @@ class SubHeaderTheme { 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.fontSecondaryColor = { 'id': -1, 'type': 10001, params: ['sys.color.font_secondary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.fontButtonColor = { 'id': -1, 'type': 10001, params: ['sys.color.font_emphasize'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.iconArrowColor = { 'id': -1, 'type': 10001, params: ['sys.color.icon_tertiary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.textArrowHoverBgColor = { 'id': -1, 'type': 10001, params: ['sys.color.interactive_hover'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.borderFocusColor = { 'id': -1, 'type': 10001, params: ['sys.color.interactive_focus'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.leftIconColor = { 'id': -1, 'type': 10001, params: ['sys.color.icon_secondary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; this.rightIconColor = { 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -151,7 +151,7 @@ function __Text__secondaryTitleStyles(k16) { 'type': 10001, params: ['sys.color.font_secondary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); Text.fontWeight(k16?.fontWeight); Text.maxLines(k16?.maxLines); @@ -166,7 +166,7 @@ function __Text__primaryTitleStyles(j16) { 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); Text.fontWeight(j16?.fontWeight); Text.maxLines(j16?.maxLines); @@ -233,14 +233,14 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }, this, 'textArrowBgColor'); this.__buttonBgColor = new ObservedPropertyObjectPU({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }, this, 'buttonBgColor'); this.__selectedIndex = new ObservedPropertyObjectPU(-1, this, 'selectedIndex'); this.__selectValue = new ObservedPropertyObjectPU('', this, 'selectValue'); @@ -728,7 +728,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -737,7 +737,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -748,7 +748,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -757,7 +757,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -780,7 +780,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); Button.hoverEffect(HoverEffect.None); Button.accessibilityGroup(true); @@ -826,7 +826,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -835,7 +835,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -846,7 +846,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -855,7 +855,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -926,7 +926,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -935,7 +935,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -946,7 +946,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -955,7 +955,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -975,7 +975,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); Button.accessibilityGroup(true); Button.accessibilityText(this.getRightAreaAccessibilityText()); @@ -1021,7 +1021,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -1030,7 +1030,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -1041,7 +1041,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (this.operationType === OperationType.BUTTON) { @@ -1050,7 +1050,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } } @@ -1477,7 +1477,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } }); @@ -1489,7 +1489,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); ViewStackProcessor.visualState(); }, Button); @@ -1582,7 +1582,7 @@ export class SubHeader extends ViewPU { 'type': 40000, params: ['sys.symbol.chevron_right'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); SymbolGlyph.fontColor([this.subHeaderTheme.iconArrowColor]); @@ -1632,7 +1632,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); ViewStackProcessor.visualState(); Button.onHover((d7) => { @@ -1644,7 +1644,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } }); @@ -1742,7 +1742,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); ViewStackProcessor.visualState(); Button.onHover((p5) => { @@ -1754,7 +1754,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } }); @@ -1772,7 +1772,7 @@ export class SubHeader extends ViewPU { 'type': 40000, params: ['sys.symbol.chevron_right'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); SymbolGlyph.fontSize(RIGHT_SINGLE_ICON_SIZE); SymbolGlyph.fontColor([this.subHeaderTheme.iconArrowColor]); @@ -1895,7 +1895,7 @@ export class SubHeader extends ViewPU { 'type': 10001, params: ['sys.color.icon_secondary'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); }, LoadingProgress); Row.pop(); @@ -1924,7 +1924,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }, this, 'bgColor'); this.__isFocus = new ObservedPropertySimplePU(false, this, 'isFocus'); this.item = null; @@ -2041,7 +2041,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }); ViewStackProcessor.visualState(); Button.onTouch((a3) => { @@ -2051,7 +2051,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.interactive_pressed'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } if (a3.type === TouchType.Up) { @@ -2060,7 +2060,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } }); @@ -2071,7 +2071,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.interactive_hover'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } else { this.bgColor = { @@ -2079,7 +2079,7 @@ class SingleIconStyle extends ViewPU { 'type': 10001, params: ['sys.color.ohos_id_color_sub_background_transparent'], 'bundleName': '__harDefaultBundleName__', - 'moduleName': '__harDefaultModuleName__' + 'moduleName': '__harDefaultModuleName__', }; } }); diff --git a/advanced_ui_component/tabtitlebar/interfaces/tabtitlebar.js b/advanced_ui_component/tabtitlebar/interfaces/tabtitlebar.js index 0c372a36095..e0653f94eed 100644 --- a/advanced_ui_component/tabtitlebar/interfaces/tabtitlebar.js +++ b/advanced_ui_component/tabtitlebar/interfaces/tabtitlebar.js @@ -14,24 +14,33 @@ */ if (!('finalizeConstruction' in ViewPU.prototype)) { - Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); + Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { + }); } const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; const MeasureText = requireNapi('measure'); const hilog = requireNapi('hilog'); const SymbolGlyphModifier = requireNapi('arkui.modifier').SymbolGlyphModifier; -const PUBLIC_MORE = { 'id': -1, 'type': 40000, params: ['sys.symbol.dot_grid_2x2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; +const PUBLIC_MORE = { + 'id': -1, + 'type': 40000, + params: ['sys.symbol.dot_grid_2x2'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', +}; const TEXT_EDITABLE_DIALOG = '18.3fp'; const IMAGE_SIZE = '64vp'; const MAX_DIALOG = '256vp'; const MIN_DIALOG = '216vp'; const RESOURCE_TYPE_SYMBOL = 40000; + class ButtonGestureModifier { constructor(y47) { this.fontSize = 1; this.controller = null; this.controller = y47; } + applyGesture(x47) { if (this.fontSize >= ButtonGestureModifier.minFontSize) { x47.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime }) @@ -43,14 +52,15 @@ class ButtonGestureModifier { .onActionEnd(() => { this.controller?.close(); })); - } - else { + } else { x47.clearGestures(); } } } + ButtonGestureModifier.longPressTime = 500; ButtonGestureModifier.minFontSize = 1.75; + export class TabTitleBar extends ViewPU { constructor(r47, s47, t47, u47 = -1, v47 = undefined, w47) { super(r47, t47, u47, w47); @@ -74,6 +84,7 @@ export class TabTitleBar extends ViewPU { this.setInitiallyProvidedValue(s47); this.finalizeConstruction(); } + setInitiallyProvidedValue(q47) { if (q47.tabItems !== undefined) { this.tabItems = q47.tabItems; @@ -118,13 +129,16 @@ export class TabTitleBar extends ViewPU { this.rightContext2D = q47.rightContext2D; } } + updateStateVars(p47) { } + purgeVariableDependenciesOnElmtId(o47) { this.__tabWidth.purgeDependencyOnElmtId(o47); this.__currentIndex.purgeDependencyOnElmtId(o47); this.__fontSize.purgeDependencyOnElmtId(o47); } + aboutToBeDeleted() { this.__tabWidth.aboutToBeDeleted(); this.__currentIndex.aboutToBeDeleted(); @@ -132,24 +146,31 @@ export class TabTitleBar extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + get tabWidth() { return this.__tabWidth.get(); } + set tabWidth(n47) { this.__tabWidth.set(n47); } + get currentIndex() { return this.__currentIndex.get(); } + set currentIndex(m47) { this.__currentIndex.set(m47); } + get fontSize() { return this.__fontSize.get(); } + set fontSize(l47) { this.__fontSize.set(l47); } + GradientMask(a47, b47, c47, d47, e47, f47 = null) { this.observeComponentCreation2((j47, k47) => { Column.create(); @@ -172,8 +193,10 @@ export class TabTitleBar extends ViewPU { Canvas.pop(); Column.pop(); } + emptyBuilder(z46 = null) { } + aboutToAppear() { if (!this.swiperContent) { this.swiperContent = this.emptyBuilder; @@ -183,6 +206,7 @@ export class TabTitleBar extends ViewPU { }); this.loadOffsets(); } + loadOffsets() { this.tabOffsets.length = 0; let v46 = 0; @@ -192,12 +216,10 @@ export class TabTitleBar extends ViewPU { if (w46.icon !== undefined || w46.symbolStyle !== undefined) { if (Math.abs(this.imageWidths[x46]) > TabContentItem.imageHotZoneWidth) { v46 += this.imageWidths[x46]; - } - else { + } else { v46 += TabContentItem.imageHotZoneWidth; } - } - else { + } else { v46 += TabContentItem.paddingLeft; v46 += px2vp(MeasureText.measureText({ textContent: w46.title.toString(), @@ -209,6 +231,7 @@ export class TabTitleBar extends ViewPU { this.tabOffsets.push(v46); }); } + initialRender() { this.observeComponentCreation2((t46, u46) => { Column.create(); @@ -218,8 +241,22 @@ export class TabTitleBar extends ViewPU { justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Stretch }); - Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); - Flex.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_max_padding_end'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); + Flex.backgroundColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_background'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); + Flex.margin({ + right: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_max_padding_end'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } + }); Flex.onAreaChange((r46, s46) => { this.tabWidth = Number(s46.width) - this.menuSectionWidth; }); @@ -274,7 +311,8 @@ export class TabTitleBar extends ViewPU { this.imageWidths[o45] = b46; this.loadOffsets(); } - }, undefined, v45, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 174, col: 21 }); + }, undefined, v45, () => { + }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 174, col: 21 }); ViewPU.create(x45); let e18 = () => { return { @@ -290,8 +328,7 @@ export class TabTitleBar extends ViewPU { }; }; x45.paramsGenerator_ = e18; - } - else { + } else { this.updateStateVarsOfChildByElmtId(v45, { currentIndex: this.currentIndex }); @@ -309,9 +346,11 @@ export class TabTitleBar extends ViewPU { ForEach.pop(); List.pop(); Column.pop(); - this.GradientMask.bind(this)(this.leftContext2D, 0, TabTitleBar.totalHeight / 2, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2); + this.GradientMask.bind(this)(this.leftContext2D, 0, TabTitleBar.totalHeight / 2, TabTitleBar.gradientMaskWidth, + TabTitleBar.totalHeight / 2); Stack.pop(); - this.GradientMask.bind(this)(this.rightContext2D, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2, 0, TabTitleBar.totalHeight / 2); + this.GradientMask.bind(this)(this.rightContext2D, TabTitleBar.gradientMaskWidth, TabTitleBar.totalHeight / 2, 0, + TabTitleBar.totalHeight / 2); Stack.pop(); this.observeComponentCreation2((a45, b45) => { If.create(); @@ -327,7 +366,10 @@ export class TabTitleBar extends ViewPU { { this.observeComponentCreation2((c45, d45) => { if (d45) { - let e45 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, index: 1 + TabTitleBar.instanceCount++ }, undefined, c45, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 204, col: 11 }); + let e45 = new CollapsibleMenuSection(this, + { menuItems: this.menuItems, index: 1 + TabTitleBar.instanceCount++ }, undefined, + c45, () => { + }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 204, col: 11 }); ViewPU.create(e45); let z17 = () => { return { @@ -336,16 +378,14 @@ export class TabTitleBar extends ViewPU { }; }; e45.paramsGenerator_ = z17; - } - else { + } else { this.updateStateVarsOfChildByElmtId(c45, {}); } }, { name: 'CollapsibleMenuSection' }); } __Common__.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { }); } @@ -385,6 +425,7 @@ export class TabTitleBar extends ViewPU { Column.pop(); Column.pop(); } + rerender() { this.updateDirtyElements(); } @@ -393,6 +434,7 @@ TabTitleBar.totalHeight = 56; TabTitleBar.correctionOffset = -40.0; TabTitleBar.gradientMaskWidth = 24; TabTitleBar.instanceCount = 0; + class CollapsibleMenuSection extends ViewPU { constructor(m44, n44, o44, p44 = -1, q44 = undefined, r44) { super(m44, o44, p44, r44); @@ -404,7 +446,13 @@ class CollapsibleMenuSection extends ViewPU { this.item = { value: PUBLIC_MORE, symbolStyle: new SymbolGlyphModifier(PUBLIC_MORE), - label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + label: { + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_toolbar_more'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, }; this.minFontSize = 1.75; this.isFollowingSystemFontScale = false; @@ -426,7 +474,8 @@ class CollapsibleMenuSection extends ViewPU { tabTitleDialog: this.item, tabTitleBarDialog: this.item.label ? this.item.label : '', fontSize: this.fontSize, - }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 273, col: 14 }); + }, undefined, -1, () => { + }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 273, col: 14 }); s44.setController(this.dialogController); ViewPU.create(s44); let y17 = () => { @@ -446,11 +495,14 @@ class CollapsibleMenuSection extends ViewPU { isModal: true, customStyle: true }, this); - this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); + this.__buttonGestureModifier = + new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, + 'buttonGestureModifier'); this.setInitiallyProvidedValue(n44); this.declareWatch('fontSize', this.onFontSizeUpdated); this.finalizeConstruction(); } + setInitiallyProvidedValue(l44) { if (l44.menuItems !== undefined) { this.menuItems = l44.menuItems; @@ -498,9 +550,11 @@ class CollapsibleMenuSection extends ViewPU { this.buttonGestureModifier = l44.buttonGestureModifier; } } + updateStateVars(k44) { this.__fontSize.reset(k44.fontSize); } + purgeVariableDependenciesOnElmtId(j44) { this.__isPopupShown.purgeDependencyOnElmtId(j44); this.__isMoreIconOnFocus.purgeDependencyOnElmtId(j44); @@ -509,6 +563,7 @@ class CollapsibleMenuSection extends ViewPU { this.__fontSize.purgeDependencyOnElmtId(j44); this.__buttonGestureModifier.purgeDependencyOnElmtId(j44); } + aboutToBeDeleted() { this.__isPopupShown.aboutToBeDeleted(); this.__isMoreIconOnFocus.aboutToBeDeleted(); @@ -519,64 +574,100 @@ class CollapsibleMenuSection extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + get isPopupShown() { return this.__isPopupShown.get(); } + set isPopupShown(i44) { this.__isPopupShown.set(i44); } + get isMoreIconOnFocus() { return this.__isMoreIconOnFocus.get(); } + set isMoreIconOnFocus(h44) { this.__isMoreIconOnFocus.set(h44); } + get isMoreIconOnHover() { return this.__isMoreIconOnHover.get(); } + set isMoreIconOnHover(g44) { this.__isMoreIconOnHover.set(g44); } + get isMoreIconOnClick() { return this.__isMoreIconOnClick.get(); } + set isMoreIconOnClick(f44) { this.__isMoreIconOnClick.set(f44); } + get fontSize() { return this.__fontSize.get(); } + set fontSize(e44) { this.__fontSize.set(e44); } + get buttonGestureModifier() { return this.__buttonGestureModifier.get(); } + set buttonGestureModifier(d44) { this.__buttonGestureModifier.set(d44); } + getMoreIconFgColor() { return this.isMoreIconOnClick - ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; + ? { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_icon'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; } + getMoreIconBgColor() { if (this.isMoreIconOnClick) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else if (this.isMoreIconOnHover) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_click_effect'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else if (this.isMoreIconOnHover) { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_hover'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else { return Color.Transparent; } } + aboutToAppear() { try { let c44 = this.getUIContext(); this.isFollowingSystemFontScale = c44.isFollowingSystemFontScale(); this.maxFontScale = c44.getMaxFontScale(); - } - catch (z43) { + } catch (z43) { let a44 = z43?.code; let b44 = z43?.message; hilog.error(0x3900, 'Ace', `Faild to decideFontScale,cause, code: ${a44}, message: ${b44}`); @@ -589,17 +680,20 @@ class CollapsibleMenuSection extends ViewPU { }); this.fontSize = this.decideFontScale(); } + decideFontScale() { - let w43 = this.getUIContext(); - this.systemFontScale = w43.getHostContext()?.config?.fontSizeScale ?? 1; - if (!this.isFollowingSystemFontScale) { - return 1; - } + let w43 = this.getUIContext(); + this.systemFontScale = w43.getHostContext()?.config?.fontSizeScale ?? 1; + if (!this.isFollowingSystemFontScale) { + return 1; + } return Math.min(this.systemFontScale, this.maxFontScale); } + onFontSizeUpdated() { this.buttonGestureModifier.fontSize = this.fontSize; } + initialRender() { this.observeComponentCreation2((u43, v43) => { Column.create(); @@ -620,7 +714,14 @@ class CollapsibleMenuSection extends ViewPU { { this.observeComponentCreation2((o43, p43) => { if (p43) { - let q43 = new ImageMenuItem(this, { item: n43, index: this.index * 1000 + m43 + 1 }, undefined, o43, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 342, col: 13 }); + let q43 = + new ImageMenuItem(this, { item: n43, index: this.index * 1000 + m43 + 1 }, + undefined, o43, () => { + }, { + page: 'library/src/main/ets/components/tabtitlebar.ets', + line: 342, + col: 13 + }); ViewPU.create(q43); let x17 = () => { return { @@ -629,8 +730,7 @@ class CollapsibleMenuSection extends ViewPU { }; }; q43.paramsGenerator_ = x17; - } - else { + } else { this.updateStateVarsOfChildByElmtId(o43, {}); } }, { name: 'ImageMenuItem' }); @@ -640,8 +740,7 @@ class CollapsibleMenuSection extends ViewPU { }, ForEach); ForEach.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((y42, z42) => { ForEach.create(); @@ -650,7 +749,14 @@ class CollapsibleMenuSection extends ViewPU { { this.observeComponentCreation2((e43, f43) => { if (f43) { - let g43 = new ImageMenuItem(this, { item: d43, index: this.index * 1000 + c43 + 1 }, undefined, e43, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 347, col: 15 }); + let g43 = + new ImageMenuItem(this, { item: d43, index: this.index * 1000 + c43 + 1 }, + undefined, e43, () => { + }, { + page: 'library/src/main/ets/components/tabtitlebar.ets', + line: 347, + col: 15 + }); ViewPU.create(g43); let v17 = () => { return { @@ -659,19 +765,26 @@ class CollapsibleMenuSection extends ViewPU { }; }; g43.paramsGenerator_ = v17; - } - else { + } else { this.updateStateVarsOfChildByElmtId(e43, {}); } }, { name: 'ImageMenuItem' }); } }; - this.forEachUpdateFunction(y42, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), u17, undefined, true, false); + this.forEachUpdateFunction(y42, + this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), u17, undefined, + true, false); }, ForEach); ForEach.pop(); this.observeComponentCreation2((s42, t42) => { Button.createWithChild({ type: ButtonType.Normal, stateEffect: true }); - Button.accessibilityText({ 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Button.accessibilityText({ + 'id': -1, + 'type': 10003, + params: ['sys.string.ohos_toolbar_more'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Button.width(ImageMenuItem.imageHotZoneWidth); Button.height(ImageMenuItem.imageHotZoneWidth); Button.borderRadius(ImageMenuItem.buttonBorderRadius); @@ -679,14 +792,32 @@ class CollapsibleMenuSection extends ViewPU { Button.backgroundColor(this.getMoreIconBgColor()); ViewStackProcessor.visualState('focused'); Button.border({ - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: ImageMenuItem.focusBorderWidth, - color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + color: { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_focused_outline'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, style: BorderStyle.Solid }); ViewStackProcessor.visualState('normal'); Button.border({ - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: 0 }); ViewStackProcessor.visualState(); @@ -734,7 +865,13 @@ class CollapsibleMenuSection extends ViewPU { SymbolGlyph.create(PUBLIC_MORE); SymbolGlyph.fontSize(TabContentItem.symbolSize); SymbolGlyph.draggable(false); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.icon_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.focusable(true); }, SymbolGlyph); Button.pop(); @@ -745,16 +882,19 @@ class CollapsibleMenuSection extends ViewPU { Row.pop(); Column.pop(); } + onPlaceChildren(k42, l42, m42) { l42.forEach((n42) => { n42.layout({ x: 0, y: 0 }); }); this.fontSize = this.decideFontScale(); } + popupBuilder(x41 = null) { this.observeComponentCreation2((i42, j42) => { Column.create(); - Column.width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); + Column.width(ImageMenuItem.imageHotZoneWidth + + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); Column.onAppear(() => { focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex); @@ -767,8 +907,11 @@ class CollapsibleMenuSection extends ViewPU { { this.observeComponentCreation2((e42, f42) => { if (f42) { - let g42 = new ImageMenuItem(this, { item: d42, index: this.index * 1000 + - CollapsibleMenuSection.maxCountOfVisibleItems + c42 }, undefined, e42, () => { }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 437, col: 11 }); + let g42 = new ImageMenuItem(this, { + item: d42, index: this.index * 1000 + + CollapsibleMenuSection.maxCountOfVisibleItems + c42 + }, undefined, e42, () => { + }, { page: 'library/src/main/ets/components/tabtitlebar.ets', line: 437, col: 11 }); ViewPU.create(g42); let t17 = () => { return { @@ -778,25 +921,29 @@ class CollapsibleMenuSection extends ViewPU { }; }; g42.paramsGenerator_ = t17; - } - else { + } else { this.updateStateVarsOfChildByElmtId(e42, {}); } }, { name: 'ImageMenuItem' }); } }; - this.forEachUpdateFunction(y41, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), s17, undefined, true, false); + this.forEachUpdateFunction(y41, + this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), s17, + undefined, true, false); }, ForEach); ForEach.pop(); Column.pop(); } + rerender() { this.updateDirtyElements(); } } + CollapsibleMenuSection.maxCountOfVisibleItems = 1; CollapsibleMenuSection.focusPadding = 4; CollapsibleMenuSection.marginsNum = 2; + class TabContentItem extends ViewPU { constructor(r41, s41, t41, u41 = -1, v41 = undefined, w41) { super(r41, t41, u41, w41); @@ -818,6 +965,7 @@ class TabContentItem extends ViewPU { this.setInitiallyProvidedValue(s41); this.finalizeConstruction(); } + setInitiallyProvidedValue(q41) { if (q41.item !== undefined) { this.item = q41.item; @@ -853,9 +1001,11 @@ class TabContentItem extends ViewPU { this.imageHeight = q41.imageHeight; } } + updateStateVars(p41) { this.__currentIndex.reset(p41.currentIndex); } + purgeVariableDependenciesOnElmtId(o41) { this.__currentIndex.purgeDependencyOnElmtId(o41); this.__isOnFocus.purgeDependencyOnElmtId(o41); @@ -865,6 +1015,7 @@ class TabContentItem extends ViewPU { this.__imageWidth.purgeDependencyOnElmtId(o41); this.__imageHeight.purgeDependencyOnElmtId(o41); } + aboutToBeDeleted() { this.__currentIndex.aboutToBeDeleted(); this.__isOnFocus.aboutToBeDeleted(); @@ -876,89 +1027,127 @@ class TabContentItem extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + get currentIndex() { return this.__currentIndex.get(); } + set currentIndex(n41) { this.__currentIndex.set(n41); } + get isOnFocus() { return this.__isOnFocus.get(); } + set isOnFocus(m41) { this.__isOnFocus.set(m41); } + get isOnHover() { return this.__isOnHover.get(); } + set isOnHover(l41) { this.__isOnHover.set(l41); } + get isOnClick() { return this.__isOnClick.get(); } + set isOnClick(k41) { this.__isOnClick.set(k41); } + get tabWidth() { return this.__tabWidth.get(); } + set tabWidth(j41) { this.__tabWidth.set(j41); } + get imageWidth() { return this.__imageWidth.get(); } + set imageWidth(i41) { this.__imageWidth.set(i41); } + get imageHeight() { return this.__imageHeight.get(); } + set imageHeight(h41) { this.__imageHeight.set(h41); } + getBgColor() { if (this.isOnClick) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else if (this.isOnHover) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_click_effect'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else if (this.isOnHover) { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_hover'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else { return Color.Transparent; } } + getBorderAttr() { if (this.isOnFocus) { return { - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: TabContentItem.focusBorderWidth, - color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + color: { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_focused_outline'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, style: BorderStyle.Solid }; } return { width: 0 }; } + getImageScaleFactor() { return this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1; } + getImageLayoutWidth() { return TabContentItem.imageSize / Math.max(this.imageHeight, 1.0) * this.imageWidth; } + toStringFormat(c41) { if (typeof c41 === 'string') { return c41; - } - else if (typeof c41 === 'undefined') { + } else if (typeof c41 === 'undefined') { return ''; - } - else { + } else { let d41 = ''; try { d41 = getContext()?.resourceManager?.getStringSync(c41); - } - catch (e41) { + } catch (e41) { let f41 = e41?.code; let g41 = e41?.message; hilog.error(0x3900, 'Ace', `Faild to TabTitleBar toStringFormat,code: ${f41},message:${g41}`); @@ -966,6 +1155,7 @@ class TabContentItem extends ViewPU { return d41; } } + initialRender() { this.observeComponentCreation2((a41, b41) => { Stack.create(); @@ -997,9 +1187,33 @@ class TabContentItem extends ViewPU { Text.create(this.item.title); Context.animation({ duration: 300 }); Text.fontSize(this.index === this.currentIndex - ? { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline7'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline9'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + ? { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_headline7'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_text_size_headline9'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.fontColor(this.index === this.currentIndex - ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text_off'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + ? { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_text'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_text_off'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Text.fontWeight(FontWeight.Medium); Text.focusable(true); Context.animation(null); @@ -1036,8 +1250,7 @@ class TabContentItem extends ViewPU { }, Text); Text.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((k40, l40) => { Row.create(); @@ -1082,7 +1295,13 @@ class TabContentItem extends ViewPU { this.observeComponentCreation2((i40, j40) => { SymbolGlyph.create(); Context.animation({ duration: 300 }); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.icon_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.attributeModifier.bind(this)(this.item.symbolStyle); SymbolGlyph.fontSize(TabContentItem.symbolSize); SymbolGlyph.width(this.getImageLayoutWidth()); @@ -1098,8 +1317,7 @@ class TabContentItem extends ViewPU { SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((a40, b40) => { If.create(); @@ -1108,7 +1326,13 @@ class TabContentItem extends ViewPU { this.observeComponentCreation2((g40, h40) => { SymbolGlyph.create(this.item.icon); Context.animation({ duration: 300 }); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.icon_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.fontSize(TabContentItem.symbolSize); SymbolGlyph.width(this.getImageLayoutWidth()); SymbolGlyph.height(TabContentItem.imageSize); @@ -1122,8 +1346,7 @@ class TabContentItem extends ViewPU { SymbolGlyph.focusable(true); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((c40, d40) => { Image.create(this.item.icon); @@ -1186,15 +1409,20 @@ class TabContentItem extends ViewPU { Row.border(this.getBorderAttr()); ViewStackProcessor.visualState('normal'); Row.border({ - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: 0 }); ViewStackProcessor.visualState(); }, Row); Row.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { }); } @@ -1202,10 +1430,12 @@ class TabContentItem extends ViewPU { If.pop(); Stack.pop(); } + rerender() { this.updateDirtyElements(); } } + TabContentItem.imageSize = 24; TabContentItem.symbolSize = '24vp'; TabContentItem.imageHotZoneWidth = 48; @@ -1215,6 +1445,7 @@ TabContentItem.focusBorderWidth = 2; TabContentItem.paddingLeft = 8; TabContentItem.paddingRight = 8; TabContentItem.marginFirst = 16; + class ImageMenuItem extends ViewPU { constructor(m39, n39, o39, p39 = -1, q39 = undefined, r39) { super(m39, o39, p39, r39); @@ -1229,6 +1460,7 @@ class ImageMenuItem extends ViewPU { this.setInitiallyProvidedValue(n39); this.finalizeConstruction(); } + setInitiallyProvidedValue(l39) { if (l39.item !== undefined) { this.item = l39.item; @@ -1246,13 +1478,16 @@ class ImageMenuItem extends ViewPU { this.isOnClick = l39.isOnClick; } } + updateStateVars(k39) { } + purgeVariableDependenciesOnElmtId(j39) { this.__isOnFocus.purgeDependencyOnElmtId(j39); this.__isOnHover.purgeDependencyOnElmtId(j39); this.__isOnClick.purgeDependencyOnElmtId(j39); } + aboutToBeDeleted() { this.__isOnFocus.aboutToBeDeleted(); this.__isOnHover.aboutToBeDeleted(); @@ -1260,52 +1495,80 @@ class ImageMenuItem extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + get isOnFocus() { return this.__isOnFocus.get(); } + set isOnFocus(i39) { this.__isOnFocus.set(i39); } + get isOnHover() { return this.__isOnHover.get(); } + set isOnHover(h39) { this.__isOnHover.set(h39); } + get isOnClick() { return this.__isOnClick.get(); } + set isOnClick(g39) { this.__isOnClick.set(g39); } + getFgColor() { return this.isOnClick - ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; + ? { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + } : { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_titlebar_icon'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; } + getBgColor() { if (this.isOnClick) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else if (this.isOnHover) { - return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; - } - else { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_click_effect'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else if (this.isOnHover) { + return { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_hover'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }; + } else { return Color.Transparent; } } + toStringFormat(b39) { if (typeof b39 === 'string') { return b39; - } - else if (typeof b39 === 'undefined') { + } else if (typeof b39 === 'undefined') { return ''; - } - else { + } else { let c39 = ''; try { c39 = getContext()?.resourceManager?.getStringSync(b39); - } - catch (d39) { + } catch (d39) { let e39 = d39?.code; let f39 = d39?.message; hilog.error(0x3900, 'Ace', `Faild to TabTitleBar toStringFormat,code: ${e39},message:${f39}`); @@ -1330,6 +1593,7 @@ class ImageMenuItem extends ViewPU { } return ' '; } + initialRender() { this.observeComponentCreation2((w38, x38) => { Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); @@ -1344,14 +1608,32 @@ class ImageMenuItem extends ViewPU { Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); ViewStackProcessor.visualState('focused'); Button.border({ - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: ImageMenuItem.focusBorderWidth, - color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + color: { + 'id': -1, + 'type': 10001, + params: ['sys.color.ohos_id_color_focused_outline'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, style: BorderStyle.Solid }); ViewStackProcessor.visualState('normal'); Button.border({ - radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + radius: { + 'id': -1, + 'type': 10002, + params: ['sys.float.ohos_id_corner_radius_clicked'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, width: 0 }); ViewStackProcessor.visualState(); @@ -1401,7 +1683,13 @@ class ImageMenuItem extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((u38, v38) => { SymbolGlyph.create(); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.attributeModifier.bind(this)(this.item.symbolStyle); SymbolGlyph.fontSize(TabContentItem.symbolSize); SymbolGlyph.draggable(false); @@ -1410,8 +1698,7 @@ class ImageMenuItem extends ViewPU { SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((o38, p38) => { If.create(); @@ -1419,15 +1706,20 @@ class ImageMenuItem extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((s38, t38) => { SymbolGlyph.create(this.item.value); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.fontSize(TabContentItem.symbolSize); SymbolGlyph.draggable(false); SymbolGlyph.focusable(this.item?.isEnabled); SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((q38, r38) => { Image.create(this.item.value); @@ -1447,16 +1739,19 @@ class ImageMenuItem extends ViewPU { If.pop(); Button.pop(); } + rerender() { this.updateDirtyElements(); } } + ImageMenuItem.imageSize = 24; ImageMenuItem.imageHotZoneWidth = 48; ImageMenuItem.buttonBorderRadius = 8; ImageMenuItem.focusBorderWidth = 2; ImageMenuItem.disabledImageOpacity = 0.4; ImageMenuItem.focusablePrefix = 'Id-TabTitleBar-ImageMenuItem-'; + class TabTitleBarDialog extends ViewPU { constructor(g38, h38, i38, j38 = -1, k38 = undefined, l38) { super(g38, i38, j38, l38); @@ -1484,6 +1779,7 @@ class TabTitleBarDialog extends ViewPU { this.setInitiallyProvidedValue(h38); this.finalizeConstruction(); } + setInitiallyProvidedValue(f38) { if (f38.tabTitleDialog !== undefined) { this.tabTitleDialog = f38.tabTitleDialog; @@ -1528,14 +1824,17 @@ class TabTitleBarDialog extends ViewPU { this.confirm = f38.confirm; } } + updateStateVars(e38) { } + purgeVariableDependenciesOnElmtId(d38) { this.__mainWindow.purgeDependencyOnElmtId(d38); this.__fontSize.purgeDependencyOnElmtId(d38); this.__maxLines.purgeDependencyOnElmtId(d38); this.__windowStandardHeight.purgeDependencyOnElmtId(d38); } + aboutToBeDeleted() { this.__mainWindow.aboutToBeDeleted(); this.__fontSize.aboutToBeDeleted(); @@ -1544,33 +1843,43 @@ class TabTitleBarDialog extends ViewPU { SubscriberManager.Get().delete(this.id__()); this.aboutToBeDeletedInternal(); } + setController(c38) { this.controller = c38; } + get mainWindow() { return this.__mainWindow.get(); } + set mainWindow(b38) { this.__mainWindow.set(b38); } + get fontSize() { return this.__fontSize.get(); } + set fontSize(a38) { this.__fontSize.set(a38); } + get maxLines() { return this.__maxLines.get(); } + set maxLines(z37) { this.__maxLines.set(z37); } + get windowStandardHeight() { return this.__windowStandardHeight.get(); } + set windowStandardHeight(y37) { this.__windowStandardHeight.set(y37); } + initialRender() { this.observeComponentCreation2((u36, v36) => { If.create(); @@ -1579,10 +1888,19 @@ class TabTitleBarDialog extends ViewPU { this.observeComponentCreation2((w37, x37) => { Column.create(); Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); - Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); - Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true }); + Column.constraintSize({ + minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG + }); + Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, + { disableSystemAdaptation: true }); Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); - Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Column.borderRadius({ + 'id': -1, + 'type': 10002, + params: ['sys.float.corner_radius_level10'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); }, Column); this.observeComponentCreation2((m37, n37) => { If.create(); @@ -1590,20 +1908,37 @@ class TabTitleBarDialog extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((u37, v37) => { SymbolGlyph.create(); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.attributeModifier.bind(this)(this.tabTitleDialog.symbolStyle); SymbolGlyph.fontSize(IMAGE_SIZE); SymbolGlyph.draggable(false); SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); SymbolGlyph.margin({ - top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + top: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level24'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + bottom: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level8'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, }); SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else if (this.tabTitleDialog.value) { + } else if (this.tabTitleDialog.value) { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((o37, p37) => { If.create(); @@ -1611,36 +1946,70 @@ class TabTitleBarDialog extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((s37, t37) => { SymbolGlyph.create(this.tabTitleDialog.value); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.fontSize(IMAGE_SIZE); SymbolGlyph.draggable(false); SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); SymbolGlyph.margin({ - top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + top: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level24'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + bottom: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level8'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, }); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((q37, r37) => { Image.create(this.tabTitleDialog.value); Image.width(IMAGE_SIZE); Image.height(IMAGE_SIZE); Image.margin({ - top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + top: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level24'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + bottom: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level8'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + }); + Image.fillColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.icon_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', }); - Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); }, Image); }); } }, If); If.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(2, () => { }); } @@ -1650,9 +2019,27 @@ class TabTitleBarDialog extends ViewPU { Column.create(); Column.width('100%'); Column.padding({ - left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + left: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level4'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + right: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level4'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + bottom: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level12'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, }); }, Column); this.observeComponentCreation2((i37, j37) => { @@ -1662,22 +2049,36 @@ class TabTitleBarDialog extends ViewPU { Text.maxLines(this.maxLines); Text.width('100%'); Text.textAlign(TextAlign.Center); - Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Text.fontColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); }, Text); Text.pop(); Column.pop(); Column.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((g37, h37) => { Column.create(); Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); - Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); - Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true }); + Column.constraintSize({ + minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG + }); + Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, + { disableSystemAdaptation: true }); Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); - Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Column.borderRadius({ + 'id': -1, + 'type': 10002, + params: ['sys.float.corner_radius_level10'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); Column.justifyContent(FlexAlign.Center); }, Column); this.observeComponentCreation2((w36, x36) => { @@ -1686,7 +2087,13 @@ class TabTitleBarDialog extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((e37, f37) => { SymbolGlyph.create(); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.attributeModifier.bind(this)(this.tabTitleDialog.symbolStyle); SymbolGlyph.fontSize(IMAGE_SIZE); SymbolGlyph.draggable(false); @@ -1694,8 +2101,7 @@ class TabTitleBarDialog extends ViewPU { SymbolGlyph.symbolEffect(new SymbolEffect(), false); }, SymbolGlyph); }); - } - else if (this.tabTitleDialog.value) { + } else if (this.tabTitleDialog.value) { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((y36, z36) => { If.create(); @@ -1703,32 +2109,54 @@ class TabTitleBarDialog extends ViewPU { this.ifElseBranchUpdateFunction(0, () => { this.observeComponentCreation2((c37, d37) => { SymbolGlyph.create(this.tabTitleDialog.value); - SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); + SymbolGlyph.fontColor([{ + 'id': -1, + 'type': 10001, + params: ['sys.color.font_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }]); SymbolGlyph.fontSize(IMAGE_SIZE); SymbolGlyph.draggable(false); SymbolGlyph.focusable(this.tabTitleDialog?.isEnabled); SymbolGlyph.margin({ - top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, - bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, + top: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level24'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, + bottom: { + 'id': -1, + 'type': 10002, + params: ['sys.float.padding_level8'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }, }); }, SymbolGlyph); }); - } - else { + } else { this.ifElseBranchUpdateFunction(1, () => { this.observeComponentCreation2((a37, b37) => { Image.create(this.tabTitleDialog.value); Image.width(IMAGE_SIZE); Image.height(IMAGE_SIZE); - Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); + Image.fillColor({ + 'id': -1, + 'type': 10001, + params: ['sys.color.icon_primary'], + 'bundleName': '__harDefaultBundleName__', + 'moduleName': '__harDefaultModuleName__', + }); }, Image); }); } }, If); If.pop(); }); - } - else { + } else { this.ifElseBranchUpdateFunction(2, () => { }); } @@ -1740,6 +2168,7 @@ class TabTitleBarDialog extends ViewPU { }, If); If.pop(); } + async aboutToAppear() { try { let r36 = this.getUIContext().getHostContext(); @@ -1757,10 +2186,12 @@ class TabTitleBarDialog extends ViewPU { hilog.error(0x3900, 'tabTitleBar', `Faild to getSystemFontScale,cause, code: ${a44}, message: ${b44}`); } } + rerender() { this.updateDirtyElements(); } } + class Util { static isSymbolResource(p36) { if (!Util.isResourceType(p36)) { @@ -1769,6 +2200,7 @@ class Util { let q36 = p36; return q36.type === RESOURCE_TYPE_SYMBOL; } + static isResourceType(o36) { if (!o36) { return false; @@ -1781,5 +2213,5 @@ class Util { } export default { - TabTitleBar: TabTitleBar + TabTitleBar: TabTitleBar }; \ No newline at end of file diff --git a/advanced_ui_component/tabtitlebar/source/tabtitlebar.ets b/advanced_ui_component/tabtitlebar/source/tabtitlebar.ets index d42d46edc3a..cc65f011ac5 100644 --- a/advanced_ui_component/tabtitlebar/source/tabtitlebar.ets +++ b/advanced_ui_component/tabtitlebar/source/tabtitlebar.ets @@ -230,7 +230,7 @@ export struct TabTitleBar { yOffset: 0, animation: { duration: 300, - curve: Curve.EaseInOut + curve: Curve.EaseInOut, } }) }) @@ -289,16 +289,16 @@ struct CollapsibleMenuSection { getMoreIconFgColor() { return this.isMoreIconOnClick ? $r('sys.color.ohos_id_color_titlebar_icon_pressed') - : $r('sys.color.ohos_id_color_titlebar_icon') + : $r('sys.color.ohos_id_color_titlebar_icon'); } getMoreIconBgColor() { if (this.isMoreIconOnClick) { - return $r('sys.color.ohos_id_color_click_effect') + return $r('sys.color.ohos_id_color_click_effect'); } else if (this.isMoreIconOnHover) { - return $r('sys.color.ohos_id_color_hover') + return $r('sys.color.ohos_id_color_hover'); } else { - return Color.Transparent + return Color.Transparent; } } @@ -441,7 +441,7 @@ struct CollapsibleMenuSection { .width(ImageMenuItem.imageHotZoneWidth + CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum) .margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }) .onAppear(() => { - focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex) + focusControl.requestFocus(ImageMenuItem.focusablePrefix + this.firstFocusableIndex); }) } } @@ -451,36 +451,36 @@ struct TabContentItem { item: TabTitleBarTabItem = { title: '' }; index: number = 0; maxIndex: number = 0; - onCustomClick?: (index: number) => void - onImageComplete?: (width: number) => void + onCustomClick?: (index: number) => void; + onImageComplete?: (width: number) => void; - @Prop currentIndex: number + @Prop currentIndex: number; - @State isOnFocus: boolean = false - @State isOnHover: boolean = false - @State isOnClick: boolean = false - @State tabWidth: number = 0 + @State isOnFocus: boolean = false; + @State isOnHover: boolean = false; + @State isOnClick: boolean = false; + @State tabWidth: number = 0; - @State imageWidth: number = 24 - @State imageHeight: number = 24 + @State imageWidth: number = 24; + @State imageHeight: number = 24; - static readonly imageSize = 24 - static readonly symbolSize = '24vp' - static readonly imageHotZoneWidth = 48 - static readonly imageMagnificationFactor = 1.4 - static readonly buttonBorderRadius = 8 - static readonly focusBorderWidth = 2 - static readonly paddingLeft = 8 - static readonly paddingRight = 8 - static readonly marginFirst = 16 + static readonly imageSize = 24; + static readonly symbolSize = '24vp'; + static readonly imageHotZoneWidth = 48; + static readonly imageMagnificationFactor = 1.4; + static readonly buttonBorderRadius = 8; + static readonly focusBorderWidth = 2; + static readonly paddingLeft = 8; + static readonly paddingRight = 8; + static readonly marginFirst = 16; getBgColor() { if (this.isOnClick) { - return $r('sys.color.ohos_id_color_click_effect') + return $r('sys.color.ohos_id_color_click_effect'); } else if (this.isOnHover) { - return $r('sys.color.ohos_id_color_hover') + return $r('sys.color.ohos_id_color_hover'); } else { - return Color.Transparent + return Color.Transparent; } } @@ -490,18 +490,18 @@ struct TabContentItem { radius: $r('sys.float.ohos_id_corner_radius_clicked'), width: TabContentItem.focusBorderWidth, color: $r('sys.color.ohos_id_color_focused_outline'), - style: BorderStyle.Solid + style: BorderStyle.Solid, } } return { width: 0 } } getImageScaleFactor(): number { - return this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1 + return this.index === this.currentIndex ? TabContentItem.imageMagnificationFactor : 1; } getImageLayoutWidth(): number { - return TabContentItem.imageSize / Math.max(this.imageHeight, 1.0) * this.imageWidth + return TabContentItem.imageSize / Math.max(this.imageHeight, 1.0) * this.imageWidth; } private toStringFormat(resource: ResourceStr | undefined): string | undefined { @@ -646,21 +646,21 @@ struct TabContentItem { .onHover((isOn) => this.isOnHover = isOn) .onKeyEvent((event) => { if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) { - return + return; } if (event.type === KeyType.Down) { - this.isOnClick = true + this.isOnClick = true; } if (event.type === KeyType.Up) { - this.isOnClick = false + this.isOnClick = false; } }) .onTouch((event) => { if (event.type === TouchType.Down) { - this.isOnClick = true + this.isOnClick = true; } if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.isOnClick = false + this.isOnClick = false; } }) .onClick(() => this.onCustomClick && this.onCustomClick(this.index)) @@ -691,7 +691,7 @@ struct TabContentItem { normal: { .border({ radius: $r('sys.float.ohos_id_corner_radius_clicked'), - width: 0 + width: 0, }) } }) @@ -699,7 +699,7 @@ struct TabContentItem { } .margin({ left: this.index === 0 ? TabContentItem.marginFirst : 0, - right: this.index === this.maxIndex ? 12 : 0 + right: this.index === this.maxIndex ? 12 : 0, }) } } @@ -709,30 +709,30 @@ struct ImageMenuItem { item: TabTitleBarMenuItem = { value: '' }; index: number = 0; - static readonly imageSize = 24 - static readonly imageHotZoneWidth = 48 - static readonly buttonBorderRadius = 8 - static readonly focusBorderWidth = 2 - static readonly disabledImageOpacity = 0.4 - static readonly focusablePrefix = "Id-TabTitleBar-ImageMenuItem-" + static readonly imageSize = 24; + static readonly imageHotZoneWidth = 48; + static readonly buttonBorderRadius = 8; + static readonly focusBorderWidth = 2; + static readonly disabledImageOpacity = 0.4; + static readonly focusablePrefix = "Id-TabTitleBar-ImageMenuItem-"; - @State isOnFocus: boolean = false - @State isOnHover: boolean = false - @State isOnClick: boolean = false + @State isOnFocus: boolean = false; + @State isOnHover: boolean = false; + @State isOnClick: boolean = false; getFgColor() { return this.isOnClick ? $r('sys.color.ohos_id_color_titlebar_icon_pressed') - : $r('sys.color.ohos_id_color_titlebar_icon') + : $r('sys.color.ohos_id_color_titlebar_icon'); } getBgColor() { if (this.isOnClick) { - return $r('sys.color.ohos_id_color_click_effect') + return $r('sys.color.ohos_id_color_click_effect'); } else if (this.isOnHover) { - return $r('sys.color.ohos_id_color_hover') + return $r('sys.color.ohos_id_color_hover'); } else { - return Color.Transparent + return Color.Transparent; } } @@ -815,52 +815,52 @@ struct ImageMenuItem { radius: $r('sys.float.ohos_id_corner_radius_clicked'), width: ImageMenuItem.focusBorderWidth, color: $r('sys.color.ohos_id_color_focused_outline'), - style: BorderStyle.Solid + style: BorderStyle.Solid, }) }, normal: { .border({ radius: $r('sys.float.ohos_id_corner_radius_clicked'), - width: 0 + width: 0, }) } }) .onFocus(() => { if (!this.item.isEnabled) { - return + return; } - this.isOnFocus = true + this.isOnFocus = true; }) .onBlur(() => this.isOnFocus = false) .onHover((isOn) => { if (!this.item.isEnabled) { - return + return; } - this.isOnHover = isOn + this.isOnHover = isOn; }) .onKeyEvent((event) => { if (!this.item.isEnabled) { - return + return; } if (event.keyCode !== KeyCode.KEYCODE_ENTER && event.keyCode !== KeyCode.KEYCODE_SPACE) { - return + return; } if (event.type === KeyType.Down) { - this.isOnClick = true + this.isOnClick = true; } if (event.type === KeyType.Up) { - this.isOnClick = false + this.isOnClick = false; } }) .onTouch((event) => { if (!this.item.isEnabled) { - return + return; } if (event.type === TouchType.Down) { - this.isOnClick = true + this.isOnClick = true; } if (event.type === TouchType.Up || event.type === TouchType.Cancel) { - this.isOnClick = false + this.isOnClick = false; } }) .onClick(() => this.item.isEnabled && this.item.action && this.item.action()) -- Gitee