1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/// <reference path='./import.ts' /> 17class GridRowAlignItemsModifier extends ModifierWithKey<number> { 18 constructor(value: number) { 19 super(value); 20 } 21 static identity: Symbol = Symbol('gridRowAlignItems'); 22 applyPeer(node: KNode, reset: boolean): void { 23 if (reset) { 24 getUINativeModule().gridRow.resetAlignItems(node); 25 } else { 26 getUINativeModule().gridRow.setAlignItems(node, this.value!); 27 } 28 } 29 checkObjectDiff(): boolean { 30 return !isBaseOrResourceEqual(this.stageValue, this.value); 31 } 32} 33class ArkGridRowComponent extends ArkComponent implements CommonMethod<GridRowAttribute> { 34 constructor(nativePtr: KNode) { 35 super(nativePtr); 36 } 37 onBreakpointChange(callback: (breakpoints: string) => void): GridRowAttribute { 38 throw new Error('Method not implemented.'); 39 } 40 alignItems(value: ItemAlign): GridRowAttribute { 41 modifierWithKey(this._modifiersWithKeys, GridRowAlignItemsModifier.identity, GridRowAlignItemsModifier, value); 42 return this; 43 } 44} 45// @ts-ignore 46globalThis.GridRow.attributeModifier = function (modifier) { 47 const elmtId = ViewStackProcessor.GetElmtIdToAccountFor(); 48 let nativeNode = getUINativeModule().getFrameNodeById(elmtId); 49 let component = this.createOrGetNode(elmtId, () => { 50 return new ArkGridRowComponent(nativeNode); 51 }); 52 applyUIAttributes(modifier, nativeNode, component); 53 component.applyModifierPatch(); 54};