1/* 2* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 16import { DeleteView } from './DeleteView'; 17 18@Component 19export struct ValueItemView { 20 @State deleteEnabled: boolean = true; 21 private value: string = ''; 22 private deleteAction: (event?: ClickEvent) => void = () => {}; 23 private index: number = 0; 24 25 build() { 26 Row() { 27 Column() { 28 Text(`Value: ${this.value}`) 29 .fontColor($r('app.color.text_color_primary')) 30 .fontSize(16) 31 } 32 .height('100%') 33 .layoutWeight(1) 34 .padding({ left: 16, right: 16, top: 12, bottom: 12 }) 35 .borderRadius(16) 36 .backgroundColor($r('app.color.bg_white')) 37 .justifyContent(FlexAlign.Center) 38 .alignItems(HorizontalAlign.Start) 39 40 DeleteView({ enable: this.deleteEnabled }) 41 .id(`delete${this.index}`) 42 .margin({ left: 12 }) 43 .enabled(this.deleteEnabled) 44 .onClick(this.deleteAction) 45 } 46 .width('100%') 47 .height(64) 48 .alignItems(VerticalAlign.Center) 49 } 50}