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' /> 17 18class RowSplitResizeableModifier extends ModifierWithKey<boolean> { 19 constructor(value: boolean) { 20 super(value); 21 } 22 static identity: Symbol = Symbol('rowSplitResizeable'); 23 applyPeer(node: KNode, reset: boolean): void { 24 if (reset) { 25 getUINativeModule().rowSplit.resetResizeable(node); 26 } else { 27 getUINativeModule().rowSplit.setResizeable(node, this.value); 28 } 29 } 30} 31class RowSplitClipModifier extends ModifierWithKey<boolean | object> { 32 constructor(value: boolean | object) { 33 super(value); 34 } 35 static identity: Symbol = Symbol('rowSplitClip'); 36 applyPeer(node: KNode, reset: boolean): void { 37 if (reset) { 38 getUINativeModule().common.resetClipWithEdge(node); 39 } else { 40 getUINativeModule().common.setClipWithEdge(node, this.value); 41 } 42 } 43 checkObjectDiff(): boolean { 44 return true; 45 } 46} 47 48class ArkRowSplitComponent extends ArkComponent implements RowSplitAttribute { 49 constructor(nativePtr: KNode, classType?: ModifierType) { 50 super(nativePtr, classType); 51 } 52 resizeable(value: boolean): RowSplitAttribute { 53 modifierWithKey(this._modifiersWithKeys, RowSplitResizeableModifier.identity, RowSplitResizeableModifier, value); 54 return this; 55 } 56 clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute): this { 57 modifierWithKey(this._modifiersWithKeys, RowSplitClipModifier.identity, RowSplitClipModifier, value); 58 return this; 59 } 60} 61// @ts-ignore 62globalThis.RowSplit.attributeModifier = function (modifier: ArkComponent): void { 63 attributeModifierFunc.call(this, modifier, (nativePtr: KNode) => { 64 return new ArkRowSplitComponent(nativePtr); 65 }, (nativePtr: KNode, classType: ModifierType, modifierJS: ModifierJS) => { 66 return new modifierJS.RowSplitModifier(nativePtr, classType); 67 }); 68}; 69