From 052f518726ebe36937730e72c6fcc3f9146725ed Mon Sep 17 00:00:00 2001 From: jiangzhijun8 Date: Fri, 27 Sep 2024 17:24:04 +0800 Subject: [PATCH] =?UTF-8?q?rating=E7=BB=84=E4=BB=B6=E4=BB=A5=E5=8F=8ACalen?= =?UTF-8?q?darPicker=E7=BB=84=E4=BB=B6=E7=BB=9F=E4=B8=80hap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: jiangzhijun8 --- .../ets/pages/inputs/RichEditorBootcamp.ets | 4 +- .../pages/pickers/CalendarPickerBootcamp.ets | 50 +++++++++++++++++-- .../main/ets/pages/pickers/RatingBootcamp.ets | 16 +++++- 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/examples/components/feature/src/main/ets/pages/inputs/RichEditorBootcamp.ets b/examples/components/feature/src/main/ets/pages/inputs/RichEditorBootcamp.ets index 06ed89648c4..b1c88defe67 100644 --- a/examples/components/feature/src/main/ets/pages/inputs/RichEditorBootcamp.ets +++ b/examples/components/feature/src/main/ets/pages/inputs/RichEditorBootcamp.ets @@ -209,7 +209,7 @@ export struct RichEditorBootcamp { return; } let richEditorSelection = this.controller.getSelection(); - this.PopDataFromPasteboard(richEditorSelection) + this.popDataFromPasteboard(richEditorSelection) } else if (index as number == 3) { if (!this.controller) { @@ -356,7 +356,7 @@ export struct RichEditorBootcamp { }) } - PopDataFromPasteboard(richEditorSeletion: RichEditorSelection) { + popDataFromPasteboard(richEditorSeletion: RichEditorSelection) { let start = richEditorSeletion.selection[0]; let end = richEditorSeletion.selection[1]; diff --git a/examples/components/feature/src/main/ets/pages/pickers/CalendarPickerBootcamp.ets b/examples/components/feature/src/main/ets/pages/pickers/CalendarPickerBootcamp.ets index b8b20c690a1..15e5ae89e34 100644 --- a/examples/components/feature/src/main/ets/pages/pickers/CalendarPickerBootcamp.ets +++ b/examples/components/feature/src/main/ets/pages/pickers/CalendarPickerBootcamp.ets @@ -15,11 +15,20 @@ import { Drawer } from 'common/src/main/ets/components/Drawer'; +import { ColorBlock, RadioBlock, SliderBlock, useEnabled } from 'common'; @Component export struct CalendarPickerBootcamp { @Require @Prop title: ResourceStr; @State showParameters: boolean = false; + @State enableEdgeAlign: boolean = false; + @State edgeAlign: CalendarAlign = CalendarAlign.CENTER; + @State enableAlignItems: boolean = false; + @State alignItems: HorizontalAlign = HorizontalAlign.Center; + @State enableTextColor: boolean = false; + @State textColor: ResourceColor = 'rgb(255, 0, 0, 0.9)'; + @State hintRadius: number = 10; + @State enableHintRadius: boolean = false; @State duration : number = 2000; private selectedDate: Date = new Date(); @@ -42,21 +51,54 @@ export struct CalendarPickerBootcamp { @Builder Content() { - Column() { + Column({ space: 8 }) { Column() { - CalendarPicker({ hintRadius: 10, selected: this.selectedDate }) + CalendarPicker({ hintRadius: useEnabled(this.enableHintRadius, this.hintRadius), selected: this.selectedDate }) + .edgeAlign(useEnabled(this.enableEdgeAlign, this.edgeAlign)) .onChange((value) => { console.info('CalendarPicker onChange:' + JSON.stringify(value)) }) } - }.width('100%') + }.width('100%').height('100%') } @Builder Parameters() { Scroll() { Column({ space: 8 }) { - }.width('100%') + RadioBlock({ + title: '选择器与入口组件的对齐方式', + isEnabled: this.enableAlignItems, + value: this.edgeAlign, + dataSource: [ + { label: 'START', value: CalendarAlign.START }, + { label: 'CENTER', value: CalendarAlign.CENTER }, + { label: 'END', value: CalendarAlign.END } + ] + }) + RadioBlock({ + title: '选择器在容器内的对齐方式', + isEnabled: this.enableEdgeAlign, + value: this.alignItems, + dataSource: [ + { label: 'START', value: HorizontalAlign.Start }, + { label: 'CENTER', value: HorizontalAlign.Center }, + { label: 'END', value: HorizontalAlign.End } + ] + }) + ColorBlock({ + title: '字体颜色', + isEnabled: this.enableTextColor, + color: this.textColor + }) + SliderBlock({ + title: '日期选中态底板样式', + isEnabled: this.enableHintRadius, + value: this.hintRadius, + min: 0, + max: 16 + }) + }.width('100%').height('100%') }.height('50%') } } diff --git a/examples/components/feature/src/main/ets/pages/pickers/RatingBootcamp.ets b/examples/components/feature/src/main/ets/pages/pickers/RatingBootcamp.ets index 47d892197b5..f5c28c4b6eb 100644 --- a/examples/components/feature/src/main/ets/pages/pickers/RatingBootcamp.ets +++ b/examples/components/feature/src/main/ets/pages/pickers/RatingBootcamp.ets @@ -13,7 +13,6 @@ * limitations under the License. */ - import { Drawer } from 'common/src/main/ets/components/Drawer'; import { RadioBlock, SliderBlock, useEnabled } from 'common'; @@ -30,6 +29,8 @@ export struct RatingBootcamp { @State enableStepSize: boolean = false; @State stepSize: number = 0.5; @State enableStarStyle: boolean = false; + @State enableDirection: boolean = false; + @State compDirection: Direction = Direction.Auto; build() { NavDestination() { @@ -44,6 +45,7 @@ export struct RatingBootcamp { } }) } + .backgroundColor($r('sys.color.ohos_id_color_sub_background')) .hideTitleBar(true) } @@ -59,6 +61,7 @@ export struct RatingBootcamp { .onChange((value: number) => { this.rating = value; }) + .direction(useEnabled(this.enableDirection, this.compDirection)) } } @@ -84,6 +87,17 @@ export struct RatingBootcamp { ] }) + RadioBlock({ + title: '评分组件布局方式', + isEnabled: this.enableDirection, + value: this.compDirection, + dataSource: [ + { label: '跟随系统默认布局', value: Direction.Auto }, + { label: '从右到左', value: Direction.Rtl }, + { label: '从左到右', value: Direction.Ltr } + ] + }) + SliderBlock({ title: '评分总数', isEnabled: this.enableStars,