!41940 ArkUI组件hap迁移

Merge pull request !41940 from jiangzhijun8/master
This commit is contained in:
openharmony_ci 2024-09-27 12:50:52 +00:00 committed by Gitee
commit a4e34c6611
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 63 additions and 7 deletions

View File

@ -209,7 +209,7 @@ export struct RichEditorBootcamp {
return; return;
} }
let richEditorSelection = this.controller.getSelection(); let richEditorSelection = this.controller.getSelection();
this.PopDataFromPasteboard(richEditorSelection) this.popDataFromPasteboard(richEditorSelection)
} else if (index as number == 3) { } else if (index as number == 3) {
if (!this.controller) { if (!this.controller) {
@ -356,7 +356,7 @@ export struct RichEditorBootcamp {
}) })
} }
PopDataFromPasteboard(richEditorSeletion: RichEditorSelection) { popDataFromPasteboard(richEditorSeletion: RichEditorSelection) {
let start = richEditorSeletion.selection[0]; let start = richEditorSeletion.selection[0];
let end = richEditorSeletion.selection[1]; let end = richEditorSeletion.selection[1];

View File

@ -15,11 +15,20 @@
import { Drawer } from 'common/src/main/ets/components/Drawer'; import { Drawer } from 'common/src/main/ets/components/Drawer';
import { ColorBlock, RadioBlock, SliderBlock, useEnabled } from 'common';
@Component @Component
export struct CalendarPickerBootcamp { export struct CalendarPickerBootcamp {
@Require @Prop title: ResourceStr; @Require @Prop title: ResourceStr;
@State showParameters: boolean = false; @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; @State duration : number = 2000;
private selectedDate: Date = new Date(); private selectedDate: Date = new Date();
@ -42,21 +51,54 @@ export struct CalendarPickerBootcamp {
@Builder @Builder
Content() { Content() {
Column() { Column({ space: 8 }) {
Column() { 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) => { .onChange((value) => {
console.info('CalendarPicker onChange:' + JSON.stringify(value)) console.info('CalendarPicker onChange:' + JSON.stringify(value))
}) })
} }
}.width('100%') }.width('100%').height('100%')
} }
@Builder @Builder
Parameters() { Parameters() {
Scroll() { Scroll() {
Column({ space: 8 }) { 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%') }.height('50%')
} }
} }

View File

@ -13,7 +13,6 @@
* limitations under the License. * limitations under the License.
*/ */
import { Drawer } from 'common/src/main/ets/components/Drawer'; import { Drawer } from 'common/src/main/ets/components/Drawer';
import { RadioBlock, SliderBlock, useEnabled } from 'common'; import { RadioBlock, SliderBlock, useEnabled } from 'common';
@ -30,6 +29,8 @@ export struct RatingBootcamp {
@State enableStepSize: boolean = false; @State enableStepSize: boolean = false;
@State stepSize: number = 0.5; @State stepSize: number = 0.5;
@State enableStarStyle: boolean = false; @State enableStarStyle: boolean = false;
@State enableDirection: boolean = false;
@State compDirection: Direction = Direction.Auto;
build() { build() {
NavDestination() { NavDestination() {
@ -44,6 +45,7 @@ export struct RatingBootcamp {
} }
}) })
} }
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))
.hideTitleBar(true) .hideTitleBar(true)
} }
@ -59,6 +61,7 @@ export struct RatingBootcamp {
.onChange((value: number) => { .onChange((value: number) => {
this.rating = value; 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({ SliderBlock({
title: '评分总数', title: '评分总数',
isEnabled: this.enableStars, isEnabled: this.enableStars,