nwo
stringclasses 304
values | sha
stringclasses 304
values | path
stringlengths 9
214
| language
stringclasses 1
value | identifier
stringlengths 0
49
| docstring
stringlengths 1
34.2k
| function
stringlengths 8
59.4k
| ast_function
stringlengths 71
497k
| obf_function
stringlengths 8
39.4k
| url
stringlengths 102
324
| function_sha
stringlengths 40
40
| source
stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
waylau/harmonyos-tutorial
|
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
|
samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
|
arkts
|
Video object collection.
|
export const VIDEO_DATA: VideoBean[] = [
{
'name': 'video1',
'src': 'video1.mp4'
},
{
'name': 'video2',
'src': 'video2.mp4'
}
]
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left VIDEO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VideoBean [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'name' AST#property_name#Right : AST#expression#Left 'video1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'src' AST#property_name#Right : AST#expression#Left 'video1.mp4' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'name' AST#property_name#Right : AST#expression#Left 'video2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'src' AST#property_name#Right : AST#expression#Left 'video2.mp4' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export const VIDEO_DATA: VideoBean[] = [
{
'name': 'video1',
'src': 'video1.mp4'
},
{
'name': 'video2',
'src': 'video2.mp4'
}
]
|
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L136-L145
|
f320410c5313d6a60643fb2600af89198d99e3e4
|
gitee
|
|
openharmony-sig/knowledge_demo_smart_home
|
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
|
FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets
|
arkts
|
HomeTabBar
|
首页tabBar 显示“场景”和“设备”
|
@Component
export struct HomeTabBar {
private tabBars: HomeTabBarModel[] = [
{ id: 0, name: $r("app.string.scence") },
{ id: 1, name: $r("app.string.device") }]
private controller: TabsController = new TabsController()
@Link homeTabIndex: number
/**
* 获取tab当前颜色
*/
getTabTextColor(tabIndex: number, index: HomeTabBarModel) {
let color = Color.Grey
if (tabIndex === index.id) {
color = Color.Blue
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HomeTabBar AST#component_body#Left { AST#property_declaration#Left private tabBars : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HomeTabBarModel [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.scence" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.device" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TabsController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TabsController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right homeTabIndex AST#ERROR#Left : AST#ERROR#Left number /**
* 获取tab当前颜色
*/ getTab Text Color AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left tabIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left HomeTabBarModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right { let color = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right AST#ERROR#Left if AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left tabIndex AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right { AST#property_name#Left color AST#property_name#Right AST#ERROR#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct HomeTabBar {
private tabBars: HomeTabBarModel[] = [
{ id: 0, name: $r("app.string.scence") },
{ id: 1, name: $r("app.string.device") }]
private controller: TabsController = new TabsController()
@Link homeTabIndex: number
getTabTextColor(tabIndex: number, index: HomeTabBarModel) {
let color = Color.Grey
if (tabIndex === index.id) {
color = Color.Blue
}
|
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets#L292-L307
|
aba2f6ba10b57cb726ccd056b564da2cfc20d1d7
|
gitee
|
xt1314520/IbestKnowTeach
|
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
|
entry/src/main/ets/api/TargetInfoApi.type.ets
|
arkts
|
新增目标
|
export interface TargetInfoAddParam {
/**
* 目标内容
*/
content: string
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TargetInfoAddParam AST#object_type#Left { /**
* 目标内容
*/ AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface TargetInfoAddParam {
content: string
}
|
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L22-L28
|
8717248accc5bfacb752211d941da62f939d72bf
|
gitee
|
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/pages/EpisodeDetailPage.ets
|
arkts
|
downloadEpisode
|
下载单集
|
async downloadEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Download: ${this.episode.title}`);
try {
await this.downloadService.downloadEpisode(this.episode);
UIUtils.showToast(new ToastOptions('已添加到下载队列', 2000));
this.isDownloading = true;
} catch (error) {
console.error('Download failed:', error);
const errorMsg = error instanceof Error ? error.message : '下载失败';
UIUtils.showToast(new ToastOptions(errorMsg, 3000));
}
}
}
|
AST#method_declaration#Left async downloadEpisode AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [EpisodeDetailPage] Download: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . downloadService AST#member_expression#Right AST#expression#Right . downloadEpisode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . episode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UIUtils AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ToastOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '已添加到下载队列' AST#expression#Right , AST#expression#Left 2000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDownloading AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Download failed:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errorMsg = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left '下载失败' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left UIUtils AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ToastOptions AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left errorMsg AST#expression#Right , AST#expression#Left 3000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async downloadEpisode() {
if (this.episode) {
console.info(`[EpisodeDetailPage] Download: ${this.episode.title}`);
try {
await this.downloadService.downloadEpisode(this.episode);
UIUtils.showToast(new ToastOptions('已添加到下载队列', 2000));
this.isDownloading = true;
} catch (error) {
console.error('Download failed:', error);
const errorMsg = error instanceof Error ? error.message : '下载失败';
UIUtils.showToast(new ToastOptions(errorMsg, 3000));
}
}
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L81-L94
|
f0b3e409fec03b149c955a8a453321079132c9cd
|
github
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/SplashScreenSample/entry/src/main/ets/view/CopyrightComponent.ets
|
arkts
|
CopyrightComponent
|
Copyright component for splash screen page.
|
@Component
export default struct CopyrightComponent {
build() {
Column() {
Row() {
Image($r("app.media.ic_video"))
.objectFit(ImageFit.Contain)
.width($r('app.float.copy_right_image_width'))
.height($r('app.float.copy_right_image_width'))
Text($r('app.string.copyright_title'))
.fontSize($r('app.float.copyrightArea_title_text_size'))
.fontColor($r('app.color.title'))
.margin({ left: $r('app.float.copyright_title_margin_left') })
.align(Alignment.End)
}
Text($r('app.string.copyright'))
.fontSize($r('app.float.copyright_description_text_size'))
.margin({ top: $r('app.float.copyright_description_margin_top') })
.align(Alignment.End)
.fontColor($r('app.color.copyright_text'))
}
.justifyContent(FlexAlign.Center)
.backgroundColor(Color.White)
.width(CommonConstants.COPYRIGHT_AREA_COLUMN_WIDTH)
.height($r('app.float.copy_right_area_height'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CopyrightComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_video" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copy_right_image_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copy_right_image_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.copyright_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copyrightArea_title_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copyright_title_margin_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.copyright' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copyright_description_text_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copyright_description_margin_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.copyright_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . COPYRIGHT_AREA_COLUMN_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.copy_right_area_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct CopyrightComponent {
build() {
Column() {
Row() {
Image($r("app.media.ic_video"))
.objectFit(ImageFit.Contain)
.width($r('app.float.copy_right_image_width'))
.height($r('app.float.copy_right_image_width'))
Text($r('app.string.copyright_title'))
.fontSize($r('app.float.copyrightArea_title_text_size'))
.fontColor($r('app.color.title'))
.margin({ left: $r('app.float.copyright_title_margin_left') })
.align(Alignment.End)
}
Text($r('app.string.copyright'))
.fontSize($r('app.float.copyright_description_text_size'))
.margin({ top: $r('app.float.copyright_description_margin_top') })
.align(Alignment.End)
.fontColor($r('app.color.copyright_text'))
}
.justifyContent(FlexAlign.Center)
.backgroundColor(Color.White)
.width(CommonConstants.COPYRIGHT_AREA_COLUMN_WIDTH)
.height($r('app.float.copy_right_area_height'))
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/SplashScreenSample/entry/src/main/ets/view/CopyrightComponent.ets#L6-L34
|
dd2c75b5bd93e79743febd7992f0e863d1aa4f76
|
gitee
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets
|
arkts
|
CommentView
|
Comment component.
|
@Component
export struct CommentView {
@ObjectLink private item: VideoItem;
build() {
Column() {
Image($r("app.media.ic_head"))
.width(CommonConstants.WIDTH_HEAD)
.height(CommonConstants.HEIGHT_HEAD)
.margin({ top: CommonConstants.TOP_HEAD })
.objectFit(ImageFit.Contain)
.border({
width: CommonConstants.WIDTH_HEAD_BORDER,
color: Color.White,
radius: CommonConstants.RADIUS_HEAD
})
Image(this.item.isLikes ? $r("app.media.ic_unlike") : $r("app.media.ic_like"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.onClick(() => {
if (this.item.isLikes) {
this.item.likesCount--;
} else {
this.item.likesCount++;
}
this.item.isLikes = !this.item.isLikes;
})
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.likesCount === 0 ? $r('app.string.like') : (this.item.likesCount.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
Image($r("app.media.ic_comment"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.comment === 0 ? $r('app.string.comment') : (this.item.comment.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
Image($r("app.media.ic_share"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.shareTimes === 0 ? $r('app.string.share') : (this.item.shareTimes.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
}
.offset({
x: CommonConstants.OFFSET_COMMENT_X,
y: CommonConstants.OFFSET_COMMENT_Y
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommentView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right private item : AST#type_annotation#Left AST#primary_type#Left VideoItem AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_head" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WIDTH_HEAD AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . HEIGHT_HEAD AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOP_HEAD AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WIDTH_HEAD_BORDER AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . RADIUS_HEAD AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . isLikes AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_unlike" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_like" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WIDTH_VOTE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . HEIGHT_COMMENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . isLikes AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likesCount AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likesCount AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . isLikes AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . item AST#member_expression#Right AST#expression#Right . isLikes AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOP_IMAGE_VOTE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likesCount AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.like' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . likesCount AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_description' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FONT_WEIGHT_LIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WIDTH_VOTE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . HEIGHT_COMMENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOP_IMAGE_VOTE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . comment AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.comment' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . comment AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_description' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FONT_WEIGHT_LIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_share" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . WIDTH_VOTE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . HEIGHT_COMMENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOP_IMAGE_VOTE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . shareTimes AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.share' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . item AST#member_expression#Right AST#expression#Right . shareTimes AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textStyle ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_description' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FONT_WEIGHT_LIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . offset ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . OFFSET_COMMENT_X AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . OFFSET_COMMENT_Y AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CommentView {
@ObjectLink private item: VideoItem;
build() {
Column() {
Image($r("app.media.ic_head"))
.width(CommonConstants.WIDTH_HEAD)
.height(CommonConstants.HEIGHT_HEAD)
.margin({ top: CommonConstants.TOP_HEAD })
.objectFit(ImageFit.Contain)
.border({
width: CommonConstants.WIDTH_HEAD_BORDER,
color: Color.White,
radius: CommonConstants.RADIUS_HEAD
})
Image(this.item.isLikes ? $r("app.media.ic_unlike") : $r("app.media.ic_like"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.onClick(() => {
if (this.item.isLikes) {
this.item.likesCount--;
} else {
this.item.likesCount++;
}
this.item.isLikes = !this.item.isLikes;
})
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.likesCount === 0 ? $r('app.string.like') : (this.item.likesCount.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
Image($r("app.media.ic_comment"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.comment === 0 ? $r('app.string.comment') : (this.item.comment.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
Image($r("app.media.ic_share"))
.width(CommonConstants.WIDTH_VOTE)
.height(CommonConstants.HEIGHT_COMMENT)
.margin({ top: CommonConstants.TOP_IMAGE_VOTE })
Text(this.item.shareTimes === 0 ? $r('app.string.share') : (this.item.shareTimes.toString()))
.textStyle($r('app.float.font_size_description'), CommonConstants.FONT_WEIGHT_LIGHT)
}
.offset({
x: CommonConstants.OFFSET_COMMENT_X,
y: CommonConstants.OFFSET_COMMENT_Y
})
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/view/play/CommentView.ets#L36-L85
|
f5f0eac34cc472a111d715b3c9f34ecf3e36c1d5
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
eventbus/src/main/ets/EventBusCore.ets
|
arkts
|
off
|
注销事件监听
@param eventName 事件名
@param handler 监听回调
|
off(eventName: string, handler?: Function): void {
if (EventBusCore.events.has(eventName)) {
if (handler) {
EventBusCore.events.get(eventName)?.delete(handler);
} else {
EventBusCore.events.delete(eventName);
}
}
}
|
AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left handler ? : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBusCore AST#expression#Right . events AST#member_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left handler AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBusCore AST#expression#Right . events AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left handler AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EventBusCore AST#expression#Right . events AST#member_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left eventName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
off(eventName: string, handler?: Function): void {
if (EventBusCore.events.has(eventName)) {
if (handler) {
EventBusCore.events.get(eventName)?.delete(handler);
} else {
EventBusCore.events.delete(eventName);
}
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L67-L75
|
2d2930f2b4874af5a27fd26edbef3d95e3e8d264
|
gitee
|
Neptune-EX/OS_System_Design.git
|
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
|
entry/src/main/ets/common/utils/PictureSaving.ets
|
arkts
|
photoPickerGetUri.
Returns the URI of the selected file based on the select method of PhotoViewPicker.
@return Promise<string>.
|
export async function photoPickerGetUri(): Promise<string> {
try {
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelper.PhotoViewPicker();
await photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult: photoAccessHelper.PhotoSelectResult) => {
Logger.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult));
uris = PhotoSelectResult.photoUris;
}).catch((err: BusinessError) => {
Logger.error('PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
});
} catch (error) {
let err = error as BusinessError;
Logger.error('PhotoViewPicker failed with err: ' + err.message);
}
return uris[0].toString();
}
|
AST#export_declaration#Left export AST#function_declaration#Left async function photoPickerGetUri AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left PhotoSelectOptions = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left photoAccessHelper AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left PhotoSelectOptions AST#expression#Right . MIMEType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . PhotoViewMIMETypes AST#member_expression#Right AST#expression#Right . IMAGE_TYPE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left PhotoSelectOptions AST#expression#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left photoAccessHelper AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left PhotoSelectOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left PhotoSelectResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'PhotoViewPicker.select successfully, PhotoSelectResult uri: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left PhotoSelectResult AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left uris = AST#expression#Left AST#member_expression#Left AST#expression#Left PhotoSelectResult AST#expression#Right . photoUris AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'PhotoViewPicker.select failed with err: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'PhotoViewPicker failed with err: ' AST#expression#Right + AST#expression#Left err AST#expression#Right AST#binary_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left uris AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export async function photoPickerGetUri(): Promise<string> {
try {
let PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions();
PhotoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
PhotoSelectOptions.maxSelectNumber = 1;
let photoPicker = new photoAccessHelper.PhotoViewPicker();
await photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult: photoAccessHelper.PhotoSelectResult) => {
Logger.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult));
uris = PhotoSelectResult.photoUris;
}).catch((err: BusinessError) => {
Logger.error('PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
});
} catch (error) {
let err = error as BusinessError;
Logger.error('PhotoViewPicker failed with err: ' + err.message);
}
return uris[0].toString();
}
|
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/common/utils/PictureSaving.ets#L28-L45
|
9dad54425d98d7ccfd1a713e8ee358499d87c3d0
|
github
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets
|
arkts
|
照片页
|
build() {
Column() {
Text('photo')
.textAlign(TextAlign.Start)
.width('100%')
.fontSize(30)
.padding(20)
Image($r('app.media.startIcon'))
.opacity(this.opacityDegree)
.width('90%')
.id('origin')// 挂载半模态页
.enabled(this.isEnabled)
.onClick(() => {
// 获取原始图像的位置信息,将模态页上图片移动缩放至该位置
this.originInfo = this.calculateData('origin');
this.scaleValue = this.originInfo.scale;
this.translateX = this.originInfo.translateX;
this.translateY = this.originInfo.translateY;
this.clipWidth = this.originInfo.clipWidth;
this.clipHeight = this.originInfo.clipHeight;
this.radius = 0;
this.opacityDegree = 0;
// 启动半模态页和模态页
this.isShowSheet = true;
this.isShowOverlay = true;
// 设置原图为不可交互抗打断
this.isEnabled = false;
})
Button('bindSheet page style: ' + this.preferTypeArrStr[this.preferTypeIndex])
.fontSize(20)
.margin({ top: 10 })
.onClick(() => {
this.preferTypeIndex = ++this.preferTypeIndex % this.preferTypeArr.length;
})
}
.width('100%')
.height('100%')
.padding({ top: 20 })
.alignItems(HorizontalAlign.Center)
.bindSheet(this.isShowSheet, this.mySheet(), {
// Embedded模式使得其他页面可以高于半模态页
mode: SheetMode.EMBEDDED,
height: this.bindSheetHeight,
preferType: this.preferTypeArr[this.preferTypeIndex],
onDisappear: () => {
// 保证半模态消失时状态正确
this.isShowImage = false;
this.isShowSheet = false;
// 设置一镜到底动画又进入可触发状态
this.isAnimating = false;
// 原图重新变为可交互状态
this.isEnabled = true;
}
}) // 挂载模态页作为一镜到底动画的实现页
.bindContentCover(this.isShowOverlay, this.overlayNode(), {
// 模态页面设置为无转场
transition: TransitionEffect.IDENTITY,
})
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'photo' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.startIcon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacityDegree AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'origin' AST#expression#Right ) // 挂载半模态页 AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 获取原始图像的位置信息,将模态页上图片移动缩放至该位置 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'origin' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleValue AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right AST#expression#Right . translateX AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . translateY AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right AST#expression#Right . translateY AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right AST#expression#Right . clipWidth AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clipHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originInfo AST#member_expression#Right AST#expression#Right . clipHeight AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . radius AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacityDegree AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 启动半模态页和模态页 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowSheet AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowOverlay AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置原图为不可交互抗打断 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'bindSheet page style: ' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . preferTypeArrStr AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferTypeIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferTypeIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#update_expression#Left ++ AST#expression#Left this AST#expression#Right AST#update_expression#Right AST#expression#Right . preferTypeIndex AST#member_expression#Right AST#expression#Right % AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . preferTypeArr AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . bindSheet ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowSheet AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mySheet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { // Embedded模式使得其他页面可以高于半模态页 AST#property_assignment#Left AST#property_name#Left mode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left SheetMode AST#expression#Right . EMBEDDED AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindSheetHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left preferType AST#property_name#Right : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferTypeArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferTypeIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onDisappear AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 保证半模态消失时状态正确 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowImage AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowSheet AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置一镜到底动画又进入可触发状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isAnimating AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 原图重新变为可交互状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEnabled AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) // 挂载模态页作为一镜到底动画的实现页 AST#modifier_chain_expression#Left . bindContentCover ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowOverlay AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . overlayNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { // 模态页面设置为无转场 AST#property_assignment#Left AST#property_name#Left transition AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . IDENTITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
Text('photo')
.textAlign(TextAlign.Start)
.width('100%')
.fontSize(30)
.padding(20)
Image($r('app.media.startIcon'))
.opacity(this.opacityDegree)
.width('90%')
.id('origin')
.enabled(this.isEnabled)
.onClick(() => {
this.originInfo = this.calculateData('origin');
this.scaleValue = this.originInfo.scale;
this.translateX = this.originInfo.translateX;
this.translateY = this.originInfo.translateY;
this.clipWidth = this.originInfo.clipWidth;
this.clipHeight = this.originInfo.clipHeight;
this.radius = 0;
this.opacityDegree = 0;
this.isShowSheet = true;
this.isShowOverlay = true;
this.isEnabled = false;
})
Button('bindSheet page style: ' + this.preferTypeArrStr[this.preferTypeIndex])
.fontSize(20)
.margin({ top: 10 })
.onClick(() => {
this.preferTypeIndex = ++this.preferTypeIndex % this.preferTypeArr.length;
})
}
.width('100%')
.height('100%')
.padding({ top: 20 })
.alignItems(HorizontalAlign.Center)
.bindSheet(this.isShowSheet, this.mySheet(), {
mode: SheetMode.EMBEDDED,
height: this.bindSheetHeight,
preferType: this.preferTypeArr[this.preferTypeIndex],
onDisappear: () => {
this.isShowImage = false;
this.isShowSheet = false;
this.isAnimating = false;
this.isEnabled = true;
}
})
.bindContentCover(this.isShowOverlay, this.overlayNode(), {
transition: TransitionEffect.IDENTITY,
})
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/BindSheet/entry/src/main/ets/pages/multiDeviceConversion/Index04.ets#L150-L208
|
813a8b285c11391e3688ef421b004785c876d01e
|
gitee
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/ImageUtil.ets
|
arkts
|
getPixelMapFromMedia
|
用户获取resource目录下的media中的图片PixelMap
@param resource 例如:$r("app.media.icon")
@returns
|
static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await ResUtil.getMediaContent(resource);
return await ImageUtil.createImageSource(uint8Array.buffer).createPixelMap(options);
}
|
AST#method_declaration#Left static async getPixelMapFromMedia AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uint8Array = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ResUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getMediaContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left ImageUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left uint8Array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async getPixelMapFromMedia(resource: Resource, options?: image.DecodingOptions): Promise<image.PixelMap> {
let uint8Array = await ResUtil.getMediaContent(resource);
return await ImageUtil.createImageSource(uint8Array.buffer).createPixelMap(options);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L249-L252
|
4f5bf68090e574e93e65a210cc0880fed5b55389
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets
|
arkts
|
应用规则61:使用export default替代module.exports
|
export default UserUpdateAction;
|
AST#export_declaration#Left export default AST#expression#Left UserUpdateAction AST#expression#Right ; AST#export_declaration#Right
|
export default UserUpdateAction;
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/UserUpdate.ets#L43-L43
|
c0acf4a1fac5b30f3aabee227649c013d12b806d
|
github
|
|
Active-hue/ArkTS-Accounting.git
|
c432916d305b407557f08e35017c3fd70668e441
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
aboutToAppear
|
初始化数据存储
|
async aboutToAppear() {
try {
const context = getContext(this);
this.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化存储失败:', err);
}
}
|
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferencesStore AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left preferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left 'accountData' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '初始化存储失败:' AST#expression#Right , AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async aboutToAppear() {
try {
const context = getContext(this);
this.preferencesStore = await preferences.getPreferences(context, 'accountData');
} catch (err) {
console.error('初始化存储失败:', err);
}
}
|
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/Index.ets#L346-L353
|
6a97fdccc684d07e6df7922b0cd609b74c1a7690
|
github
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets
|
arkts
|
getCertFromFile
|
从文件获取X509证书
|
async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> {
let newCert: cert.X509Cert | undefined = undefined
let certData = this.getContent(filePath);
if (certData) {
let encodingBlob: cert.EncodingBlob = {
data: new Uint8Array(certData),
encodingFormat: cert.EncodingFormat.FORMAT_PEM
};
await cert.createX509Cert(encodingBlob)
.then((x509Cert: cert.X509Cert) => {
newCert = x509Cert
})
.catch((err: BusinessError) => {
this.msgHistory += `创建X509证书失败:err code is ${err.code}, err message is ${JSON.stringify(err)}\r\n`;
})
}
return newCert
}
|
AST#method_declaration#Left async getCertFromFile AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cert . X509Cert AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newCert : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left cert . X509Cert AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left certData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left certData AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left encodingBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cert . EncodingBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left certData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left encodingFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cert AST#expression#Right . EncodingFormat AST#member_expression#Right AST#expression#Right . FORMAT_PEM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left cert AST#expression#Right AST#await_expression#Right AST#expression#Right . createX509Cert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left encodingBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left x509Cert : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cert . X509Cert AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left newCert = AST#expression#Left x509Cert AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . msgHistory AST#member_expression#Right += AST#expression#Left AST#template_literal#Left ` 创建X509证书失败:err code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , err message is AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left newCert AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getCertFromFile(filePath: string): Promise<cert.X509Cert | undefined> {
let newCert: cert.X509Cert | undefined = undefined
let certData = this.getContent(filePath);
if (certData) {
let encodingBlob: cert.EncodingBlob = {
data: new Uint8Array(certData),
encodingFormat: cert.EncodingFormat.FORMAT_PEM
};
await cert.createX509Cert(encodingBlob)
.then((x509Cert: cert.X509Cert) => {
newCert = x509Cert
})
.catch((err: BusinessError) => {
this.msgHistory += `创建X509证书失败:err code is ${err.code}, err message is ${JSON.stringify(err)}\r\n`;
})
}
return newCert
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/CertificatePinningDemo/entry/src/main/ets/pages/Index.ets#L223-L241
|
4d2a29378db50ec7ea4ef390b795b433c9ad270b
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/notification/ReminderScheduler.ets
|
arkts
|
snoozeReminder
|
暂停提醒(贪睡)
|
async snoozeReminder(reminderId: string, snoozeMinutes: number = 10): Promise<void> {
try {
const config = this.activeReminders.get(reminderId);
if (!config) {
throw new Error('提醒不存在');
}
if (config.snoozeCount !== undefined && config.maxSnoozeCount !== undefined) {
if (config.snoozeCount >= config.maxSnoozeCount) {
hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Max snooze count reached for reminder: ${reminderId}`);
return;
}
}
// 取消当前提醒
await this.cancelReminder(reminderId);
// 创建新的延迟提醒
const newTriggerTime = new Date(Date.now() + snoozeMinutes * 60 * 1000);
const snoozeReminderId = `${reminderId}_snooze_${Date.now()}`;
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM,
hour: newTriggerTime.getHours(),
minute: newTriggerTime.getMinutes(),
title: `⏰ ${config.title}(延迟提醒)`,
content: config.content,
expiredContent: '延迟提醒已过期',
notificationId: parseInt(snoozeReminderId.replace(/\D/g, ''), 10),
slotType: reminderAgentManager.SlotType.CONTENT_INFORMATION
};
await reminderAgentManager.publishReminder(reminderRequest);
// 更新配置
const snoozeConfig: ReminderConfig = {
...config,
id: snoozeReminderId,
triggerTime: newTriggerTime,
snoozeCount: (config.snoozeCount || 0) + 1
};
this.activeReminders.set(snoozeReminderId, snoozeConfig);
await this.saveReminderConfig(snoozeConfig);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Reminder snoozed for ${snoozeMinutes} minutes: ${reminderId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to snooze reminder: ${error}`);
throw error;
}
}
|
AST#method_declaration#Left async snoozeReminder AST#parameter_list#Left ( AST#parameter#Left reminderId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left snoozeMinutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left config = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeReminders AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left config AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '提醒不存在' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . snoozeCount AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxSnoozeCount AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . snoozeCount AST#member_expression#Right AST#expression#Right >= AST#expression#Left config AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxSnoozeCount AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Max snooze count reached for reminder: AST#template_substitution#Left $ { AST#expression#Left reminderId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 取消当前提醒 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 创建新的延迟提醒 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newTriggerTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left snoozeMinutes AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left snoozeReminderId = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left reminderId AST#expression#Right } AST#template_substitution#Right _snooze_ AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reminderRequest : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left reminderAgentManager . ReminderRequestAlarm AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left reminderType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderAgentManager AST#expression#Right . ReminderType AST#member_expression#Right AST#expression#Right . REMINDER_TYPE_ALARM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left hour AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newTriggerTime AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left minute AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newTriggerTime AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` ⏰ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right (延迟提醒) ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expiredContent AST#property_name#Right : AST#expression#Left '延迟提醒已过期' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notificationId AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left snoozeReminderId AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left / \D AST#ERROR#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right AST#ERROR#Left , AST#property_name#Left 10 AST#property_name#Right ) AST#ERROR#Right , AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderAgentManager AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . CONTENT_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left reminderAgentManager AST#expression#Right AST#await_expression#Right AST#expression#Right . publishReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left reminderRequest AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 更新配置 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left snoozeConfig : AST#type_annotation#Left AST#primary_type#Left ReminderConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left ... AST#expression#Left config AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left snoozeReminderId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left triggerTime AST#property_name#Right : AST#expression#Left newTriggerTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left snoozeCount AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . snoozeCount AST#member_expression#Right AST#expression#Right || AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeReminders AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left snoozeReminderId AST#expression#Right , AST#expression#Left snoozeConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveReminderConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left snoozeConfig AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Reminder snoozed for AST#template_substitution#Left $ { AST#expression#Left snoozeMinutes AST#expression#Right } AST#template_substitution#Right minutes: AST#template_substitution#Left $ { AST#expression#Left reminderId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_NOTIFICATION AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to snooze reminder: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left error AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async snoozeReminder(reminderId: string, snoozeMinutes: number = 10): Promise<void> {
try {
const config = this.activeReminders.get(reminderId);
if (!config) {
throw new Error('提醒不存在');
}
if (config.snoozeCount !== undefined && config.maxSnoozeCount !== undefined) {
if (config.snoozeCount >= config.maxSnoozeCount) {
hilog.warn(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Max snooze count reached for reminder: ${reminderId}`);
return;
}
}
await this.cancelReminder(reminderId);
const newTriggerTime = new Date(Date.now() + snoozeMinutes * 60 * 1000);
const snoozeReminderId = `${reminderId}_snooze_${Date.now()}`;
const reminderRequest: reminderAgentManager.ReminderRequestAlarm = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM,
hour: newTriggerTime.getHours(),
minute: newTriggerTime.getMinutes(),
title: `⏰ ${config.title}(延迟提醒)`,
content: config.content,
expiredContent: '延迟提醒已过期',
notificationId: parseInt(snoozeReminderId.replace(/\D/g, ''), 10),
slotType: reminderAgentManager.SlotType.CONTENT_INFORMATION
};
await reminderAgentManager.publishReminder(reminderRequest);
const snoozeConfig: ReminderConfig = {
...config,
id: snoozeReminderId,
triggerTime: newTriggerTime,
snoozeCount: (config.snoozeCount || 0) + 1
};
this.activeReminders.set(snoozeReminderId, snoozeConfig);
await this.saveReminderConfig(snoozeConfig);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Reminder snoozed for ${snoozeMinutes} minutes: ${reminderId}`);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION,
`Failed to snooze reminder: ${error}`);
throw error;
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/ReminderScheduler.ets#L401-L454
|
44c5c4400026c9be5721a70857e4e8dec3c2224f
|
github
|
wuyuanwuhui99/harmony-arkts-music-app-ui.git
|
fc75b993b76293666f9122f527ea3bc6caf7f75c
|
entry/src/main/ets/utils/PreferenceModel.ets
|
arkts
|
setToke
|
写入date日期对应的浏览历史
|
async setToke(token) {
return this.putPreference('token',token)
}
|
AST#method_declaration#Left async setToke AST#parameter_list#Left ( AST#parameter#Left token AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . putPreference AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'token' AST#expression#Right , AST#expression#Left token AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async setToke(token) {
return this.putPreference('token',token)
}
|
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L78-L80
|
df7f122d97bda34c943fdf0961d9fd888e4256f5
|
github
|
bigbear20240612/planner_build-.git
|
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
|
entry/src/main/ets/common/ThemeManager.ets
|
arkts
|
isDarkTheme
|
判断是否为深色主题
|
isDarkTheme(): boolean {
return false; // 临时返回false
}
|
AST#method_declaration#Left isDarkTheme AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right // 临时返回false } AST#block_statement#Right AST#method_declaration#Right
|
isDarkTheme(): boolean {
return false;
}
|
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L241-L243
|
58d6250a30cb86d79c82ebf7147f0645010c226b
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStateChange.ets
|
arkts
|
StatePopupExample
|
[Start state_popup]
|
@Entry
@Component
export struct StatePopupExample {
@State handlePopup: boolean = false;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('PopupOptions')
.margin({ top: 300 })
.onClick(() => {
this.handlePopup = !this.handlePopup;
})
.bindPopup(this.handlePopup, {
message: 'This is a popup with PopupOptions',
onStateChange: (e)=> { // 返回当前的气泡状态
if (!e.isVisible) {
this.handlePopup = false;
}
}
})
}.width('100%').padding({ top: 5 })
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.onStateChange_title'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct StatePopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'PopupOptions' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handlePopup AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . handlePopup AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . bindPopup ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handlePopup AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left 'This is a popup with PopupOptions' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onStateChange AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left e AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 返回当前的气泡状态 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left e AST#expression#Right AST#unary_expression#Right AST#expression#Right . isVisible AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handlePopup AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.onStateChange_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct StatePopupExample {
@State handlePopup: boolean = false;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Button('PopupOptions')
.margin({ top: 300 })
.onClick(() => {
this.handlePopup = !this.handlePopup;
})
.bindPopup(this.handlePopup, {
message: 'This is a popup with PopupOptions',
onStateChange: (e)=> {
if (!e.isVisible) {
this.handlePopup = false;
}
}
})
}.width('100%').padding({ top: 5 })
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.onStateChange_title'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/PopupStateChange.ets#L17-L50
|
e6f90381bd867e49e156637c0f3a9b5f7183ba63
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
|
arkts
|
createCardToDeskTop
|
createCardToDeskTop
@param formCardItem
|
async createCardToDeskTop(formCardItem: FormCardItem) {
if (CheckEmptyUtils.isEmpty(formCardItem)) {
return;
}
Logger.info(TAG, `createCardToDeskTop formCardItem ${JSON.stringify(formCardItem)}`);
let gridItem = this.createNewCardItemInfo(formCardItem);
if (formCardItem.bundleName === SHOPPING_BUNDLE) {
gridItem!.page = this.layoutInfo.length;
gridItem!.row = 0;
gridItem!.column = 0;
} else {
gridItem = this.updateItemLayoutInfo(gridItem);
}
if (gridItem!.page >= this.layoutInfo.length) {
this.layoutInfo.push([]);
}
this.layoutInfo[gridItem!.page].push(gridItem!);
await RdbManager.initRdbConfig(this.context);
await RdbManager.insertItem(gridItem);
Logger.info(TAG, `createCardToDeskTop gridItem = ${JSON.stringify(gridItem)}`);
AppStorage.SetOrCreate('isRefresh', true);
}
|
AST#method_declaration#Left async createCardToDeskTop AST#parameter_list#Left ( AST#parameter#Left formCardItem : AST#type_annotation#Left AST#primary_type#Left FormCardItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CheckEmptyUtils AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formCardItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` createCardToDeskTop formCardItem AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formCardItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left gridItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createNewCardItemInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formCardItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formCardItem AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right === AST#expression#Left SHOPPING_BUNDLE AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . page AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . row AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . column AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left gridItem = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateItemLayoutInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gridItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . page AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . layoutInfo AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . page AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left gridItem AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left RdbManager AST#expression#Right AST#await_expression#Right AST#expression#Right . initRdbConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left RdbManager AST#expression#Right AST#await_expression#Right AST#expression#Right . insertItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gridItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` createCardToDeskTop gridItem = AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gridItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'isRefresh' AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async createCardToDeskTop(formCardItem: FormCardItem) {
if (CheckEmptyUtils.isEmpty(formCardItem)) {
return;
}
Logger.info(TAG, `createCardToDeskTop formCardItem ${JSON.stringify(formCardItem)}`);
let gridItem = this.createNewCardItemInfo(formCardItem);
if (formCardItem.bundleName === SHOPPING_BUNDLE) {
gridItem!.page = this.layoutInfo.length;
gridItem!.row = 0;
gridItem!.column = 0;
} else {
gridItem = this.updateItemLayoutInfo(gridItem);
}
if (gridItem!.page >= this.layoutInfo.length) {
this.layoutInfo.push([]);
}
this.layoutInfo[gridItem!.page].push(gridItem!);
await RdbManager.initRdbConfig(this.context);
await RdbManager.insertItem(gridItem);
Logger.info(TAG, `createCardToDeskTop gridItem = ${JSON.stringify(gridItem)}`);
AppStorage.SetOrCreate('isRefresh', true);
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L434-L455
|
2ada02dc400721a3526c5744a57ade6636b63699
|
gitee
|
harmonyos/samples
|
f5d967efaa7666550ee3252d118c3c73a77686f5
|
ETSUI/AboutSample/entry/src/main/ets/view/AppInfoComponent.ets
|
arkts
|
AppInfoComponent
|
AppInfo component shows the relevant information of the application.
|
@Component
export struct AppInfoComponent {
private appInfoData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.appInfoData, (item: ListItemData) => {
ListItem() {
Column() {
AppInfoItem({
appInfoItem: item
})
Divider()
.color($r('app.color.divider'))
.strokeWidth(CommonConstants.DIVIDER_STROKE_WIDTH)
.margin({
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_left')
})
}
}
}, item => JSON.stringify(item))
}
}
.padding({
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_right')
})
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AppInfoComponent AST#component_body#Left { AST#property_declaration#Left private appInfoData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appInfoData AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ListItemData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppInfoItem ( AST#component_parameters#Left { AST#component_parameter#Left appInfoItem : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.divider' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . DIVIDER_STROKE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left item => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.list_padding_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct AppInfoComponent {
private appInfoData: Array<ListItemData>;
build() {
Column() {
List() {
ForEach(this.appInfoData, (item: ListItemData) => {
ListItem() {
Column() {
AppInfoItem({
appInfoItem: item
})
Divider()
.color($r('app.color.divider'))
.strokeWidth(CommonConstants.DIVIDER_STROKE_WIDTH)
.margin({
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_left')
})
}
}
}, item => JSON.stringify(item))
}
}
.padding({
left: $r('app.float.list_padding_left'),
right: $r('app.float.list_padding_right')
})
}
}
|
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/view/AppInfoComponent.ets#L9-L39
|
6b3573431d62e33b0662f45cfa797619fa7e1ee0
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/LocationUtil.ets
|
arkts
|
onLocationEnabledChange
|
订阅位置服务状态变化。
@param callback 回调函数。返回true表示位置信息开关已经开启;返回false表示位置信息开关已经关闭。
|
static onLocationEnabledChange(callback: Callback<boolean>) {
geoLocationManager.on('locationEnabledChange', callback);
}
|
AST#method_declaration#Left static onLocationEnabledChange AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left geoLocationManager AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'locationEnabledChange' AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static onLocationEnabledChange(callback: Callback<boolean>) {
geoLocationManager.on('locationEnabledChange', callback);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L175-L177
|
2c6434b9b3f8d6d2991f5d5ca0dd5cbd1b3e94b4
|
gitee
|
pangpang20/wavecast.git
|
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
|
entry/src/main/ets/service/PodcastService.ets
|
arkts
|
updatePodcastEpisodes
|
更新播客的Episodes
成功时更新 lastSuccessfulFetch,失败时标记 isFetchFailed
|
async updatePodcastEpisodes(podcastId: string): Promise<void> {
try {
console.info(`[PodcastService] Starting to update episodes for podcast: ${podcastId}`);
// 从数据库获取播客信息,拿到 feedUrl
const podcast = await this.dbService.getPodcastById(podcastId);
if (!podcast || !podcast.feedUrl) {
console.warn('[PodcastService] No podcast or feedUrl found for id:', podcastId);
return;
}
// 如果已标记为获取失败,跳过刷新
if (podcast.isFetchFailed) {
console.info(`[PodcastService] Podcast ${podcastId} is marked as fetch failed, skipping refresh`);
return;
}
console.info(`[PodcastService] Fetching RSS from: ${podcast.feedUrl}`);
// 拉取 RSS 内容(增加超时时间)
const rssContent = await this.fetchRssFeed(podcast.feedUrl);
console.info(`[PodcastService] RSS content fetched, length: ${rssContent.length}`);
// 解析出单集列表
const episodes = this.parseEpisodesFromRss(rssContent, podcastId);
console.info(`[PodcastService] Parsed ${episodes.length} episodes`);
if (!episodes.length) {
console.warn('[PodcastService] No episodes parsed from rss for podcast:', podcastId);
// 即使没有解析到单集,也不抛异常,只记录日志
return;
}
// 先清空旧的单集,再插入新的
await this.dbService.deleteEpisodesByPodcastId(podcastId);
for (let i = 0; i < episodes.length; i++) {
await this.dbService.insertEpisode(episodes[i]);
}
// 更新播客的 episodeCount 和 lastSuccessfulFetch
await this.dbService.updatePodcastEpisodeCount(podcastId, episodes.length);
await this.dbService.updatePodcastFetchStatus(podcastId, false, Date.now());
console.info(`[PodcastService] Successfully updated ${episodes.length} episodes for podcast: ${podcastId}`);
} catch (error) {
const errMsg = error instanceof Error ? error.message : String(error);
console.error('[PodcastService] Failed to update podcast episodes:', errMsg);
// 标记播客为获取失败
await this.dbService.updatePodcastFetchStatus(podcastId, true);
// 不抛异常,让调用者决定如何处理
throw new Error(`Failed to update podcast episodes: ${errMsg}`);
}
}
|
AST#method_declaration#Left async updatePodcastEpisodes AST#parameter_list#Left ( AST#parameter#Left podcastId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] Starting to update episodes for podcast: AST#template_substitution#Left $ { AST#expression#Left podcastId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 从数据库获取播客信息,拿到 feedUrl AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left podcast = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . getPodcastById AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcastId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left podcast AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left podcast AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . feedUrl AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[PodcastService] No podcast or feedUrl found for id:' AST#expression#Right , AST#expression#Left podcastId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 如果已标记为获取失败,跳过刷新 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . isFetchFailed AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] Podcast AST#template_substitution#Left $ { AST#expression#Left podcastId AST#expression#Right } AST#template_substitution#Right is marked as fetch failed, skipping refresh ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] Fetching RSS from: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . feedUrl AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 拉取 RSS 内容(增加超时时间) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rssContent = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . fetchRssFeed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left podcast AST#expression#Right . feedUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] RSS content fetched, length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left rssContent AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 解析出单集列表 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left episodes = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parseEpisodesFromRss AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rssContent AST#expression#Right , AST#expression#Left podcastId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] Parsed AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left episodes AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right episodes ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left episodes AST#expression#Right AST#unary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[PodcastService] No episodes parsed from rss for podcast:' AST#expression#Right , AST#expression#Left podcastId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 即使没有解析到单集,也不抛异常,只记录日志 AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 先清空旧的单集,再插入新的 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . deleteEpisodesByPodcastId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcastId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left episodes AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . insertEpisode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left episodes AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right // 更新播客的 episodeCount 和 lastSuccessfulFetch AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . updatePodcastEpisodeCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcastId AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left episodes AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . updatePodcastFetchStatus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcastId AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [PodcastService] Successfully updated AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left episodes AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right episodes for podcast: AST#template_substitution#Left $ { AST#expression#Left podcastId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errMsg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[PodcastService] Failed to update podcast episodes:' AST#expression#Right , AST#expression#Left errMsg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 标记播客为获取失败 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . dbService AST#member_expression#Right AST#expression#Right . updatePodcastFetchStatus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left podcastId AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 不抛异常,让调用者决定如何处理 AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to update podcast episodes: AST#template_substitution#Left $ { AST#expression#Left errMsg AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async updatePodcastEpisodes(podcastId: string): Promise<void> {
try {
console.info(`[PodcastService] Starting to update episodes for podcast: ${podcastId}`);
const podcast = await this.dbService.getPodcastById(podcastId);
if (!podcast || !podcast.feedUrl) {
console.warn('[PodcastService] No podcast or feedUrl found for id:', podcastId);
return;
}
if (podcast.isFetchFailed) {
console.info(`[PodcastService] Podcast ${podcastId} is marked as fetch failed, skipping refresh`);
return;
}
console.info(`[PodcastService] Fetching RSS from: ${podcast.feedUrl}`);
const rssContent = await this.fetchRssFeed(podcast.feedUrl);
console.info(`[PodcastService] RSS content fetched, length: ${rssContent.length}`);
const episodes = this.parseEpisodesFromRss(rssContent, podcastId);
console.info(`[PodcastService] Parsed ${episodes.length} episodes`);
if (!episodes.length) {
console.warn('[PodcastService] No episodes parsed from rss for podcast:', podcastId);
return;
}
await this.dbService.deleteEpisodesByPodcastId(podcastId);
for (let i = 0; i < episodes.length; i++) {
await this.dbService.insertEpisode(episodes[i]);
}
await this.dbService.updatePodcastEpisodeCount(podcastId, episodes.length);
await this.dbService.updatePodcastFetchStatus(podcastId, false, Date.now());
console.info(`[PodcastService] Successfully updated ${episodes.length} episodes for podcast: ${podcastId}`);
} catch (error) {
const errMsg = error instanceof Error ? error.message : String(error);
console.error('[PodcastService] Failed to update podcast episodes:', errMsg);
await this.dbService.updatePodcastFetchStatus(podcastId, true);
throw new Error(`Failed to update podcast episodes: ${errMsg}`);
}
}
|
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/PodcastService.ets#L115-L170
|
5d2c32ca26900281c9b715dae9df984a37d31804
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets
|
arkts
|
onIdle
|
[End builder_node_pool] [Start on_idle] The onIdle callback returns the idle time idleTimeInNano at the end of the frame.
|
onIdle(idleTimeInNano: number): void {
// Stop pre creation when the number of pre created components exceeds the number of simulated data
if (this.todoCount >= this.viewItems.length) {
return;
}
// The current time will be used to calculate the remaining idle time of this frame in the future.
let cur: number = systemDateTime.getTime(true);
// The idle time at the end of the frame is used to calculate the remaining idle time of the current frame.
let timeLeft = idleTimeInNano;
// When the idle time at the end of the frame is greater than 1ms, perform pre creation.
// The idle time limit here is set to 1ms, which means that when the idle time is less than 1ms, the component will no longer be pre created in this frame, but the frame callback will be passed to the next frame. Developers can set it according to their own business and component complexity, and reserve sufficient idle time.
while (timeLeft >= 1000000) {
// [End on_idle]
// [Start start_trace]
hiTraceMeter.startTrace('onIdle_prebuild', 1);
// Perform component pre creation
NodePool.getInstance()
.preBuild('reuse_type_', this.viewItems[this.todoCount], flowItemWrapper, this.uiContext);
hiTraceMeter.finishTrace('onIdle_prebuild', 1);
// After the pre creation is completed, update the remaining idle time of this frame.
let now = systemDateTime.getTime(true);
timeLeft = timeLeft - (now - cur);
cur = now;
this.todoCount++;
// Stop pre creation when the number of pre created components exceeds the number of simulated data
if (this.todoCount >= this.viewItems.length) {
return;
}
// [End start_trace]
}
// [Start pre_create]
// If the pre creation of the component is not completed, the frame callback is passed to the next frame and the pre creation of the component continues in the next frame.
if (this.todoCount < this.viewItems.length) {
this.uiContext.postFrameCallback(this);
}
// [End pre_create]
}
|
AST#method_declaration#Left onIdle AST#parameter_list#Left ( AST#parameter#Left idleTimeInNano : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // Stop pre creation when the number of pre created components exceeds the number of simulated data AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoCount AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . viewItems AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // The current time will be used to calculate the remaining idle time of this frame in the future. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cur : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemDateTime AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // The idle time at the end of the frame is used to calculate the remaining idle time of the current frame. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left timeLeft = AST#expression#Left idleTimeInNano AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // When the idle time at the end of the frame is greater than 1ms, perform pre creation. // The idle time limit here is set to 1ms, which means that when the idle time is less than 1ms, the component will no longer be pre created in this frame, but the frame callback will be passed to the next frame. Developers can set it according to their own business and component complexity, and reserve sufficient idle time. AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left timeLeft AST#expression#Right >= AST#expression#Left 1000000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // [End on_idle] // [Start start_trace] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hiTraceMeter AST#expression#Right . startTrace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'onIdle_prebuild' AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Perform component pre creation AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left NodePool AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . preBuild AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'reuse_type_' AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewItems AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoCount AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right , AST#expression#Left flowItemWrapper AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hiTraceMeter AST#expression#Right . finishTrace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'onIdle_prebuild' AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // After the pre creation is completed, update the remaining idle time of this frame. AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left systemDateTime AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left timeLeft = AST#expression#Left AST#binary_expression#Left AST#expression#Left timeLeft AST#expression#Right - AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left now AST#expression#Right - AST#expression#Left cur AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left cur = AST#expression#Left now AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoCount AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Stop pre creation when the number of pre created components exceeds the number of simulated data AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoCount AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . viewItems AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // [End start_trace] } AST#block_statement#Right AST#while_statement#Right AST#statement#Right // [Start pre_create] // If the pre creation of the component is not completed, the frame callback is passed to the next frame and the pre creation of the component continues in the next frame. AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . todoCount AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . viewItems AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiContext AST#member_expression#Right AST#expression#Right . postFrameCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // [End pre_create] } AST#block_statement#Right AST#method_declaration#Right
|
onIdle(idleTimeInNano: number): void {
if (this.todoCount >= this.viewItems.length) {
return;
}
let cur: number = systemDateTime.getTime(true);
let timeLeft = idleTimeInNano;
while (timeLeft >= 1000000) {
hiTraceMeter.startTrace('onIdle_prebuild', 1);
NodePool.getInstance()
.preBuild('reuse_type_', this.viewItems[this.todoCount], flowItemWrapper, this.uiContext);
hiTraceMeter.finishTrace('onIdle_prebuild', 1);
let now = systemDateTime.getTime(true);
timeLeft = timeLeft - (now - cur);
cur = now;
this.todoCount++;
if (this.todoCount >= this.viewItems.length) {
return;
}
}
if (this.todoCount < this.viewItems.length) {
this.uiContext.postFrameCallback(this);
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/pages/BuilderNodePoolDemo.ets#L47-L84
|
49d01a1e09819914160308063f0b35a8ea5d85d3
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets
|
arkts
|
字节流转字符串
|
export function arrayBufferToString(uint8Array: Uint8Array): string {
let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM: true
}
let decodeToStringOptions: util.DecodeToStringOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
let retStr = textDecoder.decodeToString(new Uint8Array(uint8Array), decodeToStringOptions);
console.info('字节流转成可理解的字符串:' + retStr);
return retStr;
}
|
AST#export_declaration#Left export AST#function_declaration#Left function arrayBufferToString AST#parameter_list#Left ( AST#parameter#Left uint8Array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textDecoderOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . TextDecoderOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fatal AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left decodeToStringOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left util . DecodeToStringOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textDecoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left textDecoderOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left retStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textDecoder AST#expression#Right . decodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uint8Array AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left decodeToStringOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '字节流转成可理解的字符串:' AST#expression#Right + AST#expression#Left retStr AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left retStr AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function arrayBufferToString(uint8Array: Uint8Array): string {
let textDecoderOptions: util.TextDecoderOptions = {
fatal: false,
ignoreBOM: true
}
let decodeToStringOptions: util.DecodeToStringOptions = {
stream: false
}
let textDecoder = util.TextDecoder.create('utf-8', textDecoderOptions);
let retStr = textDecoder.decodeToString(new Uint8Array(uint8Array), decodeToStringOptions);
console.info('字节流转成可理解的字符串:' + retStr);
return retStr;
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets#L60-L72
|
cd13e8e75e15354c712e60cad574dbe504c04a05
|
gitee
|
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
|
arkts
|
Defines the PersistentStorage interface.
@since 7
|
export class PersistentStorage {
/**
* Called when a persistence property is stored.
* @since 7
* @deprecated since 10
*/
static PersistProp<T>(key: string, defaultValue: T): void {
PersistentStorage.persistProp(key, defaultValue)
}
/**
* Called when a persistence property is stored.
* @since 10
*/
static persistProp<T>(key: string, defaultValue: T): void {
throw new Error("PersistentStorage.persistProp is not implemented")
}
/**
* Called when a property is deleted.
* @since 7
* @deprecated since 10
*/
static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
}
/**
* Called when a property is deleted.
* @since 10
*/
static deleteProp(key: string): void {
throw new Error("PersistentStorage.deleteProp is not implemented")
}
/**
* Called when multiple persistence properties are stored.
* @since 10
*/
static persistProps(properties: PersistPropsOptions[]): void {
for (const prop of properties) PersistentStorage.persistProp(prop.key, prop.defaultValue)
}
/**
* Set the key value.
* @since 7
* @deprecated since 10
*/
static Keys(): Array<string> {
return PersistentStorage.keys()
}
/**
* Set the key value.
* @since 10
*/
static keys(): Array<string> {
throw new Error("PersistentStorage.keys is not implemented")
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class PersistentStorage AST#class_body#Left { /**
* Called when a persistence property is stored.
* @since 7
* @deprecated since 10
*/ AST#method_declaration#Left static PersistProp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PersistentStorage AST#expression#Right . persistProp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left defaultValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Called when a persistence property is stored.
* @since 10
*/ AST#method_declaration#Left static persistProp AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "PersistentStorage.persistProp is not implemented" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Called when a property is deleted.
* @since 7
* @deprecated since 10
*/ AST#method_declaration#Left static DeleteProp AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PersistentStorage AST#expression#Right . deleteProp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* Called when a property is deleted.
* @since 10
*/ AST#method_declaration#Left static deleteProp AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "PersistentStorage.deleteProp is not implemented" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Called when multiple persistence properties are stored.
* @since 10
*/ AST#method_declaration#Left static persistProps AST#parameter_list#Left ( AST#parameter#Left properties : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PersistPropsOptions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const prop of AST#expression#Left properties AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PersistentStorage AST#expression#Right . persistProp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left prop AST#expression#Right . key AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left prop AST#expression#Right . defaultValue AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Set the key value.
* @since 7
* @deprecated since 10
*/ AST#method_declaration#Left static Keys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PersistentStorage AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* Set the key value.
* @since 10
*/ AST#method_declaration#Left static keys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "PersistentStorage.keys is not implemented" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class PersistentStorage {
static PersistProp<T>(key: string, defaultValue: T): void {
PersistentStorage.persistProp(key, defaultValue)
}
static persistProp<T>(key: string, defaultValue: T): void {
throw new Error("PersistentStorage.persistProp is not implemented")
}
static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
}
static deleteProp(key: string): void {
throw new Error("PersistentStorage.deleteProp is not implemented")
}
static persistProps(properties: PersistPropsOptions[]): void {
for (const prop of properties) PersistentStorage.persistProp(prop.key, prop.defaultValue)
}
static Keys(): Array<string> {
return PersistentStorage.keys()
}
static keys(): Array<string> {
throw new Error("PersistentStorage.keys is not implemented")
}
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L367-L423
|
1c1250b240d2a4e05d026ebeda79ef18f0851ae1
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NonSameLayerRendering/entry/src/main/ets/pages/Index.ets
|
arkts
|
WebviewController controller
|
build() {
Stack() {
Web({ src: $rawfile('nativeembed_view.html'), controller: this.browserTabController })
.backgroundColor('#F1F3F5')
.onPageEnd(() => {
this.browserTabController.runJavaScript(
'getEmbedSize()',
(error, result) => {
if (result) {
interface EmbedSize {
width: number,
height: number
}
let embedSize = JSON.parse(result) as EmbedSize;
this.searchWidth = embedSize.width;
this.searchHeight = embedSize.height;
this.isWebInit = true;
}
});
})
if (this.isWebInit){
Column() {
// Because it needs to be displayed according to the actual size of the Web, it needs to wait for the width and height to be obtained after the Web is initialized, and then it needs to be layered on the Web
SearchComponent({ searchWidth: this.searchWidth, searchHeight: this.searchHeight })
}
.zIndex(10)
}
}
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Web ( AST#component_parameters#Left { AST#component_parameter#Left src : AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'nativeembed_view.html' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . browserTabController AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' AST#expression#Right ) AST#modifier_chain_expression#Left . onPageEnd ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . browserTabController AST#member_expression#Right AST#expression#Right . runJavaScript AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getEmbedSize()' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right , AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left result AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left interface AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left EmbedSize AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left number AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left number AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left embedSize = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left EmbedSize AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left embedSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left embedSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isWebInit AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isWebInit AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // Because it needs to be displayed according to the actual size of the Web, it needs to wait for the width and height to be obtained after the Web is initialized, and then it needs to be layered on the Web AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SearchComponent ( AST#component_parameters#Left { AST#component_parameter#Left searchWidth : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchWidth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left searchHeight : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchHeight AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Stack() {
Web({ src: $rawfile('nativeembed_view.html'), controller: this.browserTabController })
.backgroundColor('#F1F3F5')
.onPageEnd(() => {
this.browserTabController.runJavaScript(
'getEmbedSize()',
(error, result) => {
if (result) {
interface EmbedSize {
width: number,
height: number
}
let embedSize = JSON.parse(result) as EmbedSize;
this.searchWidth = embedSize.width;
this.searchHeight = embedSize.height;
this.isWebInit = true;
}
});
})
if (this.isWebInit){
Column() {
SearchComponent({ searchWidth: this.searchWidth, searchHeight: this.searchHeight })
}
.zIndex(10)
}
}
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NonSameLayerRendering/entry/src/main/ets/pages/Index.ets#L28-L56
|
9d156969cc12cda8ab4896c404092f736bc9198a
|
gitee
|
|
AlatusLee/HarmonyOS-Next-Weather-Assistant.git
|
d3c7060a8ff7f7656175e83fa32536b11e136556
|
alatus/src/main/ets/pages/Index.ets
|
arkts
|
aboutToAppear
|
获取数据
|
aboutToAppear(): void {
this.initDate();
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.initDate();
}
|
https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/pages/Index.ets#L32-L34
|
5542947e4a1f18aee37bed977263704dcb2f5362
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/PixelMapUtils.ets
|
arkts
|
createPixelMapFromUint8Array
|
从 Uint8Array 创建 PixelMap(create 系列命名)
@param data Uint8Array 数据
@param options 解码选项
|
static async createPixelMapFromUint8Array(
data: Uint8Array,
options?: image.DecodingOptions
): Promise<image.PixelMap | null> {
return await PixelMapUtil.uint8ArrayToPixelMap(data, options);
}
|
AST#method_declaration#Left static async createPixelMapFromUint8Array AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . DecodingOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PixelMapUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . uint8ArrayToPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async createPixelMapFromUint8Array(
data: Uint8Array,
options?: image.DecodingOptions
): Promise<image.PixelMap | null> {
return await PixelMapUtil.uint8ArrayToPixelMap(data, options);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PixelMapUtils.ets#L57-L62
|
3395cbd57bafebfe2565abc2f241f8842ef51d46
|
github
|
mayuanwei/harmonyOS_bilibili
|
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
|
AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets
|
arkts
|
pinyinToChinese
|
拼音朝代转汉字朝代 并拼接 前后括号
|
pinyinToChinese(pinyin:string){
return '[' + DYNASTY_MAP[pinyin] + ']'
}
|
AST#method_declaration#Left pinyinToChinese AST#parameter_list#Left ( AST#parameter#Left pinyin : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '[' AST#expression#Right + AST#expression#Left AST#subscript_expression#Left AST#expression#Left DYNASTY_MAP AST#expression#Right [ AST#expression#Left pinyin AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
pinyinToChinese(pinyin:string){
return '[' + DYNASTY_MAP[pinyin] + ']'
}
|
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/utils/DxinPoetryUtil.ets#L13-L15
|
69c505b570c4f2b31f91ead8f082d3f7ad3f6062
|
gitee
|
anhao0226/harmony-music-player.git
|
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
|
entry/src/main/ets/models/CommonDataSource.ets
|
arkts
|
getAllData
|
@deprecated
@returns
|
getAllData(): T [] {
return this.dataArray;
}
|
AST#method_declaration#Left getAllData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getAllData(): T [] {
return this.dataArray;
}
|
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/models/CommonDataSource.ets#L13-L15
|
ce6550962ac5bd88a51e39607f948301f7c8ed5d
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets
|
arkts
|
updateConfirmPassword
|
更新确认密码
@param {string} value - 确认密码
@returns {void} 无返回值
|
updateConfirmPassword(value: string): void {
}
|
AST#method_declaration#Left updateConfirmPassword AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
|
updateConfirmPassword(value: string): void {
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/ResetPasswordViewModel.ets#L38-L39
|
010c98e9cb5d3e5bc4a00a55daac7dd0dcd50597
|
github
|
salehelper/algorithm_arkts.git
|
61af15272038646775a4745fca98a48ba89e1f4e
|
entry/src/main/ets/sorting/InsertionSort.ets
|
arkts
|
插入排序实现
|
export class InsertionSort {
/**
* 插入排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/
public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
for (let i = 1; i < n; i++) {
const key = result[i];
let j = i - 1;
// 将比key大的元素向后移动
while (j >= 0 && result[j] > key) {
result[j + 1] = result[j];
j--;
}
result[j + 1] = key;
}
|
AST#export_declaration#Left export AST#class_declaration#Left class InsertionSort AST#class_body#Left { /**
* 插入排序算法
* @param arr 需要排序的数组
* @returns 排序后的数组
*/ AST#property_declaration#Left public static sort AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left arr AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left n = AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left n AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left j = AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 将比key大的元素向后移动 AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right > AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = result AST#ERROR#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left j AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right = AST#expression#Left key AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class InsertionSort {
public static sort(arr: number[]): number[] {
const result = [...arr];
const n = result.length;
for (let i = 1; i < n; i++) {
const key = result[i];
let j = i - 1;
while (j >= 0 && result[j] > key) {
result[j + 1] = result[j];
j--;
}
result[j + 1] = key;
}
|
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/InsertionSort.ets#L4-L24
|
409f9036b600c26408370055d1398995169b2bd7
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
|
arkts
|
getWordUserByTitleEn
|
====== 查询 ======
|
async getWordUserByTitleEn(titleEn: string): Promise<WordUser | null> {
if (!this.db) return null;
const titleEnBase64 = StringEncoder.encodedToBase64(titleEn)
if (!titleEnBase64) return null;
const sql = `SELECT wu.*, dw.${Tables.DeleteWord.Col.DELETED}
FROM ${Tables.Learn.NAME} wu
LEFT JOIN ${Tables.DeleteWord.NAME} dw
ON wu.${Tables.Learn.Col.TITLE_EN} = dw.${Tables.DeleteWord.Col.TITLE_EN}
WHERE wu.${Tables.Learn.Col.TITLE_EN} = ?`;
const result = await this.db.getData(sql, [titleEnBase64], (rs: relationalStore.ResultSet) =>
this.createWordUserFromResultSet(rs)
);
return result;
}
|
AST#method_declaration#Left async getWordUserByTitleEn AST#parameter_list#Left ( AST#parameter#Left titleEn : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left WordUser AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left titleEnBase64 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . encodedToBase64 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left titleEn AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left titleEnBase64 AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` SELECT wu.*, dw. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . DELETED AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
FROM AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . NAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right wu
LEFT JOIN AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . NAME AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right dw
ON wu. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLE_EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right = dw. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . DeleteWord AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLE_EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right
WHERE wu. AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tables AST#expression#Right . Learn AST#member_expression#Right AST#expression#Right . Col AST#member_expression#Right AST#expression#Right . TITLE_EN AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right = ? ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . db AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left titleEnBase64 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createWordUserFromResultSet AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async getWordUserByTitleEn(titleEn: string): Promise<WordUser | null> {
if (!this.db) return null;
const titleEnBase64 = StringEncoder.encodedToBase64(titleEn)
if (!titleEnBase64) return null;
const sql = `SELECT wu.*, dw.${Tables.DeleteWord.Col.DELETED}
FROM ${Tables.Learn.NAME} wu
LEFT JOIN ${Tables.DeleteWord.NAME} dw
ON wu.${Tables.Learn.Col.TITLE_EN} = dw.${Tables.DeleteWord.Col.TITLE_EN}
WHERE wu.${Tables.Learn.Col.TITLE_EN} = ?`;
const result = await this.db.getData(sql, [titleEnBase64], (rs: relationalStore.ResultSet) =>
this.createWordUserFromResultSet(rs)
);
return result;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L367-L384
|
d5165a1a41b00d79efd41ff65e1ea5d21d8ef9d4
|
github
|
Vinson0709/arkdemo.git
|
793491fe04b387f55dadfef86b30e28d0535d994
|
entry/src/main/ets/pages/Loading.ets
|
arkts
|
bodyBuilder
|
内容展示(自定义builder渲染)
|
@Builder bodyBuilder() {
Column({ space: 10 }) {
// 自定义颜色
Text('颜色自定义')
.fontSize(14)
.margin({ top:20, bottom: 12})
LoadingProgress()
.height(50)
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(50)
.color(Color.Green)
LoadingProgress()
.height(50)
.color(Color.Red)
// 分割线
Divider()
.color('#CCCCCC')
.dividerStyle()
// 大小自定义
Text('大小自定义')
.fontSize(14)
.margin({ bottom: 12})
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(75)
.color(Color.Blue)
LoadingProgress()
.height(100)
.color(Color.Blue)
}
.pageStyle() //自定义样式:page
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 10 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // 自定义颜色 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '颜色自定义' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 分割线 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left '#CCCCCC' AST#expression#Right ) AST#modifier_chain_expression#Left . dividerStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 大小自定义 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '大小自定义' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 75 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . pageStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //自定义样式:page } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder bodyBuilder() {
Column({ space: 10 }) {
Text('颜色自定义')
.fontSize(14)
.margin({ top:20, bottom: 12})
LoadingProgress()
.height(50)
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(50)
.color(Color.Green)
LoadingProgress()
.height(50)
.color(Color.Red)
Divider()
.color('#CCCCCC')
.dividerStyle()
Text('大小自定义')
.fontSize(14)
.margin({ bottom: 12})
LoadingProgress()
.height(50)
.color(Color.Blue)
LoadingProgress()
.height(75)
.color(Color.Blue)
LoadingProgress()
.height(100)
.color(Color.Blue)
}
.pageStyle()
}
|
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Loading.ets#L41-L80
|
eaa1f4db1213039954e4a9926a671e1ce3a94186
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/utils/strings/StringDealUtility.ets
|
arkts
|
deal
|
/ 按指定的分隔符和子分隔符进行 split 之后,对每一段子字符进行 transform
|
private static deal(
srcStr : string,
seperator : string,
subSeperator : string,
transform : DealTransform
): string | null {
const array : Array<string> = srcStr.split(seperator);
const distList: Array<string> = [];
for (const subStr of array) {
const subArray : Array<string> = subStr.split(subSeperator);
const distSubList : Array<string> = [];
for (const str of subArray) {
const tranStr = transform.transform(str);
if (tranStr !== null) {
distSubList.push(tranStr);
}
}
if (distSubList.length > 0) {
distList.push(
StringDealUtility.getJoinedTextsFromList(distSubList, subSeperator) as string
);
}
}
return StringDealUtility.getJoinedTextsFromList(distList, seperator);
}
|
AST#method_declaration#Left private static deal AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left seperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left subSeperator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left transform : AST#type_annotation#Left AST#primary_type#Left DealTransform AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left array : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left srcStr AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left seperator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left distList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const subStr of AST#expression#Left array AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left subArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left subStr AST#expression#Right . split AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left subSeperator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left distSubList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const str of AST#expression#Left subArray AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tranStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left transform AST#expression#Right . transform AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left tranStr AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distSubList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tranStr AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distSubList AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left distList AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringDealUtility AST#expression#Right . getJoinedTextsFromList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left distSubList AST#expression#Right , AST#expression#Left subSeperator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringDealUtility AST#expression#Right . getJoinedTextsFromList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left distList AST#expression#Right , AST#expression#Left seperator AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private static deal(
srcStr : string,
seperator : string,
subSeperator : string,
transform : DealTransform
): string | null {
const array : Array<string> = srcStr.split(seperator);
const distList: Array<string> = [];
for (const subStr of array) {
const subArray : Array<string> = subStr.split(subSeperator);
const distSubList : Array<string> = [];
for (const str of subArray) {
const tranStr = transform.transform(str);
if (tranStr !== null) {
distSubList.push(tranStr);
}
}
if (distSubList.length > 0) {
distList.push(
StringDealUtility.getJoinedTextsFromList(distSubList, subSeperator) as string
);
}
}
return StringDealUtility.getJoinedTextsFromList(distList, seperator);
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L119-L148
|
863818473e2aaab7feb1ae7c0245ca0f87ea0868
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets
|
arkts
|
computeTask
|
[Start city_list_page]
|
@Concurrent
function computeTask(): string[] {
let array: string[] = []
// AppConstant.CITYS is the data to be loaded.
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a, b))
return array;
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function computeTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left array : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right // AppConstant.CITYS is the data to be loaded. AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let t of AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstant AST#expression#Right . CITYS AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left array AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left t AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left collator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Intl AST#expression#Right AST#new_expression#Right AST#expression#Right . Collator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "zh-CN" AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left localeMatcher AST#property_name#Right : AST#expression#Left "lookup" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left usage AST#property_name#Right : AST#expression#Left "sort" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left array AST#expression#Right . sort AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left a AST#parameter#Right , AST#parameter#Left b AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left collator AST#expression#Right . compare AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left a AST#expression#Right , AST#expression#Left b AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left array AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#decorated_function_declaration#Right
|
@Concurrent
function computeTask(): string[] {
let array: string[] = []
for (let t of AppConstant.CITYS) {
array.push(t.trim())
}
let collator = new Intl.Collator("zh-CN", { localeMatcher: "lookup", usage: "sort" });
array.sort((a, b) => collator.compare(a, b))
return array;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/CityListPage.ets#L28-L38
|
d0b62e916b95130019c4d827cb72a7f3be6e8da6
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets
|
arkts
|
CategoryTitle
|
分类标题
|
@Builder
CategoryTitle(title: string) {
Row() {
Divider()
.strokeWidth(2)
.color(AppColors.primary)
.width(4)
.vertical(false)
Text(title)
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.textPrimary)
.margin({ left: AppDimensions.spaceSmall })
}
.width('100%')
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CategoryTitle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Left . vertical ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontSizeLarge AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppTypography AST#expression#Right . fontWeightMedium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppColors AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AppDimensions AST#expression#Right . spaceSmall AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
CategoryTitle(title: string) {
Row() {
Divider()
.strokeWidth(2)
.color(AppColors.primary)
.width(4)
.vertical(false)
Text(title)
.fontSize(AppTypography.fontSizeLarge)
.fontWeight(AppTypography.fontWeightMedium)
.fontColor(AppColors.textPrimary)
.margin({ left: AppDimensions.spaceSmall })
}
.width('100%')
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CategoryPage.ets#L123-L139
|
7bb83e1984b30789379cc86a95c94e7e6f38b000
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets
|
arkts
|
窗口的创建,加载,显示,销毁操作
|
export class SubWindowApi {
private maskColor: string = ''; // 初始化蒙层颜色
private subWindow: window.Window | null = null; // 初始化window实例
private Storage: LocalStorage = new LocalStorage(); // 创建页面级UI状态存储对象
// eventId为1234565的持续订阅的事件
private callbackEvent: emitter.InnerEvent = {
eventId: EVENT_ID
}
// 显示当前窗口
private showSubWindow() {
if (this.subWindow) {
this.subWindow.showWindow((err: BusinessError) => {
if (err.code) {
console.error('Fail to show window, Cause: ' + JSON.stringify(err));
}
})
}
}
// 为当前WindowStage加载命名路由页面
private loadContent(path: string) {
if (this.subWindow) {
// TODO: 知识点: 用loadContentByName为当前窗口加载命名路由页面,通过LocalStorage传递状态属性给加载的页面
this.subWindow.loadContentByName(path, this.Storage, (err: BusinessError) => {
if (this.subWindow) {
try {
this.subWindow.setWindowBackgroundColor(this.maskColor);
} catch (exception) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
};
}
if (err.code) {
console.error("Failed to load the content. Cause:" + JSON.stringify(err));
return;
}
});
}
}
// 销毁当前窗口
private destroySubWindow() {
if (this.subWindow) {
this.subWindow.destroyWindow((err) => {
if (err.code) {
console.error('Fail to destroy the window. Cause:' + JSON.stringify(err));
return;
}
this.subWindow = null;
});
}
}
// 创建子窗口
private createSubWindow(windowStage: window.WindowStage | null) {
try {
if (!windowStage) {
return;
}
windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => {
if (err.code) {
console.error("Failed to create the subwindow, Cause: " + JSON.stringify(err));
return;
}
this.subWindow = (data as window.Window);
if (this.subWindow) {
// 设置子窗口蒙层颜色
this.initColor();
// 设置子窗口可触
this.subWindow.setWindowTouchable(true);
// 设置窗口UI
this.loadContent(entryName);
// 展示子窗口
this.showSubWindow();
}
});
} catch (exception) {
console.error("Failed to create the window, Cause: " + JSON.stringify(exception));
}
}
/**
* 设置子窗口蒙层颜色
*/
initColor() {
try {
// 获取指定resource对象对应的字符串
this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id);
console.log("getStringSync: " + this.maskColor)
} catch (err) {
console.error(`getStringSync failed, code is ${err.code}, message is ${err.message}`);
}
}
/**
* 订阅eventId为1234565的事件
*/
subscribeCallback(): void {
emitter.on(this.callbackEvent, () => {
this.hideSubWindow();
})
}
/**
* 取消针对eventId为1234565的事件的订阅
*/
offCallback(): void {
emitter.off(this.callbackEvent.eventId);
}
/**
* 更新key为'content'的变量值
* @param { SubWindowParams } params - 页面显示的值
*/
updateOrCreateParams(params: SubWindowParams): void {
this.Storage.setOrCreate("content", params.sum);
}
/**
* 创建并展示弹窗
* @param { SubWindowParams } params - 页面显示的值
* @param { Handler } handler - WindowStage对象
*/
initSubWindow(handler: Handler, params: SubWindowParams): void {
const windowStage = handler.windowStage;
// 注册回调
this.subscribeCallback();
// 初始化参数
this.updateOrCreateParams(params);
// 新建子窗口
this.createSubWindow(windowStage);
}
/**
* 隐藏弹窗
*/
hideSubWindow(): void {
// 注销监听事件
this.offCallback();
// 关闭弹窗
this.destroySubWindow();
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class SubWindowApi AST#class_body#Left { AST#property_declaration#Left private maskColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right // 初始化蒙层颜色 AST#property_declaration#Left private subWindow : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 初始化window实例 AST#property_declaration#Left private Storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LocalStorage AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 创建页面级UI状态存储对象 // eventId为1234565的持续订阅的事件 AST#property_declaration#Left private callbackEvent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left emitter . InnerEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left eventId AST#property_name#Right : AST#expression#Left EVENT_ID AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right // 显示当前窗口 AST#property_declaration#Right AST#method_declaration#Left private showSubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . showWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Fail to show window, Cause: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right // 为当前WindowStage加载命名路由页面 AST#method_declaration#Left private loadContent AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ) { // TODO: 知识点: 用loadContentByName为当前窗口加载命名路由页面,通过LocalStorage传递状态属性给加载的页面 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . loadContentByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Storage AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . setWindowBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskColor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Failed to set the background color. Cause: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#ERROR#Left ; AST#ERROR#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "Failed to load the content. Cause:" AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right // 销毁当前窗口 AST#method_declaration#Left private destroySubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . destroyWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Fail to destroy the window. Cause:' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right // 创建子窗口 AST#method_declaration#Left private createSubWindow AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left windowStage AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . createSubWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'mySubWindow' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "Failed to create the subwindow, Cause: " AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left data AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 设置子窗口蒙层颜色 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置子窗口可触 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subWindow AST#member_expression#Right AST#expression#Right . setWindowTouchable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置窗口UI AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left entryName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 展示子窗口 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showSubWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "Failed to create the window, Cause: " AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 设置子窗口蒙层颜色
*/ AST#method_declaration#Left initColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 获取指定resource对象对应的字符串 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maskColor AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.custom_dialog_mask_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "getStringSync: " AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . maskColor AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getStringSync failed, code is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 订阅eventId为1234565的事件
*/ AST#method_declaration#Left subscribeCallback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left emitter AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callbackEvent AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hideSubWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 取消针对eventId为1234565的事件的订阅
*/ AST#method_declaration#Left offCallback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left emitter AST#expression#Right . off AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . callbackEvent AST#member_expression#Right AST#expression#Right . eventId AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 更新key为'content'的变量值
* @param { SubWindowParams } params - 页面显示的值
*/ AST#method_declaration#Left updateOrCreateParams AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left SubWindowParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Storage AST#member_expression#Right AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "content" AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . sum AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 创建并展示弹窗
* @param { SubWindowParams } params - 页面显示的值
* @param { Handler } handler - WindowStage对象
*/ AST#method_declaration#Left initSubWindow AST#parameter_list#Left ( AST#parameter#Left handler : AST#type_annotation#Left AST#primary_type#Left Handler AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left SubWindowParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left windowStage = AST#expression#Left AST#member_expression#Left AST#expression#Left handler AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 注册回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subscribeCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 初始化参数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateOrCreateParams AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 新建子窗口 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createSubWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left windowStage AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 隐藏弹窗
*/ AST#method_declaration#Left hideSubWindow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 注销监听事件 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . offCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 关闭弹窗 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . destroySubWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class SubWindowApi {
private maskColor: string = '';
private subWindow: window.Window | null = null;
private Storage: LocalStorage = new LocalStorage();
private callbackEvent: emitter.InnerEvent = {
eventId: EVENT_ID
}
private showSubWindow() {
if (this.subWindow) {
this.subWindow.showWindow((err: BusinessError) => {
if (err.code) {
console.error('Fail to show window, Cause: ' + JSON.stringify(err));
}
})
}
}
private loadContent(path: string) {
if (this.subWindow) {
this.subWindow.loadContentByName(path, this.Storage, (err: BusinessError) => {
if (this.subWindow) {
try {
this.subWindow.setWindowBackgroundColor(this.maskColor);
} catch (exception) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
};
}
if (err.code) {
console.error("Failed to load the content. Cause:" + JSON.stringify(err));
return;
}
});
}
}
private destroySubWindow() {
if (this.subWindow) {
this.subWindow.destroyWindow((err) => {
if (err.code) {
console.error('Fail to destroy the window. Cause:' + JSON.stringify(err));
return;
}
this.subWindow = null;
});
}
}
private createSubWindow(windowStage: window.WindowStage | null) {
try {
if (!windowStage) {
return;
}
windowStage.createSubWindow('mySubWindow', (err: BusinessError, data) => {
if (err.code) {
console.error("Failed to create the subwindow, Cause: " + JSON.stringify(err));
return;
}
this.subWindow = (data as window.Window);
if (this.subWindow) {
this.initColor();
this.subWindow.setWindowTouchable(true);
this.loadContent(entryName);
this.showSubWindow();
}
});
} catch (exception) {
console.error("Failed to create the window, Cause: " + JSON.stringify(exception));
}
}
initColor() {
try {
this.maskColor = context.resourceManager.getStringSync($r('app.string.custom_dialog_mask_color').id);
console.log("getStringSync: " + this.maskColor)
} catch (err) {
console.error(`getStringSync failed, code is ${err.code}, message is ${err.message}`);
}
}
subscribeCallback(): void {
emitter.on(this.callbackEvent, () => {
this.hideSubWindow();
})
}
offCallback(): void {
emitter.off(this.callbackEvent.eventId);
}
updateOrCreateParams(params: SubWindowParams): void {
this.Storage.setOrCreate("content", params.sum);
}
initSubWindow(handler: Handler, params: SubWindowParams): void {
const windowStage = handler.windowStage;
this.subscribeCallback();
this.updateOrCreateParams(params);
this.createSubWindow(windowStage);
}
hideSubWindow(): void {
this.offCallback();
this.destroySubWindow();
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/src/main/ets/components/SubWindowApi.ets#L38-L180
|
f4fd1e31f2c1e52ec717ef9179b42a552cbd63a0
|
gitee
|
|
dcm23333/FishManager.git
|
952dde4475268ac16f3480f3d55f82033aa6b467
|
FishManager/entry/src/main/ets/common/contants/commonContants.ets
|
arkts
|
‘1.5%’
|
export const THOUSANDTH_12: string = '2.2%';
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left THOUSANDTH_12 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '2.2%' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const THOUSANDTH_12: string = '2.2%';
|
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L47-L47
|
31893246fb8f65a21c2626f6460af70c5f9d28a9
|
github
|
|
EL233/WeChat-HarmonyOS.git
|
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
|
entry/src/main/ets/view/component/Dialog.ets
|
arkts
|
closeDialog
|
关闭自定义对话框
|
closeDialog() {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.closeCustomDialog(this.contentNode)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'CloseCustomDialog complete'); // 记录日志,对话框关闭完成
})
.catch((error: BusinessError) => {
let message = (error as BusinessError).message; // 获取错误消息
let code = (error as BusinessError).code; // 获取错误代码
hilog.error(0xFF00, 'PersonalInformation', '%{public}s',
`CloseCustomDialog args error code is ${code}, message is ${message}`); // 记录错误日志
});
}
}
|
AST#method_declaration#Left closeDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentNode AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . contentNode AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right ?. getPromptAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . closeCustomDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentNode AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left 'PersonalInformation' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'CloseCustomDialog complete' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 记录日志,对话框关闭完成 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取错误消息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left code = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取错误代码 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left 'PersonalInformation' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` CloseCustomDialog args error code is AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right , message is AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 记录错误日志 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
closeDialog() {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.closeCustomDialog(this.contentNode)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'CloseCustomDialog complete');
})
.catch((error: BusinessError) => {
let message = (error as BusinessError).message;
let code = (error as BusinessError).code;
hilog.error(0xFF00, 'PersonalInformation', '%{public}s',
`CloseCustomDialog args error code is ${code}, message is ${message}`);
});
}
}
|
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L48-L62
|
d7ac29fdc84835d28f6b9f41fade7a3239c277c5
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/library_function/string_lib_func_018_F.ets
|
arkts
|
Introduction 库函数-string_toUpperCase
|
export function string_lib_func_018_F(taint_src : string) {
let clean = "clean";
let t = clean.toUpperCase();
taint.Sink(t);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_018_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left clean = AST#expression#Left "clean" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left t = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left clean AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function string_lib_func_018_F(taint_src : string) {
let clean = "clean";
let t = clean.toUpperCase();
taint.Sink(t);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_018_F.ets#L7-L11
|
9041a539d56ae95404c4b06ecfc038ca0ee1f9fc
|
github
|
|
openharmony-tpc/ImageKnife
|
bc55de9e2edd79ed4646ce37177ad94b432874f7
|
library/src/main/ets/cache/MemoryLruCache.ets
|
arkts
|
trimToSize
|
移除较少使用的缓存数据
|
trimToSize(): void {
while (true) {
if (this.currentMemory <= this.maxMemory || this.lruCache.isEmpty()) {
break
}
let delkey = this.lruCache.keys()[0]
let data: ImageKnifeData | undefined = this.lruCache.get(delkey)
if (data != undefined) {
this.removeMemorySize(data)
}
this.lruCache.remove(delkey)
}
}
|
AST#method_declaration#Left trimToSize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMemory AST#member_expression#Right AST#expression#Right <= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxMemory AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#ERROR#Left break AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left delkey = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ImageKnifeData AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left delkey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . removeMemorySize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lruCache AST#member_expression#Right AST#expression#Right . remove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left delkey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
trimToSize(): void {
while (true) {
if (this.currentMemory <= this.maxMemory || this.lruCache.isEmpty()) {
break
}
let delkey = this.lruCache.keys()[0]
let data: ImageKnifeData | undefined = this.lruCache.get(delkey)
if (data != undefined) {
this.removeMemorySize(data)
}
this.lruCache.remove(delkey)
}
}
|
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/cache/MemoryLruCache.ets#L93-L105
|
3fd28f709bb5a6bf34d9363d49cf44592757185f
|
gitee
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.arkui.advanced.DownloadFileButton.d.ets
|
arkts
|
Defines the DownloadFileButton style option.
@interface DownloadStyleOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12
|
export interface DownloadStyleOptions {
/**
* Icon size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconSize?: Dimension;
/**
* Layout direction.
*
* @type { ?DownloadLayoutDirection }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
layoutDirection?: DownloadLayoutDirection;
/**
* Font size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontSize?: Dimension;
/**
* Font Style.
*
* @type { ?FontStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontStyle?: FontStyle;
/**
* Font weight.
*
* @type { ?(number | FontWeight | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontWeight?: number | FontWeight | string;
/**
* Font family.
*
* @type { ?(string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontFamily?: string | Resource;
/**
* Font color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
fontColor?: ResourceColor;
/**
* Icon color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
iconColor?: ResourceColor;
/**
* Text and Icon space.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
textIconSpace?: Dimension;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface DownloadStyleOptions AST#object_type#Left { /**
* Icon size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left iconSize ? : AST#type_annotation#Left AST#primary_type#Left Dimension AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Layout direction.
*
* @type { ?DownloadLayoutDirection }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left layoutDirection ? : AST#type_annotation#Left AST#primary_type#Left DownloadLayoutDirection AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Font size.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left fontSize ? : AST#type_annotation#Left AST#primary_type#Left Dimension AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Font Style.
*
* @type { ?FontStyle }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left fontStyle ? : AST#type_annotation#Left AST#primary_type#Left FontStyle AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Font weight.
*
* @type { ?(number | FontWeight | string) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left fontWeight ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left FontWeight AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Font family.
*
* @type { ?(string | Resource) }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left fontFamily ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Font color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Icon color.
*
* @type { ?ResourceColor }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left iconColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /**
* Text and Icon space.
*
* @type { ?Dimension }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_member#Left textIconSpace ? : AST#type_annotation#Left AST#primary_type#Left Dimension AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface DownloadStyleOptions {
iconSize?: Dimension;
layoutDirection?: DownloadLayoutDirection;
fontSize?: Dimension;
fontStyle?: FontStyle;
fontWeight?: number | FontWeight | string;
fontFamily?: string | Resource;
fontColor?: ResourceColor;
iconColor?: ResourceColor;
textIconSpace?: Dimension;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L218-L318
|
a9b040bf0a7313331266973593013eef5c11755f
|
gitee
|
|
Jasmine709/HarmonyOS-News-App.git
|
e0388ad8a55ffcc001cf026113d2fd0fae842594
|
entry/src/main/ets/views/NewsItem.ets
|
arkts
|
NewsItem
|
不是完整的页面,是一个页面碎片
|
@Preview
@Component
export struct NewsItem {
@State typeArr: string[] = ['新闻', '购物', '体育']
news: News = new News()
build() {
Column() {
Row() {
Text(this.typeArr[this.news.type])
.fontColor($r('app.color.blue'))
.borderWidth(1)
.borderColor($r('app.color.blue'))
.padding({top:2, bottom:2, left:10, right:10})
.borderRadius(4)
Text(this.news.title)
.fontWeight(FontWeight.Bold)
.fontSize(21)//新闻标题
.margin({left:10})
}.width('100%')
.margin({top:15})
Text(this.news.content)
.alignSelf(ItemAlign.Start)//在侧轴的某个位置
.margin({top:10, bottom:10})
.fontSize(20)
Row() {
if (this.news.image) {
Image(Http.host + this.news.image)
.width(this.news.photo?'48%':'50%')
.height(this.news.photo?120:150)
.borderRadius(10)
}
if (this.news.photo) {
Image(Http.host + this.news.photo)
.width('48%')
.height(120)
.borderRadius(10)
}
}.width('100%')
.justifyContent(FlexAlign.SpaceEvenly)
// .margin({ left:10 , right:10 })
Text(this.news.price?this.news.price+'元':this.news.ctime)
.alignSelf(ItemAlign.Start)
.fontColor(Color.Gray)
.margin({left:10,bottom:15,top:10})
}.width('100%')
.borderWidth({bottom:1})
.borderColor('#ddd') //浅灰色
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct NewsItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right typeArr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left '新闻' AST#expression#Right , AST#expression#Left '购物' AST#expression#Right , AST#expression#Left '体育' AST#expression#Right ] AST#array_literal#Right AST#expression#Right news : AST#type_annotation#Left AST#primary_type#Left News AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left News AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . typeArr AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.blue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.blue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 4 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 21 AST#expression#Right ) //新闻标题 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) //在侧轴的某个位置 AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . host AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . news AST#member_expression#Right AST#expression#Right . image AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . photo AST#member_expression#Right AST#expression#Right ? AST#expression#Left '48%' AST#expression#Right : AST#expression#Left '50%' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . photo AST#member_expression#Right AST#expression#Right ? AST#expression#Left 120 AST#expression#Right : AST#expression#Left 150 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . photo AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . host AST#member_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . news AST#member_expression#Right AST#expression#Right . photo AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '48%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 120 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // .margin({ left:10 , right:10 }) AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . news AST#member_expression#Right AST#expression#Right . price AST#member_expression#Right AST#expression#Right + AST#expression#Left '元' AST#expression#Right AST#binary_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . news AST#member_expression#Right AST#expression#Right . ctime AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . alignSelf ( AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Gray AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left '#ddd' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right //浅灰色 } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Preview
@Component
export struct NewsItem {
@State typeArr: string[] = ['新闻', '购物', '体育']
news: News = new News()
build() {
Column() {
Row() {
Text(this.typeArr[this.news.type])
.fontColor($r('app.color.blue'))
.borderWidth(1)
.borderColor($r('app.color.blue'))
.padding({top:2, bottom:2, left:10, right:10})
.borderRadius(4)
Text(this.news.title)
.fontWeight(FontWeight.Bold)
.fontSize(21)
.margin({left:10})
}.width('100%')
.margin({top:15})
Text(this.news.content)
.alignSelf(ItemAlign.Start)
.margin({top:10, bottom:10})
.fontSize(20)
Row() {
if (this.news.image) {
Image(Http.host + this.news.image)
.width(this.news.photo?'48%':'50%')
.height(this.news.photo?120:150)
.borderRadius(10)
}
if (this.news.photo) {
Image(Http.host + this.news.photo)
.width('48%')
.height(120)
.borderRadius(10)
}
}.width('100%')
.justifyContent(FlexAlign.SpaceEvenly)
Text(this.news.price?this.news.price+'元':this.news.ctime)
.alignSelf(ItemAlign.Start)
.fontColor(Color.Gray)
.margin({left:10,bottom:15,top:10})
}.width('100%')
.borderWidth({bottom:1})
.borderColor('#ddd')
}
}
|
https://github.com/Jasmine709/HarmonyOS-News-App.git/blob/e0388ad8a55ffcc001cf026113d2fd0fae842594/entry/src/main/ets/views/NewsItem.ets#L5-L55
|
7496380034a2a7a947da55e3f5873f02beeddebb
|
github
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
|
arkts
|
fps
|
帧率设置
|
public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
}
|
AST#method_declaration#Left public fps AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` fps= AST#template_substitution#Left $ { AST#expression#Left value AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public fps(value: number): FFmpegCommandBuilder {
return this.filter(`fps=${value}`);
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L140-L142
|
bb40642e20799e8170601bae371244941d927e50
|
github
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/viewmodel/MainViewModel.ets
|
arkts
|
refreshData
|
Refresh all data from database
|
async refreshData(): Promise<void> {
try {
console.info(`[MainViewModel] ========== 开始刷新数据 ==========`);
// Load all tasks (not just today's) and recent memos
const tasks = await this.rdbHelper.getTasks();
const memos = await this.rdbHelper.getRecentMemos(10);
console.info(`[MainViewModel] 从数据库加载了 ${tasks.length} 个任务`);
if (tasks.length > 0) {
console.info(`[MainViewModel] 任务列表详情:`);
tasks.forEach((task, index) => {
console.info(`[MainViewModel] 任务${index + 1}: ${task.title}`);
console.info(`[MainViewModel] - ID: ${task.id}`);
console.info(`[MainViewModel] - dueTime: ${new Date(task.dueTime).toLocaleString()}`);
console.info(`[MainViewModel] - createdAt: ${new Date(task.createdAt).toLocaleString()}`);
console.info(`[MainViewModel] - isDone: ${task.isDone}`);
});
} else {
console.warn(`[MainViewModel] ⚠️ 数据库中没有任务!`);
}
console.info(`[MainViewModel] 从数据库加载了 ${memos.length} 个备忘录`);
this.tasks = tasks;
this.memos = memos;
console.info(`[MainViewModel] ✅ 数据刷新完成: ${tasks.length} 个任务, ${memos.length} 个备忘录`);
console.info(`[MainViewModel] ========== 数据刷新结束 ==========`);
// 触发UI刷新回调
setTimeout(() => {
if (this.uiRefreshCallback) {
this.uiRefreshCallback();
}
}, 0);
} catch (error) {
console.error(`[MainViewModel] ❌ 刷新数据失败: ${JSON.stringify(error)}`);
}
}
|
AST#method_declaration#Left async refreshData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] ========== 开始刷新数据 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Load all tasks (not just today's) and recent memos AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left tasks = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbHelper AST#member_expression#Right AST#expression#Right . getTasks AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left memos = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbHelper AST#member_expression#Right AST#expression#Right . getRecentMemos AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] 从数据库加载了 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个任务 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] 任务列表详情: ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . forEach AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left task AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] 任务 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right : AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] - ID: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] - dueTime: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . dueTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] - createdAt: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] - isDone: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . isDone AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] ⚠️ 数据库中没有任务! ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] 从数据库加载了 AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left memos AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个备忘录 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right = AST#expression#Left tasks AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . memos AST#member_expression#Right = AST#expression#Left memos AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] ✅ 数据刷新完成: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left tasks AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个任务, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left memos AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 个备忘录 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] ========== 数据刷新结束 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 触发UI刷新回调 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiRefreshCallback AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uiRefreshCallback AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [MainViewModel] ❌ 刷新数据失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async refreshData(): Promise<void> {
try {
console.info(`[MainViewModel] ========== 开始刷新数据 ==========`);
const tasks = await this.rdbHelper.getTasks();
const memos = await this.rdbHelper.getRecentMemos(10);
console.info(`[MainViewModel] 从数据库加载了 ${tasks.length} 个任务`);
if (tasks.length > 0) {
console.info(`[MainViewModel] 任务列表详情:`);
tasks.forEach((task, index) => {
console.info(`[MainViewModel] 任务${index + 1}: ${task.title}`);
console.info(`[MainViewModel] - ID: ${task.id}`);
console.info(`[MainViewModel] - dueTime: ${new Date(task.dueTime).toLocaleString()}`);
console.info(`[MainViewModel] - createdAt: ${new Date(task.createdAt).toLocaleString()}`);
console.info(`[MainViewModel] - isDone: ${task.isDone}`);
});
} else {
console.warn(`[MainViewModel] ⚠️ 数据库中没有任务!`);
}
console.info(`[MainViewModel] 从数据库加载了 ${memos.length} 个备忘录`);
this.tasks = tasks;
this.memos = memos;
console.info(`[MainViewModel] ✅ 数据刷新完成: ${tasks.length} 个任务, ${memos.length} 个备忘录`);
console.info(`[MainViewModel] ========== 数据刷新结束 ==========`);
setTimeout(() => {
if (this.uiRefreshCallback) {
this.uiRefreshCallback();
}
}, 0);
} catch (error) {
console.error(`[MainViewModel] ❌ 刷新数据失败: ${JSON.stringify(error)}`);
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L136-L174
|
255f3cd1076f1b35fcfac40224d0ac4a34771385
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/LongPressGesture.ets
|
arkts
|
LongPress
|
[Start catch_long_press_event]
|
@Entry
@Component
export struct LongPress {
@State count: number = 0;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Text('LongPress OnAction:' + this.count).fontSize(28)
.gesture(
// 绑定可以重复触发的LongPressGesture
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent | undefined) => {
if (event) {
if (event.repeat) {
this.count++;
}
}
})
.onActionEnd(() => {
this.count = 0;
})
)
}
.height(200)
.width(250)
.padding(20)
.border({ width: 3 })
.margin(30)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.singlegesture_LongPressGesture_title'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct LongPress AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'LongPress OnAction:' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( // 绑定可以重复触发的LongPressGesture AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left LongPressGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left repeat AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left GestureEvent AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left event AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . repeat AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 200 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 250 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left 30 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.singlegesture_LongPressGesture_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Entry
@Component
export struct LongPress {
@State count: number = 0;
build() {
NavDestination() {
Column({ space: 12 }) {
Column() {
Text('LongPress OnAction:' + this.count).fontSize(28)
.gesture(
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent | undefined) => {
if (event) {
if (event.repeat) {
this.count++;
}
}
})
.onActionEnd(() => {
this.count = 0;
})
)
}
.height(200)
.width(250)
.padding(20)
.border({ width: 3 })
.margin(30)
}
.width('100%')
.height('100%')
.padding({ left: 12, right: 12 })
}
.backgroundColor('#f1f2f3')
.title($r('app.string.singlegesture_LongPressGesture_title'))
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/singlegesture/LongPressGesture.ets#L17-L55
|
c847c6955be6ff39829249a0b3c6b2a0cb34182b
|
gitee
|
mhtcgr/ToDoList_For_Harmony.git
|
356d4c9a507205f02870e970203022a380c8a2a1
|
entry/src/main/ets/pages/Profile.ets
|
arkts
|
addIntroduction
|
用户输入的自我介绍 添加自我介绍到列表中
|
addIntroduction() {
if (this.introText.trim()) { // 确保输入不为空
this.profileInfo.push(this.introText.trim()); // 将输入内容添加到 profileInfo 列表
this.introText = ""; // 清空输入框
this.showIntroInput = false; // 隐藏输入框
}
}
|
AST#method_declaration#Left addIntroduction AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . introText AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { // 确保输入不为空 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . profileInfo AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . introText AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 将输入内容添加到 profileInfo 列表 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . introText AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 清空输入框 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showIntroInput AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 隐藏输入框 } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
addIntroduction() {
if (this.introText.trim()) {
this.profileInfo.push(this.introText.trim());
this.introText = "";
this.showIntroInput = false;
}
}
|
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/pages/Profile.ets#L11-L17
|
636d782ecc6d90d32aebac7a96dc821777fc4cf7
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
|
arkts
|
initCreateMode
|
初始化新增模式数据
@returns {void} 无返回值
|
private initCreateMode(): void {
this.updateFormData(new Address());
this.setSuccessState();
}
|
AST#method_declaration#Left private initCreateMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateFormData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Address AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setSuccessState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private initCreateMode(): void {
this.updateFormData(new Address());
this.setSuccessState();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L286-L289
|
ead88d8ef5e89e034a87a28d5cd0890e169aecdc
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
|
arkts
|
decodePKCS1
|
解密
@param decodeStr 待解密的字符串
@param priKey RSA私钥
|
static async decodePKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
}
|
AST#method_declaration#Left static async decodePKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . decodeAsym AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left priKey AST#expression#Right , AST#expression#Left 'RSA1024' AST#expression#Right , AST#expression#Left 'RSA1024|PKCS1' AST#expression#Right , AST#expression#Left 1024 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async decodePKCS1(str: string, priKey: string): Promise<string> {
return CryptoUtil.decodeAsym(str, priKey, 'RSA1024', 'RSA1024|PKCS1', 1024);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L87-L89
|
dec690136ca63ca64dea40ec82d97a1b40e78170
|
gitee
|
openharmony/arkui_ace_engine
|
30c7d1ee12fbedf0fabece54291d75897e2ad44f
|
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
|
arkts
|
DeleteProp
|
Called when a property is deleted.
@since 7
@deprecated since 10
|
static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
}
|
AST#method_declaration#Left static DeleteProp AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PersistentStorage AST#expression#Right . deleteProp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
static DeleteProp(key: string): void {
PersistentStorage.deleteProp(key)
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L389-L391
|
1564733667cbcbaad5202b548554935bd5ab7e34
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/ResUtil.ets
|
arkts
|
getBoolean
|
获取指定资源对应的布尔结果
@param resId 资源ID值/资源信息
@returns
|
static getBoolean(resId: number | Resource): boolean {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getBoolean(resId);
} else {
return ResUtil.getResourceManager().getBoolean(resId);
}
}
|
AST#method_declaration#Left static getBoolean AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left resId AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'number' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResUtil AST#expression#Right . getResourceManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getBoolean AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResUtil AST#expression#Right . getResourceManager AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getBoolean AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getBoolean(resId: number | Resource): boolean {
if (typeof resId === 'number') {
return ResUtil.getResourceManager().getBoolean(resId);
} else {
return ResUtil.getResourceManager().getBoolean(resId);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ResUtil.ets#L44-L50
|
f6107b37a4a33a371364469b31969658176ff726
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/Model.ets
|
arkts
|
Copyright (c) 2024 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.
|
export class Model {
id: number;
uri: Resource;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: Resource, title: ResourceStr, content: ResourceStr, views: number, likes: number,
isLike: boolean, collections: number, isCollection: boolean, type: number) {
this.id = id;
this.uri = uri;
this.title = title;
this.content = content;
this.views = views;
this.likes = likes;
this.isLike = isLike;
this.collections = collections;
this.isCollection = isCollection;
this.type = type;
}
toString(): string {
return this.id.toString() + ' ' + this.title;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class Model AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left uri : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left views : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left likes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left isLike : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left collections : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left isCollection : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left views : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left likes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLike : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left collections : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isCollection : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . uri AST#member_expression#Right = AST#expression#Left uri AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . views AST#member_expression#Right = AST#expression#Left views AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . likes AST#member_expression#Right = AST#expression#Left likes AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLike AST#member_expression#Right = AST#expression#Left isLike AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . collections AST#member_expression#Right = AST#expression#Left collections AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCollection AST#member_expression#Right = AST#expression#Left isCollection AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . type AST#member_expression#Right = AST#expression#Left type AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ' ' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class Model {
id: number;
uri: Resource;
title: ResourceStr;
content: ResourceStr;
views: number;
likes: number;
isLike: boolean;
collections: number;
isCollection: boolean;
type: number;
constructor(id: number, uri: Resource, title: ResourceStr, content: ResourceStr, views: number, likes: number,
isLike: boolean, collections: number, isCollection: boolean, type: number) {
this.id = id;
this.uri = uri;
this.title = title;
this.content = content;
this.views = views;
this.likes = likes;
this.isLike = isLike;
this.collections = collections;
this.isCollection = isCollection;
this.type = type;
}
toString(): string {
return this.id.toString() + ' ' + this.title;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/Model.ets#L16-L45
|
65c584eb0cb9b1a11fef36e01ca8b699a9dd13ad
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets
|
arkts
|
returnPromise
|
[Start return_3] Sample6.ets
|
@Concurrent
async function returnPromise() {
let promise = new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 1000);
})
return promise;
}
|
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function returnPromise AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left promise = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 1000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left promise AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#decorated_function_declaration#Right
|
@Concurrent
async function returnPromise() {
let promise = new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, 1000);
})
return promise;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets#L16-L24
|
743cc8e284cc7dd06038dcc454270c0563d111ec
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/managers/StorageManager.ets
|
arkts
|
setItem
|
设置数据
@param key 键
@param value 值
@param config 存储配置
@returns 操作结果
|
static async setItem<T>(key: string, value: T, config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storageName);
if (!prefs) {
throw new Error(`存储实例未找到: ${storageName}`);
}
// 序列化数据
const serializedValue = typeof value === 'string' ? value : JSON.stringify(value);
await prefs.put(key, serializedValue);
await prefs.flush();
this.logDebug(`数据设置成功: ${key}`);
return { success: true };
} catch (error) {
this.logError(`设置数据失败: ${key}`, error);
return { success: false, error: error.message };
}
}
|
AST#method_declaration#Left static async setItem AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config ? : AST#type_annotation#Left AST#primary_type#Left StorageConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left StorageResult AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'StorageManager 未初始化' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left storageName = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right ?. name AST#member_expression#Right AST#expression#Right || AST#expression#Left AppConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . STORAGE_NAME AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left prefs = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left storageName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left prefs AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 存储实例未找到: AST#template_substitution#Left $ { AST#expression#Left storageName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 序列化数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left serializedValue = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left ? AST#ERROR#Left value : AST#ERROR#Left AST#qualified_type#Left JSON . stringify AST#qualified_type#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#primary_type#Left value AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left prefs AST#expression#Right AST#await_expression#Right AST#expression#Right . put AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left serializedValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left prefs AST#expression#Right AST#await_expression#Right AST#expression#Right . flush AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logDebug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 数据设置成功: AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 设置数据失败: AST#template_substitution#Left $ { AST#expression#Left key AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left success AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async setItem<T>(key: string, value: T, config?: StorageConfig): Promise<StorageResult<void>> {
try {
if (!this.isInitialized) {
throw new Error('StorageManager 未初始化');
}
const storageName = config?.name || AppConstants.STORAGE_NAME;
const prefs = this.preferences.get(storageName);
if (!prefs) {
throw new Error(`存储实例未找到: ${storageName}`);
}
const serializedValue = typeof value === 'string' ? value : JSON.stringify(value);
await prefs.put(key, serializedValue);
await prefs.flush();
this.logDebug(`数据设置成功: ${key}`);
return { success: true };
} catch (error) {
this.logError(`设置数据失败: ${key}`, error);
return { success: false, error: error.message };
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L71-L96
|
b696fe2b9041eab459f5c72ea172eec8fdcc9c7d
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/app/views/buttons/TextStyleButton.ets
|
arkts
|
getBackgroundColor
|
========================== 获取背景颜色 ==========================
|
private getBackgroundColor(style: TextStyleButtonStyle): ColorSet {
switch (style) {
case TextStyleButtonStyle.DEFAULT: return { normal: theme.color.clear, selected: theme.color.primary };
case TextStyleButtonStyle.LIGHT: return { normal: theme.color.clear, selected: theme.color.light };
case TextStyleButtonStyle.SOLID: return { normal: theme.color.primary, selected: theme.color.secondary };
case TextStyleButtonStyle.SOLID_ACCENT: return { normal: theme.color.accent, selected: theme.color.accent2 };
case TextStyleButtonStyle.SOLID_OBSCURE: return { normal: theme.color.obscure, selected: theme.color.obscure };
case TextStyleButtonStyle.ACCENT: return { normal: theme.color.clear, selected: theme.color.clear };
default: return { normal: theme.color.clear, selected: theme.color.primary };
}
}
|
AST#method_declaration#Left private getBackgroundColor AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left TextStyleButtonStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ColorSet AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left style AST#expression#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . LIGHT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . light AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . SOLID AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . secondary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . SOLID_ACCENT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . accent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . accent2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . SOLID_OBSCURE AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . obscure AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . obscure AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextStyleButtonStyle AST#expression#Right . ACCENT AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left return AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left normal AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left selected AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left theme AST#expression#Right . color AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private getBackgroundColor(style: TextStyleButtonStyle): ColorSet {
switch (style) {
case TextStyleButtonStyle.DEFAULT: return { normal: theme.color.clear, selected: theme.color.primary };
case TextStyleButtonStyle.LIGHT: return { normal: theme.color.clear, selected: theme.color.light };
case TextStyleButtonStyle.SOLID: return { normal: theme.color.primary, selected: theme.color.secondary };
case TextStyleButtonStyle.SOLID_ACCENT: return { normal: theme.color.accent, selected: theme.color.accent2 };
case TextStyleButtonStyle.SOLID_OBSCURE: return { normal: theme.color.obscure, selected: theme.color.obscure };
case TextStyleButtonStyle.ACCENT: return { normal: theme.color.clear, selected: theme.color.clear };
default: return { normal: theme.color.clear, selected: theme.color.primary };
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/buttons/TextStyleButton.ets#L118-L128
|
c71e68ba977051e4edeafa960f22ec709214ef19
|
github
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/PieDataSet.ets
|
arkts
|
setSliceSpace
|
Sets the space that is left out between the piechart-slices in vp.
Default: 0 --> no space, maximum 20f
@param spaceDp
|
public setSliceSpace(spaceDp: number): void {
if (spaceDp > 20)
spaceDp = 20;
if (spaceDp < 0)
spaceDp = 0;
this.mSliceSpace = Utils.handleDataValues(spaceDp);
}
|
AST#method_declaration#Left public setSliceSpace AST#parameter_list#Left ( AST#parameter#Left spaceDp : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left spaceDp AST#expression#Right > AST#expression#Left 20 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left spaceDp = AST#expression#Left 20 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left spaceDp AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left spaceDp = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSliceSpace AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Utils AST#expression#Right . handleDataValues AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left spaceDp AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public setSliceSpace(spaceDp: number): void {
if (spaceDp > 20)
spaceDp = 20;
if (spaceDp < 0)
spaceDp = 0;
this.mSliceSpace = Utils.handleDataValues(spaceDp);
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L91-L98
|
7160890f243f402267f59c96753196cda36aa9fa
|
gitee
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
example/BasicUsage.ets
|
arkts
|
transcode
|
视频转码
|
transcode(): void {
const cmd = FFmpegFactory.transcode('/input.mp4', '/output.mp4', '2M');
this.run(cmd);
}
|
AST#method_declaration#Left transcode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FFmpegFactory AST#expression#Right . transcode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '/input.mp4' AST#expression#Right , AST#expression#Left '/output.mp4' AST#expression#Right , AST#expression#Left '2M' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . run AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cmd AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
transcode(): void {
const cmd = FFmpegFactory.transcode('/input.mp4', '/output.mp4', '2M');
this.run(cmd);
}
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L55-L58
|
16b761c9b25a864b7bdbcc5f6755c7bb8761f5b0
|
github
|
Application-Security-Automation/Arktan.git
|
3ad9cb05235e38b00cd5828476aa59a345afa1c0
|
dataset/completeness/function_call/arrow_function/arrow_function_002_F.ets
|
arkts
|
Introduction 箭头函数-一阶
|
export function arrow_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let arrowFunction2 = (t : string): void => taint.Sink(t)
arrowFunction2(_clean);
}
|
AST#export_declaration#Left export AST#function_declaration#Left function arrow_function_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _t = AST#expression#Left taint_src AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left _clean = AST#expression#Left "clean" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arrowFunction2 = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left arrowFunction 2 AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left _clean AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function arrow_function_002_F(taint_src : string) {
let _t = taint_src;
let _clean = "clean";
let arrowFunction2 = (t : string): void => taint.Sink(t)
arrowFunction2(_clean);
}
|
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/arrow_function/arrow_function_002_F.ets#L6-L11
|
cac56a0a07d55f25724fd729b362a5d989857342
|
github
|
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
|
arkts
|
getDate
|
获取日期
|
getDate(): number {
return this.date.day;
}
|
AST#method_declaration#Left getDate AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . date AST#member_expression#Right AST#expression#Right . day AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getDate(): number {
return this.date.day;
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L175-L177
|
088e97572800d37f44dcc6a43709d1d125ae0295
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets
|
arkts
|
watchCameraPermission
|
监听相机权限变化
|
watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped) {
clearInterval(qrCodeScanInterval)
}
// 拍照
this.cameraService.takePicture()
}, 4000)
clearInterval(interval)
}
}, 100)
}
|
AST#method_declaration#Left watchCameraPermission AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left interval = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasCameraPermission AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . Get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left QRCodeScanConst AST#expression#Right . HAS_CAMERA_PERMISSION AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasCameraPermission AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left qrCodeScanInterval = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . qrCodeParseResult AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isQRCodeScanStopped AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left qrCodeScanInterval AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 拍照 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cameraService AST#member_expression#Right AST#expression#Right . takePicture AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 4000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left clearInterval AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left interval AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 100 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
watchCameraPermission() {
let interval = setInterval(() => {
this.hasCameraPermission = AppStorage.Get(QRCodeScanConst.HAS_CAMERA_PERMISSION)
if (this.hasCameraPermission) {
let qrCodeScanInterval = setInterval(() => {
if (this.qrCodeParseResult.length > 0 || this.isQRCodeScanStopped) {
clearInterval(qrCodeScanInterval)
}
this.cameraService.takePicture()
}, 4000)
clearInterval(interval)
}
}, 100)
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/components/QRCodeScanComponent.ets#L252-L266
|
0999df1707f95b954b6594c5928a84bed2d708b1
|
gitee
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets
|
arkts
|
buildBodyContent
|
构造上传文件的body内容
|
buildBodyContent(boundary: string, fileName: string, content: Uint8Array, contentType: string = "application/octet-stream") {
let textEncoder = new util.TextEncoder();
//构造文件内容前的部分
let preFileContent = `--${boundary}\r\n`
preFileContent = preFileContent + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
preFileContent = preFileContent + `Content-Type: ${contentType}\r\n`
preFileContent = preFileContent + '\r\n'
let preArray = textEncoder.encodeInto(preFileContent)
//构造文件内容后的部分
let aftFileContent = '\r\n'
aftFileContent = aftFileContent + `--${boundary}`
aftFileContent = aftFileContent + '--\r\n'
let aftArray = textEncoder.encodeInto(aftFileContent)
//文件前后内容和文件内容组合
let bodyBuf = buffer.concat([preArray, content, aftArray])
return bodyBuf.buffer
}
|
AST#method_declaration#Left buildBodyContent AST#parameter_list#Left ( AST#parameter#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contentType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "application/octet-stream" AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textEncoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . TextEncoder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //构造文件内容前的部分 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left preFileContent AST#ERROR#Left = AST#expression#Left AST#template_literal#Left ` -- AST#template_substitution#Left $ { AST#expression#Left boundary AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right preFileContent = AST#expression#Left AST#binary_expression#Left AST#expression#Left preFileContent AST#expression#Right + AST#expression#Left AST#template_literal#Left ` Content-Disposition: form-data; name="file"; filename=" AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right " \r \n ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right preFileContent = AST#expression#Left AST#binary_expression#Left AST#expression#Left preFileContent AST#expression#Right + AST#expression#Left AST#template_literal#Left ` Content-Type: AST#template_substitution#Left $ { AST#expression#Left contentType AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right preFileContent AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left preFileContent AST#expression#Right + AST#expression#Left '\r\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left preArray = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textEncoder AST#expression#Right . encodeInto AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left preFileContent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //构造文件内容后的部分 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aftFileContent AST#ERROR#Left = AST#expression#Left '\r\n' AST#expression#Right aftFileContent = AST#expression#Left AST#binary_expression#Left AST#expression#Left aftFileContent AST#expression#Right + AST#expression#Left AST#template_literal#Left ` -- AST#template_substitution#Left $ { AST#expression#Left boundary AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right aftFileContent AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left aftFileContent AST#expression#Right + AST#expression#Left '--\r\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aftArray = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textEncoder AST#expression#Right . encodeInto AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left aftFileContent AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right //文件前后内容和文件内容组合 AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bodyBuf = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . concat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left preArray AST#expression#Right , AST#expression#Left content AST#expression#Right , AST#expression#Left aftArray AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left bodyBuf AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
buildBodyContent(boundary: string, fileName: string, content: Uint8Array, contentType: string = "application/octet-stream") {
let textEncoder = new util.TextEncoder();
let preFileContent = `--${boundary}\r\n`
preFileContent = preFileContent + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
preFileContent = preFileContent + `Content-Type: ${contentType}\r\n`
preFileContent = preFileContent + '\r\n'
let preArray = textEncoder.encodeInto(preFileContent)
let aftFileContent = '\r\n'
aftFileContent = aftFileContent + `--${boundary}`
aftFileContent = aftFileContent + '--\r\n'
let aftArray = textEncoder.encodeInto(aftFileContent)
let bodyBuf = buffer.concat([preArray, content, aftArray])
return bodyBuf.buffer
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUploadAnyfile/entry/src/main/ets/pages/Index.ets#L131-L150
|
395c690429735c9c44ba8068bbec454db7170d98
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.ets
|
arkts
|
列表中当前的位置
|
constructor() {
this.dataSouce = [];
this.listSize = 0; // 列表的大小
this.pos = 0; // 列表中当前的位置
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSouce AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listSize AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 列表的大小 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pos AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 列表中当前的位置 } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor() {
this.dataSouce = [];
this.listSize = 0;
this.pos = 0;
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.ets#L23-L27
|
e45ae1b9950fca7e3ed5abd52aca8d4fa8944dcc
|
gitee
|
|
JinnyWang-Space/guanlanwenjuan.git
|
601c4aa6c427e643d7bf42bc21945f658738e38c
|
entry/src/main/ets/views/ContentView.ets
|
arkts
|
languageChange
|
监听语言模式变化
|
@Monitor('appGeneralData.language')
languageChange() {
if (this.appGeneralData.language === 'en-Latn-US') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJSON[1];
this.targetChipGroup.push({ label: { text: label } })
})
} else if (this.appGeneralData.language === 'zh-Hans') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJSON[0];
this.targetChipGroup.push({ label: { text: label } })
})
}
}
|
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'appGeneralData.language' AST#expression#Right ) AST#decorator#Right languageChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . language AST#member_expression#Right AST#expression#Right === AST#expression#Left 'en-Latn-US' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetChipGroup AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allChipGroup AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left chip : AST#type_annotation#Left AST#primary_type#Left ChipGroupItemOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left textJSON : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chip AST#expression#Right . label AST#member_expression#Right AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left textJSON AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetChipGroup AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left label AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . appGeneralData AST#member_expression#Right AST#expression#Right . language AST#member_expression#Right AST#expression#Right === AST#expression#Left 'zh-Hans' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetChipGroup AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . allChipGroup AST#member_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left chip : AST#type_annotation#Left AST#primary_type#Left ChipGroupItemOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left textJSON : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left chip AST#expression#Right . label AST#member_expression#Right AST#expression#Right . text AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left textJSON AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetChipGroup AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left label AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left label AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Monitor('appGeneralData.language')
languageChange() {
if (this.appGeneralData.language === 'en-Latn-US') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJSON[1];
this.targetChipGroup.push({ label: { text: label } })
})
} else if (this.appGeneralData.language === 'zh-Hans') {
this.targetChipGroup = [];
this.allChipGroup.map((chip: ChipGroupItemOptions) => {
const textJSON: string[] = JSON.parse(chip.label.text) as string[];
const label: string = textJSON[0];
this.targetChipGroup.push({ label: { text: label } })
})
}
}
|
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L132-L149
|
fc0ff358ccd77a594b52db9d2f52fc3ad4c3162d
|
github
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/common/RdbHelper.ets
|
arkts
|
insertTask
|
==================== TASK OPERATIONS ====================
Insert a new task
@param task - Task object to insert
@returns Row ID of inserted task
|
async insertTask(task: Task): Promise<number> {
if (!this.rdbStore) {
console.error(`[RdbHelper] ❌ insertTask失败:数据库未初始化`);
throw new Error('Database not initialized');
}
try {
console.info(`[RdbHelper] ========== 插入任务到数据库 ==========`);
console.info(`[RdbHelper] 任务详情:`);
console.info(`[RdbHelper] - title: ${task.title}`);
console.info(`[RdbHelper] - due_time: ${task.dueTime} (${new Date(task.dueTime).toLocaleString()})`);
console.info(`[RdbHelper] - is_done: ${task.isDone ? 1 : 0}`);
console.info(`[RdbHelper] - created_at: ${task.createdAt} (${new Date(task.createdAt).toLocaleString()})`);
const valueBucket: relationalStore.ValuesBucket = {
'title': task.title,
'due_time': task.dueTime,
'is_done': task.isDone ? 1 : 0,
'created_at': task.createdAt
};
console.info(`[RdbHelper] 准备执行SQL插入到表: ${Constants.TABLE_TASKS}`);
const rowId = await this.rdbStore.insert(Constants.TABLE_TASKS, valueBucket);
console.info(`[RdbHelper] ✅ SQL插入成功,返回行ID: ${rowId}`);
console.info(`[RdbHelper] ========== 任务插入完成 ==========`);
return rowId;
} catch (error) {
const err = error as BusinessError;
console.error(`[RdbHelper] ❌ 插入任务失败`);
console.error(`[RdbHelper] 错误代码: ${err.code}`);
console.error(`[RdbHelper] 错误消息: ${err.message}`);
console.error(`[RdbHelper] 完整错误: ${JSON.stringify(error)}`);
throw new Error(`Failed to insert task: ${err.message}`);
}
}
|
AST#method_declaration#Left async insertTask AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] ❌ insertTask失败:数据库未初始化 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Database not initialized' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] ========== 插入任务到数据库 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] 任务详情: ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] - title: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] - due_time: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . dueTime AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . dueTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] - is_done: AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . isDone AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] - created_at: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ( AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toLocaleString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ) ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left 'title' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'due_time' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . dueTime AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'is_done' AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . isDone AST#member_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0 AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left 'created_at' AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] 准备执行SQL插入到表: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TABLE_TASKS AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rowId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . rdbStore AST#member_expression#Right AST#expression#Right . insert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . TABLE_TASKS AST#member_expression#Right AST#expression#Right , AST#expression#Left valueBucket AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] ✅ SQL插入成功,返回行ID: AST#template_substitution#Left $ { AST#expression#Left rowId AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] ========== 任务插入完成 ========== ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left rowId AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] ❌ 插入任务失败 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] 错误代码: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] 错误消息: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [RdbHelper] 完整错误: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to insert task: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async insertTask(task: Task): Promise<number> {
if (!this.rdbStore) {
console.error(`[RdbHelper] ❌ insertTask失败:数据库未初始化`);
throw new Error('Database not initialized');
}
try {
console.info(`[RdbHelper] ========== 插入任务到数据库 ==========`);
console.info(`[RdbHelper] 任务详情:`);
console.info(`[RdbHelper] - title: ${task.title}`);
console.info(`[RdbHelper] - due_time: ${task.dueTime} (${new Date(task.dueTime).toLocaleString()})`);
console.info(`[RdbHelper] - is_done: ${task.isDone ? 1 : 0}`);
console.info(`[RdbHelper] - created_at: ${task.createdAt} (${new Date(task.createdAt).toLocaleString()})`);
const valueBucket: relationalStore.ValuesBucket = {
'title': task.title,
'due_time': task.dueTime,
'is_done': task.isDone ? 1 : 0,
'created_at': task.createdAt
};
console.info(`[RdbHelper] 准备执行SQL插入到表: ${Constants.TABLE_TASKS}`);
const rowId = await this.rdbStore.insert(Constants.TABLE_TASKS, valueBucket);
console.info(`[RdbHelper] ✅ SQL插入成功,返回行ID: ${rowId}`);
console.info(`[RdbHelper] ========== 任务插入完成 ==========`);
return rowId;
} catch (error) {
const err = error as BusinessError;
console.error(`[RdbHelper] ❌ 插入任务失败`);
console.error(`[RdbHelper] 错误代码: ${err.code}`);
console.error(`[RdbHelper] 错误消息: ${err.message}`);
console.error(`[RdbHelper] 完整错误: ${JSON.stringify(error)}`);
throw new Error(`Failed to insert task: ${err.message}`);
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L155-L189
|
1112e25e9512aaa95642b81f8cb1e2c7da1e4851
|
github
|
open9527/OpenHarmony
|
fdea69ed722d426bf04e817ec05bff4002e81a4e
|
libs/core/src/main/ets/utils/PreferencesUtils.ets
|
arkts
|
private static preferenceName: string = defaultPreferenceName
|
private constructor() {
}
|
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right
|
private constructor() {
}
|
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L15-L16
|
781ef56ccd5aab90f8e61139f92ca2ef91065e2c
|
gitee
|
|
LiuAnclouds/Harmony-ArkTS-App.git
|
2119ce333927599b81a31081bc913e1416837308
|
WeatherMind/entry/src/main/ets/pages/CityWeather.ets
|
arkts
|
checkColdWarning
|
检查感冒提示
|
private checkColdWarning() {
if (this.weatherData?.life_index?.cold) {
const coldIndex = this.weatherData.life_index.cold;
// 如果感冒指数包含"易发"、"高发"、"较易发"等关键词,显示提示
if (coldIndex.includes('易发') || coldIndex.includes('高发') || coldIndex.includes('较易发') || coldIndex.includes('较易感冒') || coldIndex.includes('易感冒')) {
this.showColdWarning = true;
}
}
}
|
AST#method_declaration#Left private checkColdWarning AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weatherData AST#member_expression#Right AST#expression#Right ?. life_index AST#member_expression#Right AST#expression#Right ?. cold AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left coldIndex = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weatherData AST#member_expression#Right AST#expression#Right . life_index AST#member_expression#Right AST#expression#Right . cold AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 如果感冒指数包含"易发"、"高发"、"较易发"等关键词,显示提示 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left coldIndex AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '易发' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left coldIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '高发' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left coldIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '较易发' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left coldIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '较易感冒' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left coldIndex AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '易感冒' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showColdWarning AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private checkColdWarning() {
if (this.weatherData?.life_index?.cold) {
const coldIndex = this.weatherData.life_index.cold;
if (coldIndex.includes('易发') || coldIndex.includes('高发') || coldIndex.includes('较易发') || coldIndex.includes('较易感冒') || coldIndex.includes('易感冒')) {
this.showColdWarning = true;
}
}
}
|
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/CityWeather.ets#L142-L150
|
ccd659a2a7cb2506a63def51d328463b3250f08d
|
github
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/component/Row.ets
|
arkts
|
渲染布局
@returns {void} 无返回值
@example
RowSpaceEvenlyBottom() { Text("A"); Text("B"); Text("C"); }
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left RowBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right
|
build(): void {
RowBase({
options: this.options,
justifyContent: FlexAlign.SpaceEvenly,
alignItems: VerticalAlign.Bottom,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue,
fillMaxSize: this.fillMaxSize,
bgColor: this.bgColor,
onTap: this.onTap,
content: this.content
});
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L1564-L1579
|
bf1c90cb3736206c9a5f21e30a00757d45ae058f
|
github
|
|
fengmingdev/protobuf-arkts-generator.git
|
75888d404fd6ce52a046cba2a94807ecf1350147
|
runtime/arkpb/index.ets
|
arkts
|
RpcTransport
|
RPC 传输接口
用于 gRPC 客户端实现
|
export { RpcTransport } from './RpcTransport'
|
AST#export_declaration#Left export { RpcTransport } from './RpcTransport' AST#export_declaration#Right
|
export { RpcTransport } from './RpcTransport'
|
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L106-L106
|
829633341cf2071e714a8229d9ce3f9a8cfd3097
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets
|
arkts
|
start
|
[EndExclude manage]
|
public start(controllerName: string, path: string, url: string): Promise<string> {
return new Promise((resolve, reject) => {
const controller = this.getController(controllerName);
// [StartExclude manage]
// [Start gate]
this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadItem) => {
this.currentTask = webDownloadItem;
this.sourcePath = path + '/' + webDownloadItem.getSuggestedFileName();
this.currentTask.start(this.sourcePath);
// Specify the download path before downloading.
this.taskStatus = webDownloadItem.getState();
})
// [End gate]
// [Start update]
this.delegate.onDownloadUpdated((webDownloadItem: webview.WebDownloadItem) => {
this.currentTask = webDownloadItem;
// maintain download progress.
this.downloadProgress = webDownloadItem.getPercentComplete();
this.downloadSpeed = webDownloadItem.getCurrentSpeed();
this.taskStatus = webDownloadItem.getState();
})
// [End update]
// [Start fail2]
this.delegate.onDownloadFailed((webDownloadItem: webview.WebDownloadItem) => {
// Serialize the download data when the download fails to resume the download.
this.failedData = webDownloadItem.serialize();
this.taskStatus = webDownloadItem.getState();
reject(new Error('download failed'));
})
// [End fail2]
// [Start finish1]
this.delegate.onDownloadFinish((webDownloadItem: webview.WebDownloadItem) => {
this.taskStatus = webDownloadItem.getState();
resolve(this.sourcePath);
})
// [End finish1]
try {
// [EndExclude manage]
// Associate the download delegate with the webview controller.
controller?.setDownloadDelegate(this.delegate);
// [StartExclude manage]
// [Start url2]
controller?.startDownload(url);
// [End url2]
// [EndExclude manage]
} catch (error) {
hilog.error(0x0000, 'testTag', 'Execution failed, code = %{public}d, message = %{public}s',
error.code, error.message);
}
});
}
|
AST#method_declaration#Left public start AST#parameter_list#Left ( AST#parameter#Left controllerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left resolve AST#parameter#Right , AST#parameter#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left controller = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getController AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left controllerName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // [StartExclude manage] // [Start gate] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . delegate AST#member_expression#Right AST#expression#Right . onBeforeDownload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left webDownloadItem : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebDownloadItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right = AST#expression#Left webDownloadItem AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sourcePath AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left path AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left webDownloadItem AST#expression#Right AST#binary_expression#Right AST#expression#Right . getSuggestedFileName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sourcePath AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // Specify the download path before downloading. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // [End gate] // [Start update] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . delegate AST#member_expression#Right AST#expression#Right . onDownloadUpdated AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left webDownloadItem : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebDownloadItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTask AST#member_expression#Right = AST#expression#Left webDownloadItem AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // maintain download progress. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadProgress AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getPercentComplete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadSpeed AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getCurrentSpeed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // [End update] // [Start fail2] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . delegate AST#member_expression#Right AST#expression#Right . onDownloadFailed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left webDownloadItem : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebDownloadItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // Serialize the download data when the download fails to resume the download. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . failedData AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . serialize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'download failed' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // [End fail2] // [Start finish1] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . delegate AST#member_expression#Right AST#expression#Right . onDownloadFinish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left webDownloadItem : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebDownloadItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . taskStatus AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webDownloadItem AST#expression#Right . getState AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sourcePath AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // [End finish1] AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // [EndExclude manage] // Associate the download delegate with the webview controller. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left controller AST#expression#Right ?. setDownloadDelegate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . delegate AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [StartExclude manage] // [Start url2] AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left controller AST#expression#Right ?. startDownload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [End url2] // [EndExclude manage] } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left 'Execution failed, code = %{public}d, message = %{public}s' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public start(controllerName: string, path: string, url: string): Promise<string> {
return new Promise((resolve, reject) => {
const controller = this.getController(controllerName);
this.delegate.onBeforeDownload((webDownloadItem: webview.WebDownloadItem) => {
this.currentTask = webDownloadItem;
this.sourcePath = path + '/' + webDownloadItem.getSuggestedFileName();
this.currentTask.start(this.sourcePath);
this.taskStatus = webDownloadItem.getState();
})
this.delegate.onDownloadUpdated((webDownloadItem: webview.WebDownloadItem) => {
this.currentTask = webDownloadItem;
this.downloadProgress = webDownloadItem.getPercentComplete();
this.downloadSpeed = webDownloadItem.getCurrentSpeed();
this.taskStatus = webDownloadItem.getState();
})
this.delegate.onDownloadFailed((webDownloadItem: webview.WebDownloadItem) => {
this.failedData = webDownloadItem.serialize();
this.taskStatus = webDownloadItem.getState();
reject(new Error('download failed'));
})
this.delegate.onDownloadFinish((webDownloadItem: webview.WebDownloadItem) => {
this.taskStatus = webDownloadItem.getState();
resolve(this.sourcePath);
})
try {
controller?.setDownloadDelegate(this.delegate);
controller?.startDownload(url);
} catch (error) {
hilog.error(0x0000, 'testTag', 'Execution failed, code = %{public}d, message = %{public}s',
error.code, error.message);
}
});
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets#L68-L118
|
0dea94df75ddc98e9412d4815d9476abbe00edee
|
gitee
|
jxdiaodeyi/YX_Sports.git
|
af5346bd3d5003c33c306ff77b4b5e9184219893
|
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets
|
arkts
|
verifySegment
|
对数据进行分段验签,异步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param len 自定义的数据拆分长度,此处取64
@returns
|
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
len: number = 64): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, 'ECC256|SHA256', len);
}
|
AST#method_declaration#Left static async verifySegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PubKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 64 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . verifySegment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right , AST#expression#Left signDataBlob AST#expression#Right , AST#expression#Left pubKey AST#expression#Right , AST#expression#Left 'ECC256|SHA256' AST#expression#Right , AST#expression#Left len AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey,
len: number = 64): Promise<boolean> {
return CryptoUtil.verifySegment(data, signDataBlob, pubKey, 'ECC256|SHA256', len);
}
|
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/ECDSA.ets#L105-L108
|
198d36cdeb65c38062d9eb9fecddd45bd23ccde5
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
buildGreetingGenerator
|
祝福语生成器
|
@Builder
buildGreetingGenerator() {
Column({ space: 16 }) {
Row() {
Text('🎯 智能生成')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Button('高级配置')
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor(this.COLORS.primaryLight)
.fontColor(this.COLORS.primary)
.height(32)
.onClick(() => {
this.showGreetingGenerator = true;
})
}
.width('100%')
// 快速联系人选择
this.buildQuickContactSelector()
// 快速生成选项
if (this.selectedContact) {
this.buildQuickGenerationOptions()
}
// 高级配置界面
if (this.showGreetingGenerator) {
this.buildAdvancedGenerationOptions()
}
// 生成的祝福语展示
if (this.generatedGreeting || this.streamingText) {
this.buildGeneratedGreetingDisplay()
}
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingGenerator AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '🎯 智能生成' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '高级配置' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primaryLight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . primary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showGreetingGenerator AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 快速联系人选择 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickContactSelector AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 快速生成选项 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedContact AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildQuickGenerationOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 高级配置界面 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showGreetingGenerator AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildAdvancedGenerationOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 生成的祝福语展示 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . generatedGreeting AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . streamingText AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildGeneratedGreetingDisplay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . whitePrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.08)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildGreetingGenerator() {
Column({ space: 16 }) {
Row() {
Text('🎯 智能生成')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Button('高级配置')
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor(this.COLORS.primaryLight)
.fontColor(this.COLORS.primary)
.height(32)
.onClick(() => {
this.showGreetingGenerator = true;
})
}
.width('100%')
this.buildQuickContactSelector()
if (this.selectedContact) {
this.buildQuickGenerationOptions()
}
if (this.showGreetingGenerator) {
this.buildAdvancedGenerationOptions()
}
if (this.generatedGreeting || this.streamingText) {
this.buildGeneratedGreetingDisplay()
}
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3132-L3182
|
eb2b1447adcda8aefd0cdfdbc17780f842a27440
|
github
|
wasd09090030/MyHongmengProject.git
|
a8ed386b658ceeac69ef5bc42a92d78c7980821c
|
entry/src/main/ets/components/TaskBoardPage.ets
|
arkts
|
TaskBoardPage
|
==================== P2: 任务板页面 ====================
|
@Component
export struct TaskBoardPage {
@State tasks: TaskItem[] = AppState.tasks;
@State showAddDialog: boolean = false;
@State newTaskName: string = '';
@State newTaskMinutes: number = 25;
onSwitchToTimer: (task: TaskItem) => void = () => {}; // 接收回调函数作为普通参数
// 监听任务更新信号
@Consume('taskUpdateSignal') @Watch('onTaskUpdate') taskUpdateSignal: number;
// 任务更新时刷新列表
onTaskUpdate() {
this.tasks = AppState.tasks.slice(); // 创建新数组触发更新
}
build() {
Column() {
// 标题栏
Row() {
Text('专注任务')
.fontSize(28)
.fontWeight(FontWeight.Bold)
Blank()
Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.plus'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor('#007DFF')
.onClick(() => {
this.showAddDialog = true;
})
}
.width('100%')
.padding({ left: 20, right: 20, top: 20, bottom: 10 })
// 任务列表
if (this.tasks.length === 0) {
Column() {
SymbolGlyph($r('sys.symbol.doc_plaintext'))
.fontSize(80)
.fontColor(['#CCCCCC'])
Text('暂无任务')
.fontSize(18)
.fontColor('#999999')
.margin({ top: 20 })
Text('点击右上角 + 添加新任务')
.fontSize(14)
.fontColor('#CCCCCC')
.margin({ top: 10 })
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
} else {
List({ space: 12 }) {
ForEach(this.tasks, (task: TaskItem) => {
ListItem() {
this.TaskCard(task);
}
})
}
.width('100%')
.layoutWeight(1)
.padding({ left: 20, right: 20, top: 10 })
}
}
.width('100%')
.height('100%')
.backgroundColor('#F5F5F5')
.bindContentCover($$this.showAddDialog, this.AddTaskDialog(), {
modalTransition: ModalTransition.DEFAULT
})
}
@Builder
TaskCard(task: TaskItem) {
Column() {
Row() {
Text(task.name)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.trash'))
.fontSize(20)
.fontColor(['#FF3B30'])
}
.width(32)
.height(32)
.backgroundColor('#FFF1F0')
.onClick(() => {
this.deleteTask(task.id);
})
}
.width('100%')
.margin({ bottom: 12 })
Row() {
SymbolGlyph($r('sys.symbol.clock'))
.fontSize(16)
.fontColor(['#666666'])
Text(`预估时长: ${Math.floor(task.estimatedTime / 60)} 分钟`)
.fontSize(14)
.fontColor('#666666')
.margin({ left: 6 })
Blank()
Button('开始专注')
.fontSize(14)
.height(36)
.type(ButtonType.Capsule)
.backgroundColor('#34C759')
.onClick(() => {
this.startFocus(task);
})
}
.width('100%')
}
.width('100%')
.padding(16)
.backgroundColor(Color.White)
.borderRadius(12)
.shadow({
radius: 8,
color: '#10000000',
offsetX: 0,
offsetY: 2
})
}
@Builder
AddTaskDialog() {
Column() {
Text('添加新任务')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ bottom: 24 })
TextInput({ placeholder: '任务名称' })
.width('100%')
.onChange((value: string) => {
this.newTaskName = value;
})
.margin({ bottom: 20 })
Row() {
Text('预估时长:')
.fontSize(16)
Blank()
Button('-')
.width(40)
.height(40)
.onClick(() => {
if (this.newTaskMinutes > 5) {
this.newTaskMinutes -= 5;
}
})
Text(`${this.newTaskMinutes} 分钟`)
.fontSize(16)
.width(100)
.textAlign(TextAlign.Center)
Button('+')
.width(40)
.height(40)
.onClick(() => {
this.newTaskMinutes += 5;
})
}
.width('100%')
.margin({ bottom: 30 })
Row() {
Button('取消')
.width('45%')
.backgroundColor('#F1F3F5')
.fontColor(Color.Black)
.onClick(() => {
this.showAddDialog = false;
this.resetDialog();
})
Button('添加')
.width('45%')
.backgroundColor('#007DFF')
.onClick(() => {
this.addTask();
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
.width('85%')
.padding(24)
.backgroundColor(Color.White)
.borderRadius(16)
}
addTask() {
if (this.newTaskName.trim() === '') {
return;
}
const newTask: TaskItem = {
id: Date.now().toString(),
name: this.newTaskName,
estimatedTime: this.newTaskMinutes * 60,
status: 'pending'
};
AppState.tasks.push(newTask);
this.tasks = AppState.tasks;
this.showAddDialog = false;
this.resetDialog();
// 保存数据
AppState.saveAllData();
}
deleteTask(id: string) {
AppState.tasks = AppState.tasks.filter(t => t.id !== id);
this.tasks = AppState.tasks;
// 保存数据
AppState.saveAllData();
}
startFocus(task: TaskItem) {
// 使用回调函数切换到计时器页面
this.onSwitchToTimer(task);
}
resetDialog() {
this.newTaskName = '';
this.newTaskMinutes = 25;
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TaskBoardPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right tasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showAddDialog : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newTaskName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right newTaskMinutes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left onSwitchToTimer : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 接收回调函数作为普通参数 // 监听任务更新信号 AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'taskUpdateSignal' AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'onTaskUpdate' AST#expression#Right ) AST#decorator#Right taskUpdateSignal : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 任务更新时刷新列表 AST#method_declaration#Left onTaskUpdate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 创建新数组触发更新 } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 标题栏 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '专注任务' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 28 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.plus' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showAddDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 任务列表 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.doc_plaintext' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 80 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left '#CCCCCC' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '暂无任务' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '点击右上角 + 添加新任务' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#CCCCCC' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . TaskCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F5F5F5' AST#expression#Right ) AST#modifier_chain_expression#Left . bindContentCover ( AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . showAddDialog AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . AddTaskDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left modalTransition AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ModalTransition AST#expression#Right . DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TaskCard AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.trash' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left '#FF3B30' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFF1F0' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . deleteTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.clock' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left '#666666' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 预估时长: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left task AST#expression#Right . estimatedTime AST#member_expression#Right AST#expression#Right / AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right 分钟 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 6 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '开始专注' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 36 AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#34C759' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startFocus AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left '#10000000' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AddTaskDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '添加新任务' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left '任务名称' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '预估时长:' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '-' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right AST#expression#Right > AST#expression#Left 5 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right -= AST#expression#Left 5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 分钟 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '+' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right += AST#expression#Left 5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '取消' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '45%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F1F3F5' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showAddDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '添加' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '45%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addTask AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '85%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left addTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right === AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left newTask : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left estimatedTime AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right AST#expression#Right * AST#expression#Left 60 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left status AST#property_name#Right : AST#expression#Left 'pending' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newTask AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showAddDialog AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resetDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 保存数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . saveAllData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left deleteTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left t => AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left t AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left id AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 保存数据 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppState AST#expression#Right . saveAllData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left startFocus AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 使用回调函数切换到计时器页面 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onSwitchToTimer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left resetDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskName AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newTaskMinutes AST#member_expression#Right = AST#expression#Left 25 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct TaskBoardPage {
@State tasks: TaskItem[] = AppState.tasks;
@State showAddDialog: boolean = false;
@State newTaskName: string = '';
@State newTaskMinutes: number = 25;
onSwitchToTimer: (task: TaskItem) => void = () => {};
@Consume('taskUpdateSignal') @Watch('onTaskUpdate') taskUpdateSignal: number;
onTaskUpdate() {
this.tasks = AppState.tasks.slice();
}
build() {
Column() {
Row() {
Text('专注任务')
.fontSize(28)
.fontWeight(FontWeight.Bold)
Blank()
Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.plus'))
.fontSize(24)
.fontColor([Color.White])
}
.width(40)
.height(40)
.backgroundColor('#007DFF')
.onClick(() => {
this.showAddDialog = true;
})
}
.width('100%')
.padding({ left: 20, right: 20, top: 20, bottom: 10 })
if (this.tasks.length === 0) {
Column() {
SymbolGlyph($r('sys.symbol.doc_plaintext'))
.fontSize(80)
.fontColor(['#CCCCCC'])
Text('暂无任务')
.fontSize(18)
.fontColor('#999999')
.margin({ top: 20 })
Text('点击右上角 + 添加新任务')
.fontSize(14)
.fontColor('#CCCCCC')
.margin({ top: 10 })
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
} else {
List({ space: 12 }) {
ForEach(this.tasks, (task: TaskItem) => {
ListItem() {
this.TaskCard(task);
}
})
}
.width('100%')
.layoutWeight(1)
.padding({ left: 20, right: 20, top: 10 })
}
}
.width('100%')
.height('100%')
.backgroundColor('#F5F5F5')
.bindContentCover($$this.showAddDialog, this.AddTaskDialog(), {
modalTransition: ModalTransition.DEFAULT
})
}
@Builder
TaskCard(task: TaskItem) {
Column() {
Row() {
Text(task.name)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
Button({ type: ButtonType.Circle }) {
SymbolGlyph($r('sys.symbol.trash'))
.fontSize(20)
.fontColor(['#FF3B30'])
}
.width(32)
.height(32)
.backgroundColor('#FFF1F0')
.onClick(() => {
this.deleteTask(task.id);
})
}
.width('100%')
.margin({ bottom: 12 })
Row() {
SymbolGlyph($r('sys.symbol.clock'))
.fontSize(16)
.fontColor(['#666666'])
Text(`预估时长: ${Math.floor(task.estimatedTime / 60)} 分钟`)
.fontSize(14)
.fontColor('#666666')
.margin({ left: 6 })
Blank()
Button('开始专注')
.fontSize(14)
.height(36)
.type(ButtonType.Capsule)
.backgroundColor('#34C759')
.onClick(() => {
this.startFocus(task);
})
}
.width('100%')
}
.width('100%')
.padding(16)
.backgroundColor(Color.White)
.borderRadius(12)
.shadow({
radius: 8,
color: '#10000000',
offsetX: 0,
offsetY: 2
})
}
@Builder
AddTaskDialog() {
Column() {
Text('添加新任务')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ bottom: 24 })
TextInput({ placeholder: '任务名称' })
.width('100%')
.onChange((value: string) => {
this.newTaskName = value;
})
.margin({ bottom: 20 })
Row() {
Text('预估时长:')
.fontSize(16)
Blank()
Button('-')
.width(40)
.height(40)
.onClick(() => {
if (this.newTaskMinutes > 5) {
this.newTaskMinutes -= 5;
}
})
Text(`${this.newTaskMinutes} 分钟`)
.fontSize(16)
.width(100)
.textAlign(TextAlign.Center)
Button('+')
.width(40)
.height(40)
.onClick(() => {
this.newTaskMinutes += 5;
})
}
.width('100%')
.margin({ bottom: 30 })
Row() {
Button('取消')
.width('45%')
.backgroundColor('#F1F3F5')
.fontColor(Color.Black)
.onClick(() => {
this.showAddDialog = false;
this.resetDialog();
})
Button('添加')
.width('45%')
.backgroundColor('#007DFF')
.onClick(() => {
this.addTask();
})
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
.width('85%')
.padding(24)
.backgroundColor(Color.White)
.borderRadius(16)
}
addTask() {
if (this.newTaskName.trim() === '') {
return;
}
const newTask: TaskItem = {
id: Date.now().toString(),
name: this.newTaskName,
estimatedTime: this.newTaskMinutes * 60,
status: 'pending'
};
AppState.tasks.push(newTask);
this.tasks = AppState.tasks;
this.showAddDialog = false;
this.resetDialog();
AppState.saveAllData();
}
deleteTask(id: string) {
AppState.tasks = AppState.tasks.filter(t => t.id !== id);
this.tasks = AppState.tasks;
AppState.saveAllData();
}
startFocus(task: TaskItem) {
this.onSwitchToTimer(task);
}
resetDialog() {
this.newTaskName = '';
this.newTaskMinutes = 25;
}
}
|
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/TaskBoardPage.ets#L4-L252
|
eaa471c4bb1fe810d66a40f0a63ef974dc27c443
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PreviewUtil.ets
|
arkts
|
loadData
|
加载预览文件信息。仅当预览窗口存在时起效。
@param previewInfo 文件的预览信息
@returns
|
static loadData(previewInfo: filePreview.PreviewInfo) {
return filePreview.loadData(AppUtil.getContext(), previewInfo);
}
|
AST#method_declaration#Left static loadData AST#parameter_list#Left ( AST#parameter#Left previewInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left filePreview . PreviewInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left filePreview AST#expression#Right . loadData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left previewInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static loadData(previewInfo: filePreview.PreviewInfo) {
return filePreview.loadData(AppUtil.getContext(), previewInfo);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L81-L83
|
0a61d7a24c234a3a605be7809212dcdec6df0414
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/FileUtil.ets
|
arkts
|
isFile
|
判断文件是否是普通文件。
@param file string|number 文件应用沙箱路径path或已打开的文件描述符fd。
@returns
|
static isFile(file: string | number): boolean {
return fs.statSync(file).isFile();
}
|
AST#method_declaration#Left static isFile AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left file AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . isFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static isFile(file: string | number): boolean {
return fs.statSync(file).isFile();
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L276-L278
|
80a15c37e4eda9fda9b855fd3ed0d4e8198a241e
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
spinkit/src/main/ets/components/SpinC.ets
|
arkts
|
SpinC
|
TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
|
@ComponentV2
export struct SpinC {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0.4;
@Local scale2: number = 0.4;
@Local scale3: number = 0.4;
@Local scale4: number = 0.4;
@Local scale5: number = 0.4;
build() {
Row() {
Canvas()
.chunkStyle()
.scale({ y: this.scale1 })
Canvas()
.chunkStyle()
.scale({ y: this.scale2 })
Canvas()
.chunkStyle()
.scale({ y: this.scale3 })
Canvas()
.chunkStyle()
.scale({ y: this.scale4 })
Canvas()
.chunkStyle()
.scale({ y: this.scale5 })
}
.width(this.spinSize)
.height(this.spinSize * 0.8)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale1 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale1 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes2: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes3: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale3 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale3 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes4: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale4 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale4 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes5: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale5 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale5 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1100 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1000 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -900 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -800 }, keyframes5);
})
}
@Styles
chunkStyle(){
.height('100%')
.width('14%')
.margin({ left: '3%', right: '3%' })
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinC AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale2 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale3 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale4 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right scale5 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.4 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale3 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale4 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . chunkStyle ( ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale5 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale1 AST#member_expression#Right = AST#expression#Left 0.4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale2 AST#member_expression#Right = AST#expression#Left 0.4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes3 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale3 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale3 AST#member_expression#Right = AST#expression#Left 0.4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes4 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale4 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale4 AST#member_expression#Right = AST#expression#Left 0.4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes5 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale5 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scale5 AST#member_expression#Right = AST#expression#Left 0.4 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1100 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1000 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes3 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 900 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 800 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right chunkStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '14%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left '3%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left '3%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct SpinC {
@Require @Param spinSize: number;
@Require @Param spinColor: ResourceColor;
@Local scale1: number = 0.4;
@Local scale2: number = 0.4;
@Local scale3: number = 0.4;
@Local scale4: number = 0.4;
@Local scale5: number = 0.4;
build() {
Row() {
Canvas()
.chunkStyle()
.scale({ y: this.scale1 })
Canvas()
.chunkStyle()
.scale({ y: this.scale2 })
Canvas()
.chunkStyle()
.scale({ y: this.scale3 })
Canvas()
.chunkStyle()
.scale({ y: this.scale4 })
Canvas()
.chunkStyle()
.scale({ y: this.scale5 })
}
.width(this.spinSize)
.height(this.spinSize * 0.8)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale1 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale1 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes2: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale2 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes3: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale3 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale3 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes4: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale4 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale4 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
let keyframes5: Array<KeyframeState> = [
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale5 = 1;
}
},
{
duration: 240,
curve: Curve.EaseInOut,
event: () => {
this.scale5 = 0.4;
}
},
{
duration: 720,
event: () => {
}
}
];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1100 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1000 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -900 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -800 }, keyframes5);
})
}
@Styles
chunkStyle(){
.height('100%')
.width('14%')
.margin({ left: '3%', right: '3%' })
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinC.ets#L22-L183
|
f57ac62c563cf0b4874abb9425e8850631d6379e
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/user/User.ets
|
arkts
|
用户信息模型
|
export class User {
userId: number | null = null;
userName: string | null = null;
email: string | null = null;
password: string | null = null;
loginType: LoginType | null = null;
loginIdentifier: string | null = null;
loginTime: Date | null = null;
createTime: Date | null = null;
imageAddr: string | null = null;
deviceType: string | null = null;
userCode: string | null = null;
// 通过 JSON 生成 User(类似 Kotlin 的 from(json) 或 Swift 的 init(from decoder))
static from(json: UserJson): User {
const user = new User();
user.userId = json.user_id ?? null;
user.userName = json.user_name ?? null;
user.email = json.email ?? null;
user.password = json.password ?? null;
user.loginIdentifier = json.login_identifier ?? null;
user.loginType = LoginTypeHelper.fromRaw(json.login_type);
user.loginTime = json.login_time ? new Date(json.login_time) : null;
user.createTime = json.create_time ? new Date(json.create_time) : null;
user.imageAddr = json.image_addr ?? null;
user.deviceType = json.device_type ?? null;
user.userCode = json.user_code ?? null;
return user;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class User AST#class_body#Left { AST#property_declaration#Left userId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left userName : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left email : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left password : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left loginType : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left LoginType AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left loginIdentifier : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left loginTime : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left createTime : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left imageAddr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left deviceType : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left userCode : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right // 通过 JSON 生成 User(类似 Kotlin 的 from(json) 或 Swift 的 init(from decoder)) AST#method_declaration#Left static from AST#parameter_list#Left ( AST#parameter#Left json : AST#type_annotation#Left AST#primary_type#Left UserJson AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left user = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left User AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . userId AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . user_id AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . userName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . user_name AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . email AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . email AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . password AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . password AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . loginIdentifier AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . login_identifier AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . loginType AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LoginTypeHelper AST#expression#Right . fromRaw AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . login_type AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . loginTime AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . login_time AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . login_time AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . createTime AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . create_time AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . create_time AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . imageAddr AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . image_addr AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . deviceType AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . device_type AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left user AST#expression#Right . userCode AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left json AST#expression#Right . user_code AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left user AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class User {
userId: number | null = null;
userName: string | null = null;
email: string | null = null;
password: string | null = null;
loginType: LoginType | null = null;
loginIdentifier: string | null = null;
loginTime: Date | null = null;
createTime: Date | null = null;
imageAddr: string | null = null;
deviceType: string | null = null;
userCode: string | null = null;
static from(json: UserJson): User {
const user = new User();
user.userId = json.user_id ?? null;
user.userName = json.user_name ?? null;
user.email = json.email ?? null;
user.password = json.password ?? null;
user.loginIdentifier = json.login_identifier ?? null;
user.loginType = LoginTypeHelper.fromRaw(json.login_type);
user.loginTime = json.login_time ? new Date(json.login_time) : null;
user.createTime = json.create_time ? new Date(json.create_time) : null;
user.imageAddr = json.image_addr ?? null;
user.deviceType = json.device_type ?? null;
user.userCode = json.user_code ?? null;
return user;
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/User.ets#L66-L100
|
56f0467417d148344607edf754892e17387a5930
|
github
|
|
yycy134679/FoodieHarmony.git
|
e6971f0a8f7574ae278d02eb5c057e57e667dab5
|
entry/src/main/ets/view/home/CategoryGrid.ets
|
arkts
|
handleCategoryClick
|
处理分类点击
@param index 分类索引
@param category 分类数据
|
private handleCategoryClick(index: number, category: CategoryItem) {
if (this.selectedIndex === index) {
// 再次点击已选中的分类,取消筛选
this.selectedIndex = -1;
if (this.onCategoryClick) {
this.onCategoryClick(''); // 传递空字符串表示取消筛选
}
} else {
// 点击新的分类,选中并筛选
this.selectedIndex = index;
if (this.onCategoryClick) {
this.onCategoryClick(category.name);
}
}
}
|
AST#method_declaration#Left private handleCategoryClick AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left CategoryItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 再次点击已选中的分类,取消筛选 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onCategoryClick AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onCategoryClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 传递空字符串表示取消筛选 } AST#ui_if_statement#Right AST#ui_control_flow#Right } else { // 点击新的分类,选中并筛选 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onCategoryClick AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onCategoryClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left category AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private handleCategoryClick(index: number, category: CategoryItem) {
if (this.selectedIndex === index) {
this.selectedIndex = -1;
if (this.onCategoryClick) {
this.onCategoryClick('');
}
} else {
this.selectedIndex = index;
if (this.onCategoryClick) {
this.onCategoryClick(category.name);
}
}
}
|
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/home/CategoryGrid.ets#L52-L66
|
a563d67036a1d970bd2b6287c774cf40a6fd6804
|
github
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets
|
arkts
|
saveTask
|
保存任务
|
async saveTask() {
// 表单验证
if (!this.task.title.trim()) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请输入任务标题',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
if (!this.task.dreamId) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请选择关联的梦想',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
// 设置提醒时间
if (this.hasReminder && this.reminderDate && this.reminderTime) {
const reminderDateTime = new Date(`${this.reminderDate}T${this.reminderTime}:00`);
this.task.reminderTime = reminderDateTime.toISOString();
} else {
this.task.reminderTime = null;
}
this.isSubmitting = true;
try {
let result: Task;
if (this.isEdit && this.task.id) {
// 更新任务
result = await updateTask(this.task.id, this.task);
} else {
// 创建任务
result = await createTask(this.task);
}
if (result) {
// 处理提醒
if (this.hasReminder && this.task.reminderTime) {
await this.setReminder(result);
} else if (this.reminderId >= 0) {
// 删除已有提醒
await this.cancelReminder();
}
const toastOptions: promptAction.ShowToastOptions = {
message: this.isEdit ? '任务更新成功' : '任务创建成功',
duration: 2000
};
prompt.showToast(toastOptions);
// 返回上一页
router.back();
}
} catch (error) {
console.error(`${this.isEdit ? '更新' : '创建'}任务失败: ${error instanceof Error ? error.message : String(error)}`);
const toastOptions: promptAction.ShowToastOptions = {
message: `${this.isEdit ? '更新' : '创建'}任务失败,请稍后重试`,
duration: 2000
};
prompt.showToast(toastOptions);
} finally {
this.isSubmitting = false;
}
}
|
AST#method_declaration#Left async saveTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 表单验证 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '请输入任务标题' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right . dreamId AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '请选择关联的梦想' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 设置提醒时间 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasReminder AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . reminderDate AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . reminderTime AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reminderDateTime = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderDate AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right T AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderTime AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right :00 ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right . reminderTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left reminderDateTime AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right . reminderTime AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSubmitting AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left Task AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEdit AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 更新任务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left updateTask AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 创建任务 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left createTask AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . task AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left result AST#expression#Right ) AST#block_statement#Left { // 处理提醒 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasReminder AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . task AST#member_expression#Right AST#expression#Right . reminderTime AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . setReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reminderId AST#member_expression#Right AST#expression#Right >= AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 删除已有提醒 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . cancelReminder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEdit AST#member_expression#Right AST#expression#Right ? AST#expression#Left '任务更新成功' AST#expression#Right : AST#expression#Left '任务创建成功' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 返回上一页 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEdit AST#member_expression#Right AST#expression#Right ? AST#expression#Left '更新' AST#expression#Right : AST#expression#Left '创建' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right 任务失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right instanceof AST#expression#Left Error AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right : AST#expression#Left String AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left toastOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left promptAction . ShowToastOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isEdit AST#member_expression#Right AST#expression#Right ? AST#expression#Left '更新' AST#expression#Right : AST#expression#Left '创建' AST#expression#Right AST#conditional_expression#Right AST#expression#Right } AST#template_substitution#Right 任务失败,请稍后重试 ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left prompt AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left toastOptions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#finally_clause#Left finally AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSubmitting AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async saveTask() {
if (!this.task.title.trim()) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请输入任务标题',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
if (!this.task.dreamId) {
const toastOptions: promptAction.ShowToastOptions = {
message: '请选择关联的梦想',
duration: 2000
};
prompt.showToast(toastOptions);
return;
}
if (this.hasReminder && this.reminderDate && this.reminderTime) {
const reminderDateTime = new Date(`${this.reminderDate}T${this.reminderTime}:00`);
this.task.reminderTime = reminderDateTime.toISOString();
} else {
this.task.reminderTime = null;
}
this.isSubmitting = true;
try {
let result: Task;
if (this.isEdit && this.task.id) {
result = await updateTask(this.task.id, this.task);
} else {
result = await createTask(this.task);
}
if (result) {
if (this.hasReminder && this.task.reminderTime) {
await this.setReminder(result);
} else if (this.reminderId >= 0) {
await this.cancelReminder();
}
const toastOptions: promptAction.ShowToastOptions = {
message: this.isEdit ? '任务更新成功' : '任务创建成功',
duration: 2000
};
prompt.showToast(toastOptions);
router.back();
}
} catch (error) {
console.error(`${this.isEdit ? '更新' : '创建'}任务失败: ${error instanceof Error ? error.message : String(error)}`);
const toastOptions: promptAction.ShowToastOptions = {
message: `${this.isEdit ? '更新' : '创建'}任务失败,请稍后重试`,
duration: 2000
};
prompt.showToast(toastOptions);
} finally {
this.isSubmitting = false;
}
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L252-L319
|
dc16e96d02c19054071230cfd5cb97b039536558
|
github
|
jjjjjjava/ffmpeg_tools.git
|
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
|
Index.ets
|
arkts
|
FLog
|
日志工具
|
export { FLog } from './src/main/ets/ffmpeg/FLog';
|
AST#export_declaration#Left export { FLog } from './src/main/ets/ffmpeg/FLog' ; AST#export_declaration#Right
|
export { FLog } from './src/main/ets/ffmpeg/FLog';
|
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L24-L24
|
8404e7448ade752e15b86580349f7af0783e00ea
|
github
|
openharmony-sig/knowledge_demo_smart_home
|
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
|
FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets
|
arkts
|
getDoorbellOpenCommand
|
获取智能门铃打开门命令
@return Command
|
static getDoorbellOpenCommand():DeviceCommandModel {
let param = {}
param["Lock"] = "ON";
return new DeviceCommandModel("SetLock", "DoorBell", JSON.stringify(param));
}
|
AST#method_declaration#Left static getDoorbellOpenCommand AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DeviceCommandModel AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left param = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#ERROR#Left param AST#ERROR#Right [ AST#expression#Left "Lock" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#ERROR#Left = "ON" AST#ERROR#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DeviceCommandModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "SetLock" AST#expression#Right , AST#expression#Left "DoorBell" AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left param AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getDoorbellOpenCommand():DeviceCommandModel {
let param = {}
param["Lock"] = "ON";
return new DeviceCommandModel("SetLock", "DoorBell", JSON.stringify(param));
}
|
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/controlPage/common/utils/controlPageUtil.ets#L84-L88
|
499d88083604dda67395fbc5c1d93623a72ee66d
|
gitee
|
tang01611/Mobile-Internet-job.git
|
3b570970f9a742f89ea3b170483cb34f48c17e7d
|
entry/src/main/ets/model/NewsData.ets
|
arkts
|
Copyright (c) 2021 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.
|
export class NewsData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
constructor(newsId: string, title: string, newsType: string, imgUrl: Resource, reads: string, likes: string, content: string) {
this.newsId = newsId;
this.title = title;
this.newsType = newsType;
this.imgUrl = imgUrl;
this.reads = reads;
this.likes = likes;
this.content = content;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NewsData AST#class_body#Left { AST#property_declaration#Left newsId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left newsType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left imgUrl : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left reads : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left likes : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left newsId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newsType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imgUrl : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reads : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left likes : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newsId AST#member_expression#Right = AST#expression#Left newsId AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . newsType AST#member_expression#Right = AST#expression#Left newsType AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imgUrl AST#member_expression#Right = AST#expression#Left imgUrl AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . reads AST#member_expression#Right = AST#expression#Left reads AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . likes AST#member_expression#Right = AST#expression#Left likes AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NewsData {
newsId: string;
title: string;
newsType: string;
imgUrl: Resource;
reads: string;
likes: string;
content: string;
constructor(newsId: string, title: string, newsType: string, imgUrl: Resource, reads: string, likes: string, content: string) {
this.newsId = newsId;
this.title = title;
this.newsType = newsType;
this.imgUrl = imgUrl;
this.reads = reads;
this.likes = likes;
this.content = content;
}
}
|
https://github.com/tang01611/Mobile-Internet-job.git/blob/3b570970f9a742f89ea3b170483cb34f48c17e7d/entry/src/main/ets/model/NewsData.ets#L16-L34
|
001ca7527ef12cc0c36d15894f959d8c4d827733
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets
|
arkts
|
initWantAgentNotificationRequest
|
init wantAgent NotificationRequest
@param notificationContent
@param notificationWantAgent
@return return the created NotificationRequest
|
initWantAgentNotificationRequest(
notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent,
wantAgent: notificationWantAgent
};
}
|
AST#method_declaration#Left initWantAgentNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationWantAgent : AST#type_annotation#Left AST#primary_type#Left WantAgent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notification . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left notificationSlotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . CONTENT_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 通知id,默认为1 AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left notificationContent AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#Right : AST#expression#Left notificationWantAgent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
initWantAgentNotificationRequest(
notificationContent: notification.NotificationContent, notificationWantAgent: WantAgent
): notification.NotificationRequest {
return {
notificationSlotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent,
wantAgent: notificationWantAgent
};
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/NotificationRequestUtil.ets#L42-L51
|
ca6fd03e32665d30a7fb3b6a9734f98ad82e1043
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets
|
arkts
|
=== ServerCfg 数据模型 ===
|
export class ServerCfg {
key : string | null = null
name : string | null = null
value : number | null = null
constructor
|
AST#export_declaration#Left export AST#ERROR#Left class ServerCfg { key AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right name : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right value AST#ERROR#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
|
export class ServerCfg {
key : string | null = null
name : string | null = null
value : number | null = null
constructor
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/ServerCfgManager.ets#L8-L13
|
eb73cb5a0abb1af67399a4d1257a3daa4c18d910
|
github
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets
|
arkts
|
rgb
|
Converts the given hex-color-string to rgb.
@param hex
@return
|
public static rgb(hex: string): number {
var color: number = Number(hex.replace('#', ''));
var r: number = (color >> 16) & 0xff;
var g: number = (color >> 8) & 0xff;
var b: number = (color >> 0) & 0xff;
return Color.rgb(r, g, b);
}
|
AST#method_declaration#Left public static rgb AST#parameter_list#Left ( AST#parameter#Left hex : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hex AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left r : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left color AST#expression#Right >> AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left g : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left color AST#expression#Right >> AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left b : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left color AST#expression#Right >> AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . rgb AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left r AST#expression#Right , AST#expression#Left g AST#expression#Right , AST#expression#Left b AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static rgb(hex: string): number {
var color: number = Number(hex.replace('#', ''));
var r: number = (color >> 16) & 0xff;
var g: number = (color >> 8) & 0xff;
var b: number = (color >> 0) & 0xff;
return Color.rgb(r, g, b);
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ColorTemplate.ets#L200-L206
|
35745284c61e7a31a3569bc98919a71d0d9635f7
|
gitee
|
iotjin/JhHarmonyDemo.git
|
819e6c3b1db9984c042a181967784550e171b2e8
|
JhCommon/src/main/ets/JhCommon/components/JhDialog.ets
|
arkts
|
hide
|
关闭弹框
@param dialogId 目前弹框id
|
public static hide(dialogId: string) {
DialogHelper.closeDialog(dialogId)
}
|
AST#method_declaration#Left public static hide AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dialogId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public static hide(dialogId: string) {
DialogHelper.closeDialog(dialogId)
}
|
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhDialog.ets#L128-L130
|
68646fca0e7e588a9e10a52d3a35d65671a836c9
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets
|
arkts
|
buildAISuggestions
|
构建AI建议
|
@Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgress()
.width(16)
.height(16)
.color('#007AFF')
Text('生成中...')
.fontSize(12)
.fontColor('#007AFF')
}
}
}
if (this.aiGenerating) {
// 加载状态
Column({ space: 8 }) {
ForEach([1, 2, 3], () => {
Row()
.width('100%')
.height(40)
.backgroundColor('#f0f0f0')
.borderRadius(8)
.opacity(0.6)
})
}
} else {
// AI建议列表
Column({ space: 8 }) {
ForEach(this.aiSuggestions, (suggestion: string, index: number) => {
Column({ space: 8 }) {
Text(suggestion)
.fontSize(14)
.fontColor('#333333')
.lineHeight(20)
.width('100%')
Row() {
Text(`建议${index + 1}`)
.fontSize(12)
.fontColor('#999999')
Blank()
Button('使用')
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor('#007AFF')
.fontColor('#ffffff')
.width(50)
.height(24)
.onClick(() => {
this.selectAISuggestion(suggestion);
})
}
}
.width('100%')
.padding(12)
.backgroundColor(this.customContent === suggestion ? '#e8f4ff' : '#f8f9fa')
.borderRadius(8)
.onClick(() => {
this.selectAISuggestion(suggestion);
})
})
}
}
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.1)',
offsetX: 0,
offsetY: 2
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildAISuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'AI生成建议' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aiGenerating AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '生成中...' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aiGenerating AST#member_expression#Right AST#expression#Right ) { // 加载状态 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 40 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f0f0f0' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.6 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { // AI建议列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . aiSuggestions AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left suggestion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left suggestion AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 建议 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#999999' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '使用' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#007AFF' AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectAISuggestion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left suggestion AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . customContent AST#member_expression#Right AST#expression#Right === AST#expression#Left suggestion AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left '#e8f4ff' AST#expression#Right : AST#expression#Left '#f8f9fa' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectAISuggestion AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left suggestion AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#ffffff' AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.1)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildAISuggestions() {
Column({ space: 12 }) {
Row() {
Text('AI生成建议')
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor('#333333')
.layoutWeight(1)
if (this.aiGenerating) {
Row({ space: 4 }) {
LoadingProgress()
.width(16)
.height(16)
.color('#007AFF')
Text('生成中...')
.fontSize(12)
.fontColor('#007AFF')
}
}
}
if (this.aiGenerating) {
Column({ space: 8 }) {
ForEach([1, 2, 3], () => {
Row()
.width('100%')
.height(40)
.backgroundColor('#f0f0f0')
.borderRadius(8)
.opacity(0.6)
})
}
} else {
Column({ space: 8 }) {
ForEach(this.aiSuggestions, (suggestion: string, index: number) => {
Column({ space: 8 }) {
Text(suggestion)
.fontSize(14)
.fontColor('#333333')
.lineHeight(20)
.width('100%')
Row() {
Text(`建议${index + 1}`)
.fontSize(12)
.fontColor('#999999')
Blank()
Button('使用')
.type(ButtonType.Capsule)
.fontSize(12)
.backgroundColor('#007AFF')
.fontColor('#ffffff')
.width(50)
.height(24)
.onClick(() => {
this.selectAISuggestion(suggestion);
})
}
}
.width('100%')
.padding(12)
.backgroundColor(this.customContent === suggestion ? '#e8f4ff' : '#f8f9fa')
.borderRadius(8)
.onClick(() => {
this.selectAISuggestion(suggestion);
})
})
}
}
}
.width('100%')
.padding(16)
.backgroundColor('#ffffff')
.borderRadius(12)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.1)',
offsetX: 0,
offsetY: 2
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L390-L476
|
d3e1fd7095da26009e0da0f50b1b4f8eefd4d554
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/hosts/bunch_of_search_engines.ets
|
arkts
|
export_string
|
Export search engines in a specific plain text format.
@returns '\n' connected string of search engines in the format of:
@example 'Bing\nhttps://www.cn.bing.com/search?q=%s\nGoogle\nhttps://www.google.com/search?q=%s'
|
static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_search_engines.list_of_search_engines.length; index++) {
let ua: search_engine = bunch_of_search_engines.list_of_search_engines[index];
export_list.push(ua.label);
export_list.push(ua.url);
}
return export_list.join("\n");
}
|
AST#method_declaration#Left static export_string AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left export_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left bunch_of_search_engines AST#expression#Right AST#binary_expression#Right AST#expression#Right . list_of_search_engines AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ua : AST#type_annotation#Left AST#primary_type#Left search_engine AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_search_engines AST#expression#Right . list_of_search_engines AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ua AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ua AST#expression#Right . url AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left export_list AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\n" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static export_string() {
let export_list: string[] = []
for (let index = 0; index < bunch_of_search_engines.list_of_search_engines.length; index++) {
let ua: search_engine = bunch_of_search_engines.list_of_search_engines[index];
export_list.push(ua.label);
export_list.push(ua.url);
}
return export_list.join("\n");
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L58-L66
|
082184904d38640e96a2a343442f50507f3f3a9e
|
gitee
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
|
arkts
|
animateX
|
Animates values along the X axis.
@param durationMillis animation duration
@param easing EasingFunction
|
public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
}
|
AST#method_declaration#Left public animateX AST#parameter_list#Left ( AST#parameter#Left durationMillis : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left easing : AST#type_annotation#Left AST#primary_type#Left EasingFunction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left animatorX = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . xAnimator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left durationMillis AST#expression#Right , AST#expression#Left easing AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left animatorX AST#expression#Right . addUpdateListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mListener AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left animatorX AST#expression#Right . start AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L61-L65
|
1e061b24b7d6674c0e3f7a451f9d6082600c58be
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/model/base/DialogOptions.ets
|
arkts
|
TODO 弹窗工具类,Base参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18
|
export interface DialogOptions extends BaseDialogOptions {
title?: ResourceStr; //弹框标题
actionCancel?: boolean; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:true。
onAction?: ActionCallBack | ActionStrCallBack; //按钮的CallBack事件。
height?: Dimension | Length; //设置弹窗的高度;很多弹框都是自适应高度,谨慎设置该值。
width?: Dimension | Length; //设置弹窗的宽度,弹窗宽度默认值:'calc(100% - 32vp)'、100%。
maxHeight?: Dimension | Length; //设置弹窗高度默认最大值;很多弹框都是自适应高度,谨慎设置该值。
maxWidth?: Length; //弹窗宽度默认最大值:360vp。
backgroundColor?: ResourceColor; //弹窗背板颜色。默认值:Color.White
backgroundBlurStyle?: BlurStyle; //弹窗背板模糊材质。默认值:BlurStyle.COMPONENT_ULTRA_THICK
cornerRadius?: Length | BorderRadiuses | LocalizedBorderRadiuses; //设置背板的圆角半径。可分别设置4个圆角的半径。
borderWidth?: Dimension | EdgeWidths | LocalizedEdgeWidths; //可分别设置4个边框宽度。默认值:0。
borderColor?: ResourceColor | EdgeColors | LocalizedEdgeColors; //设置弹窗背板的边框颜色。默认值:Color.Black。
borderStyle?: BorderStyle | EdgeStyles; //设置弹窗背板的边框样式。默认值:BorderStyle.Solid。
shadow?: ShadowOptions | ShadowStyle; //设置弹窗背板的阴影。
theme?: Theme | CustomTheme; //主题信息,可以是CustomTheme或从onWillApplyTheme中获取的Theme实例。
themeColorMode?: ThemeColorMode; //设置深色浅色。
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface DialogOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left title ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹框标题 AST#type_member#Left actionCancel ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //点击操作按钮时,是否关闭弹窗。false表示不关闭弹窗。默认值:true。 AST#type_member#Left onAction ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ActionCallBack AST#primary_type#Right | AST#primary_type#Left ActionStrCallBack AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //按钮的CallBack事件。 AST#type_member#Left height ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Dimension AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗的高度;很多弹框都是自适应高度,谨慎设置该值。 AST#type_member#Left width ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Dimension AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗的宽度,弹窗宽度默认值:'calc(100% - 32vp)'、100%。 AST#type_member#Left maxHeight ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Dimension AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗高度默认最大值;很多弹框都是自适应高度,谨慎设置该值。 AST#type_member#Left maxWidth ? : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹窗宽度默认最大值:360vp。 AST#type_member#Left backgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹窗背板颜色。默认值:Color.White AST#type_member#Left backgroundBlurStyle ? : AST#type_annotation#Left AST#primary_type#Left BlurStyle AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //弹窗背板模糊材质。默认值:BlurStyle.COMPONENT_ULTRA_THICK AST#type_member#Left cornerRadius ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left BorderRadiuses AST#primary_type#Right | AST#primary_type#Left LocalizedBorderRadiuses AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置背板的圆角半径。可分别设置4个圆角的半径。 AST#type_member#Left borderWidth ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Dimension AST#primary_type#Right | AST#primary_type#Left EdgeWidths AST#primary_type#Right | AST#primary_type#Left LocalizedEdgeWidths AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //可分别设置4个边框宽度。默认值:0。 AST#type_member#Left borderColor ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left EdgeColors AST#primary_type#Right | AST#primary_type#Left LocalizedEdgeColors AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗背板的边框颜色。默认值:Color.Black。 AST#type_member#Left borderStyle ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left BorderStyle AST#primary_type#Right | AST#primary_type#Left EdgeStyles AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗背板的边框样式。默认值:BorderStyle.Solid。 AST#type_member#Left shadow ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ShadowOptions AST#primary_type#Right | AST#primary_type#Left ShadowStyle AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置弹窗背板的阴影。 AST#type_member#Left theme ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Theme AST#primary_type#Right | AST#primary_type#Left CustomTheme AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; //主题信息,可以是CustomTheme或从onWillApplyTheme中获取的Theme实例。 AST#type_member#Left themeColorMode ? : AST#type_annotation#Left AST#primary_type#Left ThemeColorMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //设置深色浅色。 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface DialogOptions extends BaseDialogOptions {
title?: ResourceStr;
actionCancel?: boolean;
onAction?: ActionCallBack | ActionStrCallBack;
height?: Dimension | Length;
width?: Dimension | Length;
maxHeight?: Dimension | Length;
maxWidth?: Length;
backgroundColor?: ResourceColor;
backgroundBlurStyle?: BlurStyle;
cornerRadius?: Length | BorderRadiuses | LocalizedBorderRadiuses;
borderWidth?: Dimension | EdgeWidths | LocalizedEdgeWidths;
borderColor?: ResourceColor | EdgeColors | LocalizedEdgeColors;
borderStyle?: BorderStyle | EdgeStyles;
shadow?: ShadowOptions | ShadowStyle;
theme?: Theme | CustomTheme;
themeColorMode?: ThemeColorMode;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/base/DialogOptions.ets#L25-L43
|
f8c645e4859a2e159efe791f84034eff529b6e49
|
gitee
|
|
openharmony-sig/ohos_axios
|
75d72897982ea6e10fa99c62c62a65425af0a568
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
defaultSetting
|
默认设置
|
defaultSetting() {
this.clear()
this.showUrl = this.postUrl
this.startTime = new Date().getTime();
axios.defaults.headers['customer-header'] = 'customer-value'
axios.defaults.method = 'post'
axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.postUrl,
data: {
id: 590
},
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBodyLength,
maxContentLength: this.maxContentLength
}).then((res: AxiosResponse<InfoModel>) => {
this.status = res.status;
this.message = JSON.stringify(res.data);
axios.defaults.method = '';
axios.defaults.headers['customer-header'] = null;
this.endTime = new Date().getTime();
}).catch((err: AxiosError) => {
this.status = '';
this.message = err.message;
axios.defaults.method = '';
axios.defaults.headers['customer-header'] = null
this.endTime = new Date().getTime();
})
}
|
AST#method_declaration#Left defaultSetting AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showUrl AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postUrl AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'customer-header' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#ERROR#Left = AST#ERROR#Right AST#expression_statement#Left AST#expression#Left 'customer-value' AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . method AST#member_expression#Right = AST#expression#Left 'post' AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left axios AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left InfoModel AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left InfoModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left IdModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postUrl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 590 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . connectTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . readTimeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxBodyLength AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxBodyLength AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxContentLength AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . maxContentLength AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left InfoModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . status AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . method AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'customer-header' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left AxiosError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . status AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . method AST#member_expression#Right = AST#expression#Left '' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left axios AST#expression#Right . defaults AST#member_expression#Right AST#expression#Right . headers AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'customer-header' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . endTime AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
defaultSetting() {
this.clear()
this.showUrl = this.postUrl
this.startTime = new Date().getTime();
axios.defaults.headers['customer-header'] = 'customer-value'
axios.defaults.method = 'post'
axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({
url: this.postUrl,
data: {
id: 590
},
connectTimeout: this.connectTimeout,
readTimeout: this.readTimeout,
maxBodyLength: this.maxBodyLength,
maxContentLength: this.maxContentLength
}).then((res: AxiosResponse<InfoModel>) => {
this.status = res.status;
this.message = JSON.stringify(res.data);
axios.defaults.method = '';
axios.defaults.headers['customer-header'] = null;
this.endTime = new Date().getTime();
}).catch((err: AxiosError) => {
this.status = '';
this.message = err.message;
axios.defaults.method = '';
axios.defaults.headers['customer-header'] = null
this.endTime = new Date().getTime();
})
}
|
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L556-L585
|
00c4f65714361e2ea3c427056f125bb8b8201aa5
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets
|
arkts
|
closeDialog
|
关闭弹窗
|
closeDialog(): void {
logger.info('Start to close dialog.');
if (this.isDialogShow && this.dialogController !== undefined) {
this.isDialogShow = false;
this.dialogController.close();
logger.info('Succeeded in closing dialog.');
}
}
|
AST#method_declaration#Left closeDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Start to close dialog.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDialogShow AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDialogShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Succeeded in closing dialog.' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
closeDialog(): void {
logger.info('Start to close dialog.');
if (this.isDialogShow && this.dialogController !== undefined) {
this.isDialogShow = false;
this.dialogController.close();
logger.info('Succeeded in closing dialog.');
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets#L51-L58
|
08ed636e37950947149f817916728e62feecb333
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets
|
arkts
|
Declare ButtonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare ButtonOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
export declare class ButtonOptions {
/**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
value: ResourceStr;
/**
* Sets the Button Callback.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the Button Callback.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
action?: () => void;
/**
* Sets the background color of a button.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the background color of a button.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
background?: ResourceColor;
/**
* Sets the Button Text Color.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Sets the Button Text Color.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
fontColor?: ResourceColor;
/**
* Describes the Button style.
* @type { ?ButtonStyleMode }
* @default ButtonStyleMode.TEXTUAL
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
buttonStyle?: ButtonStyleMode;
/**
* Describes the Button role.
* @type { ?ButtonRole }
* @default ButtonRole.NORMAL
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
role?: ButtonRole;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ButtonOptions AST#class_body#Left { /**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the Display Content of a Button.
* @type { ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the Button Callback.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the Button Callback.
* @type { ?() => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left action ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the background color of a button.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the background color of a button.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left background ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Sets the Button Text Color.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Sets the Button Text Color.
* @type { ?ResourceStr }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Describes the Button style.
* @type { ?ButtonStyleMode }
* @default ButtonStyleMode.TEXTUAL
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left buttonStyle ? : AST#type_annotation#Left AST#primary_type#Left ButtonStyleMode AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Describes the Button role.
* @type { ?ButtonRole }
* @default ButtonRole.NORMAL
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#property_declaration#Left role ? : AST#type_annotation#Left AST#primary_type#Left ButtonRole AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class ButtonOptions {
value: ResourceStr;
action?: () => void;
background?: ResourceColor;
fontColor?: ResourceColor;
buttonStyle?: ButtonStyleMode;
role?: ButtonRole;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Dialog.d.ets#L31-L108
|
c74e1887a94c5a5a659c437be6b599f97b747543
|
github
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/FileUtil.ets
|
arkts
|
listFile
|
列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Promise异步回调。
@param path string 文件夹的应用沙箱路径。
@param options 文件过滤选项。默认不进行过滤。
recursion boolean 是否递归子目录下文件名,默认为false。
listNum number 列出文件名数量。当设置0时,列出所有文件,默认为0。
filter Filter 文件过滤选项。当前仅支持后缀名匹配、文件名模糊查询、文件大小过滤、最近修改时间过滤。
@returns
|
static listFile(path: string, options?: ListFileOptions): Promise<string[]> {
return fs.listFile(path, options);
}
|
AST#method_declaration#Left static listFile AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left ListFileOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . listFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static listFile(path: string, options?: ListFileOptions): Promise<string[]> {
return fs.listFile(path, options);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L542-L544
|
2576ff245b10c290a88f4c758a19d5b7276f61c9
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/main/src/main/ets/view/CorePage.ets
|
arkts
|
CorePage
|
@file 核心页面视图
@author Joker.X
|
@ComponentV2
export struct CorePage {
/**
* 核心页面 ViewModel
*/
@Local
private vm: CoreViewModel = new CoreViewModel();
/**
* 窗口安全区状态
*/
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
/**
* 全局计数器状态
*/
@Local
private counterState: DemoCounterState = getDemoCounterState();
/**
* 构建核心页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: $r("app.string.core"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.CoreContent();
}
}
/**
* 核心页面内容视图
* @returns {void} 无返回值
*/
@Builder
private CoreContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
if (this.counterState.count > 0) {
this.CounterCard();
SpaceVerticalLarge();
}
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (item: CoreCardItem, index: number) => {
IBestCell({
title: item.title,
label: item.description,
isLink: true,
leftContentWidth: P80,
hasBorder: index !== this.vm.cards.length - 1,
onCellClick: () => item.onClick()
});
}, (_item: CoreCardItem, index: number) => `${index}`);
};
};
};
}
/**
* 计数器卡片
* @returns {void} 无返回值
*/
@Builder
private CounterCard(): void {
Column() {
ColumnBase({ widthValue: P100 }) {
Text($r("app.string.main_core_counter_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceVerticalSmall();
Text(`${this.counterState.count}`)
.fontSize($r("app.float.display_large"))
.fontColor($r("app.color.text_primary"))
.fontWeight(FontWeight.Bold);
};
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CorePage AST#component_body#Left { /**
* 核心页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left CoreViewModel AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CoreViewModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 窗口安全区状态
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private windowSafeAreaState : AST#type_annotation#Left AST#primary_type#Left WindowSafeAreaState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getWindowSafeAreaState AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 全局计数器状态
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private counterState : AST#type_annotation#Left AST#primary_type#Left DemoCounterState AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getDemoCounterState AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 构建核心页面
* @returns {void} 无返回值
*/ AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.core" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . leftInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . rightInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CoreContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /**
* 核心页面内容视图
* @returns {void} 无返回值
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CoreContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MediumPaddingVerticalScroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . counterState AST#member_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . CounterCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpaceVerticalLarge ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left IBestCellGroup ( AST#component_parameters#Left { AST#component_parameter#Left inset : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left outerMargin : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cards AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CoreCardItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#ui_custom_component_statement#Left IBestCell ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . title AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left label : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . description AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isLink : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left leftContentWidth : AST#expression#Left P80 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . cards AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onCellClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left _item : AST#type_annotation#Left AST#primary_type#Left CoreCardItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left index AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right /**
* 计数器卡片
* @returns {void} 无返回值
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CounterCard AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_core_counter_label" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_subtitle" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . counterState AST#member_expression#Right AST#expression#Right . count AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.display_large" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_padding_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_white" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct CorePage {
@Local
private vm: CoreViewModel = new CoreViewModel();
@Local
private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState();
@Local
private counterState: DemoCounterState = getDemoCounterState();
build() {
AppNavDestination({
title: $r("app.string.core"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.CoreContent();
}
}
@Builder
private CoreContent() {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
if (this.counterState.count > 0) {
this.CounterCard();
SpaceVerticalLarge();
}
IBestCellGroup({ inset: true, outerMargin: 0 }) {
ForEach(this.vm.cards, (item: CoreCardItem, index: number) => {
IBestCell({
title: item.title,
label: item.description,
isLink: true,
leftContentWidth: P80,
hasBorder: index !== this.vm.cards.length - 1,
onCellClick: () => item.onClick()
});
}, (_item: CoreCardItem, index: number) => `${index}`);
};
};
};
}
@Builder
private CounterCard(): void {
Column() {
ColumnBase({ widthValue: P100 }) {
Text($r("app.string.main_core_counter_label"))
.fontSize($r("app.float.body_medium"))
.fontColor($r("app.color.text_subtitle"));
SpaceVerticalSmall();
Text(`${this.counterState.count}`)
.fontSize($r("app.float.display_large"))
.fontColor($r("app.color.text_primary"))
.fontWeight(FontWeight.Bold);
};
}
.width(P100)
.padding($r("app.float.space_padding_medium"))
.backgroundColor($r("app.color.bg_white"))
.borderRadius($r("app.float.radius_medium"));
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/CorePage.ets#L19-L109
|
b9df28c09a21fcf993acb1721940407701cf3ae4
|
github
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/common/utils/DeviceScreen.ets
|
arkts
|
getDeviceHeight
|
Get the screen height.
@returns screen height.
|
public static getDeviceHeight() {
let height = 0;
try {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (Const.DEVICE_DPI / screenDensityDPI);
} catch (err) {
Logger.error(TAG, `get device height failed, error = ${JSON.stringify(err)}`);
return height;
}
}
|
AST#method_declaration#Left public static getDeviceHeight AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left displayObject = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left screenPixelHeight = AST#expression#Left AST#member_expression#Left AST#expression#Left displayObject AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left screenDensityDPI = AST#expression#Left AST#member_expression#Left AST#expression#Left displayObject AST#expression#Right . densityDPI AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left screenPixelHeight AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Const AST#expression#Right . DEVICE_DPI AST#member_expression#Right AST#expression#Right / AST#expression#Left screenDensityDPI AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` get device height failed, error = AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left height AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
public static getDeviceHeight() {
let height = 0;
try {
let displayObject = display.getDefaultDisplaySync();
let screenPixelHeight = displayObject.height;
let screenDensityDPI = displayObject.densityDPI;
return screenPixelHeight * (Const.DEVICE_DPI / screenDensityDPI);
} catch (err) {
Logger.error(TAG, `get device height failed, error = ${JSON.stringify(err)}`);
return height;
}
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/common/utils/DeviceScreen.ets#L43-L56
|
2cb4c0a63356543ab8f40c06e87289d0d9427844
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
|
arkts
|
会话监听器
|
export class sessionListener {
/**
* 会话关闭事件回调。会话关闭时调用
*/
onClosed: () => void = () => {
};
/**
* 会话取消事件的回调。会话取消时调用
*/
onCanceled: () => void = () => {
};
}
|
AST#export_declaration#Left export AST#class_declaration#Left class sessionListener AST#class_body#Left { /**
* 会话关闭事件回调。会话关闭时调用
*/ AST#property_declaration#Left onClosed : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right /**
* 会话取消事件的回调。会话取消时调用
*/ AST#property_declaration#Left onCanceled : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class sessionListener {
onClosed: () => void = () => {
};
onCanceled: () => void = () => {
};
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L107-L118
|
7d8f8d01659c0a7b98ebd4b532b22a0192a4bf7c
|
gitee
|
|
openharmony/developtools_profiler
|
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
|
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets
|
arkts
|
default constructor for initialization in code
|
constructor() {
this.init();
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor() {
this.init();
}
|
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L170-L172
|
6bae5c88b695556fc275c6f02e48eddb590bab52
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/Card.ets
|
arkts
|
CompletedRoutableCard
|
Copyright (c) 2025 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.
|
@Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symbol)
.fontColor(['#fff'])
.fontSize(16)
}
.borderRadius(14)
Column({ space: 8 }) {
Text(this.title)
.fontColor($r('sys.color.font_primary'))
Text(this.description)
.fontColor($r('sys.color.font_secondary'))
.fontSize($r('sys.float.Body_S'))
}
.alignItems(HorizontalAlign.Start)
.layoutWeight(1)
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompletedRoutableCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right symbol : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.symbol.label' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Card ( AST#component_parameters#Left { AST#component_parameter#Left verticalAlign : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SymbolGlyph ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . symbol AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left '#fff' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.font_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . description AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.font_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.Body_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct CompletedRoutableCard {
@Prop
symbol: Resource = $r('sys.symbol.label');
@Prop
@Require
title: string;
@Prop
@Require
description: ResourceStr;
build() {
Card({ verticalAlign: VerticalAlign.Top }) {
Button({ type: ButtonType.Circle }) {
SymbolGlyph(this.symbol)
.fontColor(['#fff'])
.fontSize(16)
}
.borderRadius(14)
Column({ space: 8 }) {
Text(this.title)
.fontColor($r('sys.color.font_primary'))
Text(this.description)
.fontColor($r('sys.color.font_secondary'))
.fontSize($r('sys.float.Body_S'))
}
.alignItems(HorizontalAlign.Start)
.layoutWeight(1)
}
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/common/Card.ets#L16-L48
|
a0fa31cb6bd9cb8b12bd40446a2a1800db2a2ad0
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ContentRule.ets
|
arkts
|
正文处理规则
|
export class ContentRule {
content?: string
title?: string //有些网站只能在正文中获取标题
nextContentUrl?: string
webJs?: string
sourceRegex?: string
replaceRegex?: string //替换规则
imageStyle?: string //默认大小居中,FULL最大宽度
imageDecode?: string //图片bytes二次解密js, 返回解密后的bytes
payAction?: string //购买操作,js或者包含{{js}}的url
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ContentRule AST#class_body#Left { AST#property_declaration#Left content ? : AST#ERROR#Left string title ? : string //有些网站只能在正文中获取标题 nextContentUrl ? : string webJs ? : string sourceRegex ? : string replaceRegex ? : string //替换规则 imageStyle ? : string //默认大小居中,FULL最大宽度 imageDecode ? : string //图片bytes二次解密js, 返回解密后的bytes payAction ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right //购买操作,js或者包含{{js}}的url AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ContentRule {
content?: string
title?: string
nextContentUrl?: string
webJs?: string
sourceRegex?: string
replaceRegex?: string
imageStyle?: string
imageDecode?: string
payAction?: string
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/ContentRule.ets#L4-L14
|
959909d698011645dd567fb6a54c385ffc290c86
|
github
|
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
api/@ohos.file.PhotoPickerComponent.d.ets
|
arkts
|
MaxSelected
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12
|
export declare class MaxSelected {
/**
* data. support to set max_total_count, max_photo_count and max_video_count.
*
* @type { ?Map<MaxCountType, number> }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
data?: Map<MaxCountType, number>;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class MaxSelected AST#class_body#Left { /**
* data. support to set max_total_count, max_photo_count and max_video_count.
*
* @type { ?Map<MaxCountType, number> }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#Left data ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left MaxCountType AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class MaxSelected {
data?: Map<MaxCountType, number>;
}
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L725-L735
|
91cb350df45a823136928b9fd80270f258b93893
|
gitee
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.