|
@@ -0,0 +1,89 @@
|
|
|
|
|
+import { BasicType } from "../../../../../Index"
|
|
|
|
|
+import { DiaLogSheetControl } from "./DiaLogControl"
|
|
|
|
|
+
|
|
|
|
|
+@ComponentV2
|
|
|
|
|
+export struct DiaLogSheetComp {
|
|
|
|
|
+ @Param control: DiaLogSheetControl = new DiaLogSheetControl(this.getUIContext())
|
|
|
|
|
+ @Param params: Array<BasicType> = []
|
|
|
|
|
+
|
|
|
|
|
+ @BuilderParam container: (_: () => void) => void = this.containerComp
|
|
|
|
|
+
|
|
|
|
|
+ build() {
|
|
|
|
|
+ NavDestination() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Column(){
|
|
|
|
|
+ this.containerComp()
|
|
|
|
|
+ }
|
|
|
|
|
+ .onAreaChange((o, n) => {
|
|
|
|
|
+ this.control.containerH = n.height as number
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ Blank()
|
|
|
|
|
+ .height(this.control.h_)
|
|
|
|
|
+ .backgroundColor(Color.White)
|
|
|
|
|
+ }
|
|
|
|
|
+ .onClick(() => {})
|
|
|
|
|
+ // 阻塞事件冒泡: 不会触发父组件的点击事件
|
|
|
|
|
+ .hitTestBehavior(HitTestMode.Block)
|
|
|
|
|
+ .onTouch((event: TouchEvent) => { this.control.edgeEffect(event) })
|
|
|
|
|
+ .offset({ y: this.control.h_ < 0 ? Math.abs(this.control.h_ as number) : 0 })
|
|
|
|
|
+ }
|
|
|
|
|
+ .width('100%')
|
|
|
|
|
+ .height('200%')
|
|
|
|
|
+ .opacity(this.control.opacity_)
|
|
|
|
|
+ .backgroundColor(this.control.bgc)
|
|
|
|
|
+ .offset({ y: this.control.offsetY_ })
|
|
|
|
|
+ .justifyContent(FlexAlign.End)
|
|
|
|
|
+ .onAppear(() => { this.control.appear() })
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .gesture(
|
|
|
|
|
+ TapGesture()
|
|
|
|
|
+ .onAction(() => {
|
|
|
|
|
+ this.control._onBackPress()
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ .hideTitleBar(true)
|
|
|
|
|
+ .mode(NavDestinationMode.DIALOG)
|
|
|
|
|
+ .onBackPressed(() => { return this.control._onBackPress() })
|
|
|
|
|
+ .systemTransition(NavigationSystemTransitionType.NONE)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ containerComp(){
|
|
|
|
|
+ Column(){
|
|
|
|
|
+ ForEach(this.params, (item: BasicType, index) => {
|
|
|
|
|
+ Row(){
|
|
|
|
|
+ Text(item.text)
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width("100%")
|
|
|
|
|
+ .onClick(() => { this.control._onBackPress(item.text) })
|
|
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .padding({ top: 24, bottom: 24 })
|
|
|
|
|
+
|
|
|
|
|
+ Divider().width("80%").height(1).backgroundColor('#000000F2')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ Row(){
|
|
|
|
|
+ Text(`取消`)
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
|
|
+ }
|
|
|
|
|
+ .width("100%")
|
|
|
|
|
+ .alignItems(VerticalAlign.Center)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .padding({ top: 24, bottom: 24 })
|
|
|
|
|
+ .onClick(() => { this.control._onBackPress(0) })
|
|
|
|
|
+ }
|
|
|
|
|
+ .width("100%")
|
|
|
|
|
+ .padding({ bottom: 30 })
|
|
|
|
|
+ .backgroundColor(Color.White)
|
|
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ .borderRadius({ topLeft: 8, topRight: 8 })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|