Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
78538af5
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
78538af5
编写于
8月 21, 2023
作者:
H
hekun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
7632bd1a
from
https://gitee.com/hk-js/xts_acts_3/pulls/9818
submit the test case Signed-off-by:
N
hekun
<
hekun18@huawei.com
>
上级
a9d00001
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
358 addition
and
1 deletion
+358
-1
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
..._ui/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
+7
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/animateAdd.ets
...nt_ui/entry/src/main/ets/MainAbility/pages/animateAdd.ets
+8
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navigation_add.ets
...i/entry/src/main/ets/MainAbility/pages/navigation_add.ets
+5
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/richEditor.ets
...nt_ui/entry/src/main/ets/MainAbility/pages/richEditor.ets
+176
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/richEditorCustomKeyBoard.ets
...c/main/ets/MainAbility/pages/richEditorCustomKeyBoard.ets
+52
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/search_add.ets
...nt_ui/entry/src/main/ets/MainAbility/pages/search_add.ets
+16
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets
..._ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets
+16
-0
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets
...ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets
+16
-0
arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets
...i/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets
+59
-0
arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json
..._ui/entry/src/main/resources/base/profile/main_pages.json
+3
-1
未找到文件。
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/ProgressPage.ets
浏览文件 @
78538af5
...
...
@@ -69,6 +69,7 @@ struct ProgressPage {
.color(this.color)
.value(this.value)
.width(200)
.backgroundColor(this.backColor)
.key('pro1')
Progress({ value: 10 }).width(100).key('pro2')
...
...
@@ -104,6 +105,12 @@ struct ProgressPage {
.value(50)
.width(100)
.height(50)
Progress({ value: this.value, total: 150, type: ProgressType.Linear})
.style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 20 ,strokeRadius:2})
.color(this.color)
.value(50)
.width(100)
.height(50)
}
}.width('100%').margin({ top: 30 })
}
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/animateAdd.ets
浏览文件 @
78538af5
...
...
@@ -67,6 +67,14 @@ struct TransitionEffectExample2 {
TransitionEffect.IDENTITY
)
)
Image($r('app.media.icon')).width(200).height(200).margin({ top: 100 })
.transition(
TransitionEffect.asymmetric(
TransitionEffect.move(TransitionEdge.START),
TransitionEffect.SLIDE
)
)
}
}.width('100%')
}
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navigation_add.ets
浏览文件 @
78538af5
...
...
@@ -157,6 +157,11 @@ struct NavigationExample2 {
.onClick(() => { // 点击后滑到下一页
this.navPathStack.getIndexByName("navidesnation_add")
}).margin({ top: 400, left: 20 })
Button('pushPaht')
.height('5%')
.onClick(() => { // 点击后滑到下一页
this.navPathStack.pushPath(new NavPathInfo("",""))
}).margin({ top: 400, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/richEditor.ets
0 → 100644
浏览文件 @
78538af5
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct richeditor2 {
controller: RichEditorController = new RichEditorController();
options: RichEditorOptions = { controller: this.controller };
private start: number = -1;
private end: number = -1;
@State message: string = "[-1, -1]"
@State content: string = ""
@Builder
SubMenu() {
Menu() {
MenuItem({ content: "取消", labelInfo: "Ctrl+S" })
MenuItem({ content: "确认", labelInfo: "ENTER" })
}
}
build() {
Column() {
Column() {
Text("selection range:").width("100%")
Text() {
Span(this.message)
}.width("100%")
Text("selection content:").width("100%")
Text() {
Span(this.content)
}.width("100%")
}
.borderWidth(1)
.borderColor(Color.Red)
.width("100%")
.height("20%")
Row() {
Button("更新样式:加粗").onClick(() => {
this.controller.updateSpanStyle({
start: this.start,
end: this.end,
textStyle:
{
fontWeight: FontWeight.Bolder
}
})
})
Button("closeSelectionMenu").onClick(() => {
this.controller.closeSelectionMenu();
})
Button("获取选择内容").onClick(() => {
this.content = "";
this.controller.getSpans({
start: this.start,
end: this.end
}).forEach(item => {
if ("imageStyle" in item) {
this.content += item.valueResourceStr;
this.content += "\n"
} else {
this.content += item.value;
this.content += "\n"
}
})
})
Button("删除选择内容").onClick(() => {
this.controller.deleteSpans({
start: this.start,
end: this.end
})
this.start = -1;
this.end = -1;
this.message = "[" + this.start + ", " + this.end + "]"
})
}
.borderWidth(1)
.borderColor(Color.Red)
.width("100%")
.height("10%")
Column() {
RichEditor(this.options)
.copyOptions(CopyOptions.InApp)
.onReady(() => {
this.controller.addTextSpan("0123456789",
{
style:
{
fontColor: Color.Orange,
fontSize: 30
}
})
this.controller.addImageSpan($r("app.media.icon"),
{
imageStyle:
{
size: ["57px", "57px"]
}
})
this.controller.addTextSpan("0123456789",
{
style:
{
fontColor: Color.Black,
fontSize: 30
}
})
})
.key('richEditor')
.bindSelectionMenu(RichEditorSpanType.TEXT,this.SubMenu(),ResponseType.RightClick)
.onSelect((value: RichEditorSelection) => {
[this.start, this.end] = value.selection;
this.message = "[" + this.start + ", " + this.end + "]"
})
.aboutToIMEInput((value: RichEditorInsertValue) => {
console.log("---------------------- aboutToIMEInput ----------------------")
console.log("insertOffset:" + value.insertOffset)
console.log("insertValue:" + value.insertValue)
return true;
})
.onIMEInputComplete((value: RichEditorTextSpanResult) => {
console.log("---------------------- onIMEInputComplete ---------------------")
console.log("spanIndex:" + value.spanPosition.spanIndex)
console.log("spanRange:[" + value.spanPosition.spanRange[0] + "," + value.spanPosition.spanRange[1] + "]")
console.log("offsetInSpan:[" + value.offsetInSpan[0] + "," + value.offsetInSpan[1] + "]")
console.log("value:" + value.value)
})
.aboutToDelete((value: RichEditorDeleteValue) => {
console.log("---------------------- aboutToDelete --------------------------")
console.log("offset:" + value.offset)
console.log("direction:" + value.direction)
console.log("length:" + value.length)
value.richEditorDeleteSpans.forEach(item => {
console.log("---------------------- item --------------------------")
console.log("spanIndex:" + item.spanPosition.spanIndex)
console.log("spanRange:[" + item.spanPosition.spanRange[0] + "," + item.spanPosition.spanRange[1] + "]")
console.log("offsetInSpan:[" + item.offsetInSpan[0] + "," + item.offsetInSpan[1] + "]")
if ("imageStyle" in item) {
console.log("image:" + item.valueResourceStr)
} else {
console.log("text:" + item.value)
}
})
return true;
})
.onDeleteComplete(() => {
console.log("---------------------- onDeleteComplete ------------------------")
})
.borderWidth(1)
.borderColor(Color.Green)
.width("100%")
.height("30%")
}
.borderWidth(1)
.borderColor(Color.Red)
.width("100%")
.height("70%")
}
}
}
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/richEditorCustomKeyBoard.ets
0 → 100644
浏览文件 @
78538af5
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct RichEditorExample {
controller: RichEditorController = new RichEditorController()
// 自定义键盘组件
@Builder CustomKeyboardBuilder() {
Column() {
Grid() {
ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
GridItem() {
Button(item + "")
.width(110).onClick(() => {
this.controller.addTextSpan(item + '', {
style:
{
fontColor: Color.Orange,
fontSize: 30
}
})
})
}
})
}.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
}.backgroundColor(Color.Gray)
}
build() {
Column() {
RichEditor({ controller: this.controller })
// 绑定自定义键盘
.key('richEditor1')
.customKeyboard(this.CustomKeyboardBuilder()).margin(10).border({ width: 1 })
.height(200)
}
}
}
\ No newline at end of file
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/search_add.ets
浏览文件 @
78538af5
...
...
@@ -22,6 +22,21 @@ struct SearchExample {
@State isHidden:boolean = false
@State value1: string = ''
@State value2: string = ''
// 自定义键盘组件
@Builder CustomKeyboardBuilder() {
Column() {
Grid() {
ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
GridItem() {
Button(item + "")
.width(110)
}
})
}.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
}.backgroundColor(Color.Gray)
}
build() {
Column() {
Text('onSubmit:' + this.submitValue).fontSize(18).margin(15)
...
...
@@ -38,6 +53,7 @@ struct SearchExample {
.enableKeyboardOnFocus(true)
.selectionMenuHidden(this.isHidden)
.placeholderFont({ size: 14, weight: 400 })
.customKeyboard(this.CustomKeyboardBuilder())
.onContentScroll((totalOffsetX: number, totalOffsetY: number) =>{
})
.onTextSelectionChange((selectionStart: number, selectionEnd: number)=>{
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets
浏览文件 @
78538af5
...
...
@@ -19,6 +19,21 @@ struct TextAreaExample {
controller: TextAreaController = new TextAreaController()
@State value1: string = ''
@State value2: string = ''
// 自定义键盘组件
@Builder CustomKeyboardBuilder() {
Column() {
Grid() {
ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
GridItem() {
Button(item + "")
.width(110)
}
})
}.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
}.backgroundColor(Color.Gray)
}
build() {
Column() {
Text('value1:' + this.value1).fontSize(18).margin(15)
...
...
@@ -34,6 +49,7 @@ struct TextAreaExample {
.enableKeyboardOnFocus(true)
.selectionMenuHidden(false)
.margin(20)
.customKeyboard(this.CustomKeyboardBuilder())
.barState(BarState.On)
.style(TextContentStyle.INLINE)
.key('textAreaAdd')
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets
浏览文件 @
78538af5
...
...
@@ -20,6 +20,21 @@ struct TextInputExample {
@State isHidden:boolean = false
@State value1: string = ''
@State value2: string = ''
// 自定义键盘组件
@Builder CustomKeyboardBuilder() {
Column() {
Grid() {
ForEach([1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'], (item) => {
GridItem() {
Button(item + "")
.width(110)
}
})
}.maxCount(3).columnsGap(10).rowsGap(10).padding(5)
}.backgroundColor(Color.Gray)
}
build() {
Column() {
Text('value1:' + this.value1).fontSize(18).margin(15)
...
...
@@ -34,6 +49,7 @@ struct TextInputExample {
.barState(BarState.On)
.key('textInputAdd')
.fontSize(14)
.customKeyboard(this.CustomKeyboardBuilder())
.onContentScroll((totalOffsetX: number, totalOffsetY: number) =>{
})
.onTextSelectionChange((selectionStart: number, selectionEnd: number)=>{
...
...
arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets
浏览文件 @
78538af5
...
...
@@ -627,6 +627,65 @@ export default function ApiCommponentAddJsunit() {
done();
});
it('apiCommponentAddJsunit_2400', 0, async function (done) {
console.info("[apiCommponentAddJsunit_2400] START" );
ohosrouter.clear();
ohosrouter.pushUrl({
url: 'MainAbility/pages/richEditor',
params: {
data1: 'message',
data2: {
data3: [123, 456, 789]
}
}
}).then(() => {
// success
}).catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('richEditor');
let obj = JSON.parse(strJson);
console.info("[apiCommponentAddJsunit_2400'] component obj is: " + obj.$type);
expect(obj.$type).assertEqual('RichEditor');
done();
});
it('apiCommponentAddJsunit_2500', 0, async function (done) {
console.info("[apiCommponentAddJsunit_2500] START" );
ohosrouter.clear();
ohosrouter.pushUrl({
url: 'MainAbility/pages/richEditorCustomKeyBoard',
params: {
data1: 'message',
data2: {
data3: [123, 456, 789]
}
}
}).then(() => {
// success
}).catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
})
await CommonFunc.sleep(1000);
let strJson = getInspectorByKey('richEditor1');
let obj = JSON.parse(strJson);
console.info("[apiCommponentAddJsunit_2500'] component obj is: " + obj.$type);
expect(obj.$type).assertEqual('RichEditor');
done();
});
it('apiCommponentAddJsunit_2600', 0, async function (done) {
console.info('apiCommponentAddJsunit_2600 START');
try {
expect(DialogButtonStyle.HIGHLIGHT).assertEqual(1);
} catch(err) {
console.error("apiCommponentAddJsunit_2600 error " + JSON.stringify(err));
}
done();
});
})
...
...
arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
78538af5
...
...
@@ -91,6 +91,8 @@
"MainAbility/pages/RouteType1"
,
"MainAbility/pages/RouteType2"
,
"MainAbility/pages/navition3"
,
"MainAbility/pages/DragController"
"MainAbility/pages/DragController"
,
"MainAbility/pages/richEditor"
,
"MainAbility/pages/richEditorCustomKeyBoard"
]
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录