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
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets
arkts
refreshUrl
如果url发生了变化,需要重新生成
async refreshUrl() { console.debug("share url changed") // 二维码建议最小大小为400,不然可能会扫描不出。 this.imageBarCode = await createBarcode(this.url, 400); if (this.imageBackground && this.imageBarCode) { this.generatedImage = mixPixels(this.imageBackground, this.imageBarCode); await saveImgToFile(this.generatedImage, this.imagePath) await this.createShareData() } }
AST#method_declaration#Left async refreshUrl 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 console AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "share url changed" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 二维码建议最小大小为400,不然可能会扫描不出。 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageBarCode AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left createBarcode 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 . url AST#member_expression#Right AST#expression#Right , AST#expression#Left 400 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#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 . imageBackground AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageBarCode AST#member_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 . generatedImage AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left mixPixels AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageBackground AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageBarCode 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left saveImgToFile 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 . generatedImage AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imagePath AST#member_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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . createShareData 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#builder_function_body#Right AST#method_declaration#Right
async refreshUrl() { console.debug("share url changed") this.imageBarCode = await createBarcode(this.url, 400); if (this.imageBackground && this.imageBarCode) { this.generatedImage = mixPixels(this.imageBackground, this.imageBarCode); await saveImgToFile(this.generatedImage, this.imagePath) await this.createShareData() } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sharebutton/src/main/ets/components/ShareButton.ets#L135-L144
673b2816238690ba1a1bfdadeca607fa08828197
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/viewmodel/NavigationViewModel.ets
arkts
@file 导航页面 ViewModel @author Joker.X
@ObservedV2 export default class NavigationViewModel extends BaseViewModel { /** * 结果回传标题 */ @Trace resultTitle: string = ""; /** * 结果回传说明 */ @Trace resultDescription: string = ""; /** * 是否存在结果回传 */ @Trace hasResult: boolean = false; /** * 导航模块卡片数据 */ @Trace readonly cards: NavigationCardItem[] = [ { title: $r("app.string.main_navigation_with_args_title"), description: $r("app.string.main_navigation_with_args_desc"), onClick: () => DemoNavigator.toNavigationWithArgs(10001, $r("app.string.main_navigation_goods_name")) }, { title: $r("app.string.main_navigation_result_title"), description: $r("app.string.main_navigation_result_desc"), onClick: (): void => this.requestNavigationResult() }, { title: $r("app.string.main_navigation_intercept_title"), description: $r("app.string.main_navigation_intercept_desc"), onClick: () => UserNavigator.toProfile() } ]; /** * 发起结果回传跳转 * @returns {void} 无返回值 */ requestNavigationResult(): void { DemoNavigator.toNavigationResult() .then((result?: DemoResult): void => { const title: string = result?.title?.trim() ?? ""; const description: string = result?.description?.trim() ?? ""; if (title.length === 0 && description.length === 0) { this.clearResult(); return; } this.resultTitle = title; this.resultDescription = description; this.hasResult = true; }); } /** * 清空回传结果 * @returns {void} 无返回值 */ private clearResult(): void { this.resultTitle = ""; this.resultDescription = ""; this.hasResult = false; } /** * 是否展示结果区域 * @returns {boolean} 是否展示 */ shouldShowResult(): boolean { return this.hasResultTitle() || this.hasResultDesc(); } /** * 是否存在结果标题 * @returns {boolean} 是否存在 */ hasResultTitle(): boolean { return this.resultTitle.length > 0; } /** * 是否存在结果说明 * @returns {boolean} 是否存在 */ hasResultDesc(): boolean { return this.resultDescription.length > 0; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class NavigationViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 结果回传标题 */ AST#property_declaration#Left AST#decorator#Left @ Trace AST#decorator#Right resultTitle : 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 @ Trace AST#decorator#Right resultDescription : 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 @ Trace AST#decorator#Right hasResult : 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 @ Trace AST#decorator#Right readonly cards : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left NavigationCardItem [ ] 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 title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_with_args_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_with_args_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : 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 DemoNavigator AST#expression#Right . toNavigationWithArgs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10001 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_goods_name" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#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 title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_result_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_result_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : AST#expression#Left AST#arrow_function#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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . requestNavigationResult 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#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 title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_intercept_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left description AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.main_navigation_intercept_desc" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onClick AST#property_name#Right : 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 UserNavigator AST#expression#Right . toProfile 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 发起结果回传跳转 * @returns {void} 无返回值 */ AST#method_declaration#Left requestNavigationResult 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DemoNavigator AST#expression#Right . toNavigationResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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 result ? : AST#type_annotation#Left AST#primary_type#Left DemoResult 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 title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = 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 result 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#expression#Left "" 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 const AST#variable_declarator#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = 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 result AST#expression#Right ?. description 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#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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left title 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 description AST#expression#Right AST#binary_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#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 . clearResult 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#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 . resultTitle 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 . resultDescription AST#member_expression#Right = AST#expression#Left description 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 . hasResult 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 清空回传结果 * @returns {void} 无返回值 */ AST#method_declaration#Left private clearResult 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resultTitle 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 . resultDescription 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 . hasResult 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#builder_function_body#Right AST#method_declaration#Right /** * 是否展示结果区域 * @returns {boolean} 是否展示 */ AST#method_declaration#Left shouldShowResult 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#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 this AST#expression#Right . hasResultTitle 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 this AST#expression#Right AST#binary_expression#Right AST#expression#Right . hasResultDesc 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 /** * 是否存在结果标题 * @returns {boolean} 是否存在 */ AST#method_declaration#Left hasResultTitle 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resultTitle 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 是否存在结果说明 * @returns {boolean} 是否存在 */ AST#method_declaration#Left hasResultDesc 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resultDescription 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#decorated_export_declaration#Right
@ObservedV2 export default class NavigationViewModel extends BaseViewModel { @Trace resultTitle: string = ""; @Trace resultDescription: string = ""; @Trace hasResult: boolean = false; @Trace readonly cards: NavigationCardItem[] = [ { title: $r("app.string.main_navigation_with_args_title"), description: $r("app.string.main_navigation_with_args_desc"), onClick: () => DemoNavigator.toNavigationWithArgs(10001, $r("app.string.main_navigation_goods_name")) }, { title: $r("app.string.main_navigation_result_title"), description: $r("app.string.main_navigation_result_desc"), onClick: (): void => this.requestNavigationResult() }, { title: $r("app.string.main_navigation_intercept_title"), description: $r("app.string.main_navigation_intercept_desc"), onClick: () => UserNavigator.toProfile() } ]; requestNavigationResult(): void { DemoNavigator.toNavigationResult() .then((result?: DemoResult): void => { const title: string = result?.title?.trim() ?? ""; const description: string = result?.description?.trim() ?? ""; if (title.length === 0 && description.length === 0) { this.clearResult(); return; } this.resultTitle = title; this.resultDescription = description; this.hasResult = true; }); } private clearResult(): void { this.resultTitle = ""; this.resultDescription = ""; this.hasResult = false; } shouldShowResult(): boolean { return this.hasResultTitle() || this.hasResultDesc(); } hasResultTitle(): boolean { return this.resultTitle.length > 0; } hasResultDesc(): boolean { return this.resultDescription.length > 0; } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/NavigationViewModel.ets#L9-L100
9e8ede355e6cd1fada5ac24b0cb3c3d61a2742b4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
clearUpApplicationData
清理应用本身的数据,同时撤销应用向用户申请的权限。使用Promise异步回调。仅支持主线程调用。
static async clearUpApplicationData(): Promise<void> { return AppUtil.getContext().getApplicationContext().clearUpApplicationData(); }
AST#method_declaration#Left static async clearUpApplicationData 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#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#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 . getApplicationContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . clearUpApplicationData 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 async clearUpApplicationData(): Promise<void> { return AppUtil.getContext().getApplicationContext().clearUpApplicationData(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L210-L212
8f5cecee9bfd736c2f6bef107e779d5eb6bb39dd
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
setDrawBarShadow
If set to true, a grey area is drawn behind each bar that indicates the maximum value. Enabling his will reduce performance by about 50%. @param enabled
public setDrawBarShadow(enabled: boolean): void { this.mDrawBarShadow = enabled; }
AST#method_declaration#Left public setDrawBarShadow AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawBarShadow AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setDrawBarShadow(enabled: boolean): void { this.mDrawBarShadow = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L222-L224
06b573b2d1a6a66791c7e8baeb703187572af9dd
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.MultiNavigation.d.ets
arkts
Splitpolicy indicates the policy of pages pushed to the stack. @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 14
export declare enum SplitPolicy { /** * Indicates that the page will be pushed to the stack as home page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ HOME_PAGE = 0, /** * Indicates that the page will be pushed to the stack as detail page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ DETAIL_PAGE = 1, /** * Indicates that the page will be pushed to the stack as full-screen page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ FULL_PAGE = 2, }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum SplitPolicy AST#enum_body#Left { /** * Indicates that the page will be pushed to the stack as home page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#enum_member#Left HOME_PAGE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , /** * Indicates that the page will be pushed to the stack as detail page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#enum_member#Left DETAIL_PAGE = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , /** * Indicates that the page will be pushed to the stack as full-screen page. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 14 */ AST#enum_member#Left FULL_PAGE = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export declare enum SplitPolicy { HOME_PAGE = 0, DETAIL_PAGE = 1, FULL_PAGE = 2, }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.MultiNavigation.d.ets#L32-L62
a135347c85d61c45353feacb3ce39927e7169364
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderConfirmPage.ets
arkts
DiscountPriceValue
折扣价格值(负数显示) @param {number} price 价格(单位:分) @returns {void} 无返回值
@Builder private DiscountPriceValue(price: number) { IBestPrice({ value: -price, integerFontSize: 14, decimalFontSize: 12, symbolFontSize: 12, color: $r("app.color.danger") }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private DiscountPriceValue AST#parameter_list#Left ( AST#parameter#Left price : 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#builder_function_body#Left { AST#ui_custom_component_statement#Left IBestPrice ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#unary_expression#Left - AST#expression#Left price AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left integerFontSize : AST#expression#Left 14 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left decimalFontSize : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left symbolFontSize : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left color : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.danger" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private DiscountPriceValue(price: number) { IBestPrice({ value: -price, integerFontSize: 14, decimalFontSize: 12, symbolFontSize: 12, color: $r("app.color.danger") }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderConfirmPage.ets#L215-L224
1e08ba048603022eb6a8ba31d405755cfac4959f
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
ToastIconBuilder
Toast带图标弹窗view
@Builder export function ToastIconBuilder(options: IToastIconOptions) { ToastIconView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToastIconBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IToastIconOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left ToastIconView ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left options AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function ToastIconBuilder(options: IToastIconOptions) { ToastIconView({ options: options }); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L293-L296
8c166b6e0f3885aecab982095f36134b0f200b73
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/lazyForEach.d.ets
arkts
declare UILazyForEachAttribute @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export interface UILazyForEachAttribute {}
AST#export_declaration#Left export AST#interface_declaration#Left interface UILazyForEachAttribute AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface UILazyForEachAttribute {}
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L632-L632
83e402f4637b9086e5640bfc9834c6fe61969ec6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
strToHex
16进制字符串转换unit8Array @param hexStr @returns
static strToHex(hexStr: string): Uint8Array { return new Uint8Array(buffer.from(hexStr, 'hex').buffer); }
AST#method_declaration#Left static strToHex AST#parameter_list#Left ( AST#parameter#Left hexStr : 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 Uint8Array 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 Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hexStr AST#expression#Right , AST#expression#Left 'hex' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . buffer AST#member_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 strToHex(hexStr: string): Uint8Array { return new Uint8Array(buffer.from(hexStr, 'hex').buffer); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L265-L267
d4791ace2b4b7f0c0b6b92bf971d8eb1792ba866
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/textInput/TextInputController.ets
arkts
文本绘制控制器
export class TextInputController { private touchDownInfo?: TouchDownInfo; private color: string = '#DB2904'; private controller: TextEditNodeController; private currentParentScale: number = 1; private nodeContainerHeight: number = 1; private nodeContainerWidth: number = 1; private onAddTextArea: (data: TextInputData) => void; // 记录父容器旋转角度,用于在新添加文本节点时施加个对等逆向旋转角度抵消父容器旋转角度,使新添加的文本节点始终处于正向位置 private totalAngle: number = 0; constructor(controller: TextEditNodeController, onAddTextArea: (data: TextInputData) => void) { this.controller = controller; this.onAddTextArea = onAddTextArea; } onTouch(event: TouchEvent): void { if (event) { if (event.type === TouchType.Down) { let needAddData: boolean = !!event.touches[0]; if (needAddData && this.controller.canAddTextInputNode()) { this.touchDownInfo = { x: event.touches[0].x, y: event.touches[0].y, timestamp: event.timestamp, uniqueId: getMd5(JSON.stringify(event.touches[0])) }; } else { this.touchDownInfo = undefined; } } else if (this.touchDownInfo) { if (event.touches[0]) { let dx = event.touches[0].x - this.touchDownInfo.x; let dy = event.touches[0].y - this.touchDownInfo.y; let deltaMax = Math.max(Math.abs(dx), Math.abs(dy)); if (deltaMax > IGNORE_TOUCH_SLOT) { this.touchDownInfo = undefined; } else if (event.type === TouchType.Up || event.type === TouchType.Cancel) { // 纳秒转换到毫秒 if ((event.timestamp - this.touchDownInfo.timestamp) / MILLI_SECOND_TO_NANO_SECOND < TOUCH_DOWN_TIMEOUT) { this.onAddTextInputData(this.touchDownInfo); } else { this.touchDownInfo = undefined; } } } } } } private onAddTextInputData(touchDownInfo: TouchDownInfo): void { let xDistance = `${100 * (touchDownInfo.x - TEXT_BOX_WIDTH / 2) / this.nodeContainerWidth}%`; let yDistance = `${100 * (touchDownInfo.y - TEXT_BOX_HEIGHT / 2) / this.nodeContainerHeight}%`; let pos: Position = { x: xDistance, y: yDistance }; let textInfo: TextInputData = new TextInputData(`TextInput_${touchDownInfo.uniqueId}`, pos, this.color); textInfo.parentScale = this.currentParentScale; textInfo.baseScale = 1; textInfo.scaleOpt = { x: 1 / this.currentParentScale, y: 1 / this.currentParentScale }; textInfo.parentWidth = this.nodeContainerWidth; textInfo.parentHeight = this.nodeContainerHeight; textInfo.center = { x: touchDownInfo.x, y: touchDownInfo.y }; // 施加父容器旋转角度的反方向角度确保新加的文本框始终处于正向水平位置 textInfo.angle = -this.totalAngle; textInfo.onRemove = (uniqueId: number) => { textInfo.onRemove = undefined; this.controller.removeTextNode(uniqueId); }; textInfo.onClick = (data: TextInputData) => { // 激活态收到点击事件拉起文本输入组件 if (data.isActivated()) { this.onAddTextArea(data); } else { // 非激活态先兜底设置其他文本框为非激活态,再设置当前为激活态 this.controller.hideAllTextNodeEdge(); data.setActivated(true); } }; this.controller.addTextInputNode(textInfo); } setSelectedColor(color: string): void { this.color = color; this.controller.modifyTopTextColor(color); } setContainerSize(width: number, height: number): void { this.nodeContainerHeight = height; this.nodeContainerWidth = width; } refreshScale(scale: number) { this.currentParentScale = scale; this.controller.refreshTextScale(scale); } onRotate(angle: number) { this.totalAngle = (this.totalAngle + angle) % 360; } }
AST#export_declaration#Left export AST#class_declaration#Left class TextInputController AST#class_body#Left { AST#property_declaration#Left private touchDownInfo ? : AST#type_annotation#Left AST#primary_type#Left TouchDownInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#DB2904' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller : AST#type_annotation#Left AST#primary_type#Left TextEditNodeController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private currentParentScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private nodeContainerHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private nodeContainerWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private onAddTextArea : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TextInputData 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#property_declaration#Right // 记录父容器旋转角度,用于在新添加文本节点时施加个对等逆向旋转角度抵消父容器旋转角度,使新添加的文本节点始终处于正向位置 AST#property_declaration#Left private totalAngle : 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#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left TextEditNodeController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onAddTextArea : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TextInputData 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#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 . controller AST#member_expression#Right = AST#expression#Left controller 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 . onAddTextArea AST#member_expression#Right = AST#expression#Left onAddTextArea 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 onTouch AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent 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 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Down AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left needAddData : AST#type_annotation#Left AST#primary_type#Left boolean 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 AST#unary_expression#Left ! AST#expression#Left AST#unary_expression#Left ! AST#expression#Left event AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . touches AST#member_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#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 needAddData AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . canAddTextInputNode 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . touchDownInfo AST#member_expression#Right = 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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . 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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timestamp AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uniqueId AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left getMd5 AST#expression#Right AST#argument_list#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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right 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#property_assignment#Right } AST#object_literal#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 this AST#expression#Right . touchDownInfo AST#member_expression#Right = AST#expression#Left undefined 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 else AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . touchDownInfo AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dx = 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . touchDownInfo AST#member_expression#Right AST#expression#Right . x 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 dy = 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . touches AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . touchDownInfo AST#member_expression#Right AST#expression#Right . y 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 deltaMax = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . max 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 Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dx AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left dy 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left deltaMax AST#expression#Right > AST#expression#Left IGNORE_TOUCH_SLOT 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 . touchDownInfo AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Up AST#member_expression#Right AST#expression#Right || AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left TouchType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Cancel AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 纳秒转换到毫秒 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_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 event AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . touchDownInfo AST#member_expression#Right AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left MILLI_SECOND_TO_NANO_SECOND AST#expression#Right AST#binary_expression#Right AST#expression#Right < AST#expression#Left TOUCH_DOWN_TIMEOUT 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 . onAddTextInputData 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 . touchDownInfo 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 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 this AST#expression#Right . touchDownInfo AST#member_expression#Right = AST#expression#Left undefined 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#if_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#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 AST#method_declaration#Left private onAddTextInputData AST#parameter_list#Left ( AST#parameter#Left touchDownInfo : AST#type_annotation#Left AST#primary_type#Left TouchDownInfo 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 let AST#variable_declarator#Left xDistance = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#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 100 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 touchDownInfo AST#expression#Right . x AST#member_expression#Right AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left TEXT_BOX_WIDTH AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right 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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . nodeContainerWidth 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 let AST#variable_declarator#Left yDistance = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#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 100 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 touchDownInfo AST#expression#Right . y AST#member_expression#Right AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left TEXT_BOX_HEIGHT AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right 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#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . nodeContainerHeight 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 let AST#variable_declarator#Left pos : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left xDistance AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left yDistance 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 textInfo : AST#type_annotation#Left AST#primary_type#Left TextInputData 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 TextInputData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` TextInput_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left touchDownInfo AST#expression#Right . uniqueId AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left pos AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . color 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left textInfo AST#expression#Right . parentScale AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentParentScale 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 textInfo AST#expression#Right . baseScale 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left textInfo AST#expression#Right . scaleOpt AST#member_expression#Right = 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 AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentParentScale 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 AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentParentScale AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_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 textInfo AST#expression#Right . parentWidth AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodeContainerWidth 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 textInfo AST#expression#Right . parentHeight AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . nodeContainerHeight 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 textInfo AST#expression#Right . center AST#member_expression#Right = 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 touchDownInfo AST#expression#Right . 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 touchDownInfo AST#expression#Right . y AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_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 textInfo AST#expression#Right . angle 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 . totalAngle 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 textInfo AST#expression#Right . onRemove AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left uniqueId : 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 textInfo AST#expression#Right . onRemove AST#member_expression#Right = AST#expression#Left undefined 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 . controller AST#member_expression#Right AST#expression#Right . removeTextNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uniqueId 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#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 textInfo AST#expression#Right . onClick AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TextInputData 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 data AST#expression#Right . isActivated 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onAddTextArea 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 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . hideAllTextNodeEdge 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 data AST#expression#Right . setActivated 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 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#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 . controller AST#member_expression#Right AST#expression#Right . addTextInputNode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left textInfo 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 setSelectedColor AST#parameter_list#Left ( AST#parameter#Left color : 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . color AST#member_expression#Right = AST#expression#Left color 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 . controller AST#member_expression#Right AST#expression#Right . modifyTopTextColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color 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 setContainerSize AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : 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#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 . nodeContainerHeight AST#member_expression#Right = AST#expression#Left height 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 . nodeContainerWidth AST#member_expression#Right = AST#expression#Left width AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left refreshScale AST#parameter_list#Left ( AST#parameter#Left scale : 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#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 . currentParentScale AST#member_expression#Right = AST#expression#Left scale 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 . controller AST#member_expression#Right AST#expression#Right . refreshTextScale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left scale 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 onRotate AST#parameter_list#Left ( AST#parameter#Left angle : 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#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 . totalAngle AST#member_expression#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 this AST#expression#Right . totalAngle AST#member_expression#Right AST#expression#Right + AST#expression#Left angle AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 360 AST#expression#Right AST#binary_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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TextInputController { private touchDownInfo?: TouchDownInfo; private color: string = '#DB2904'; private controller: TextEditNodeController; private currentParentScale: number = 1; private nodeContainerHeight: number = 1; private nodeContainerWidth: number = 1; private onAddTextArea: (data: TextInputData) => void; private totalAngle: number = 0; constructor(controller: TextEditNodeController, onAddTextArea: (data: TextInputData) => void) { this.controller = controller; this.onAddTextArea = onAddTextArea; } onTouch(event: TouchEvent): void { if (event) { if (event.type === TouchType.Down) { let needAddData: boolean = !!event.touches[0]; if (needAddData && this.controller.canAddTextInputNode()) { this.touchDownInfo = { x: event.touches[0].x, y: event.touches[0].y, timestamp: event.timestamp, uniqueId: getMd5(JSON.stringify(event.touches[0])) }; } else { this.touchDownInfo = undefined; } } else if (this.touchDownInfo) { if (event.touches[0]) { let dx = event.touches[0].x - this.touchDownInfo.x; let dy = event.touches[0].y - this.touchDownInfo.y; let deltaMax = Math.max(Math.abs(dx), Math.abs(dy)); if (deltaMax > IGNORE_TOUCH_SLOT) { this.touchDownInfo = undefined; } else if (event.type === TouchType.Up || event.type === TouchType.Cancel) { if ((event.timestamp - this.touchDownInfo.timestamp) / MILLI_SECOND_TO_NANO_SECOND < TOUCH_DOWN_TIMEOUT) { this.onAddTextInputData(this.touchDownInfo); } else { this.touchDownInfo = undefined; } } } } } } private onAddTextInputData(touchDownInfo: TouchDownInfo): void { let xDistance = `${100 * (touchDownInfo.x - TEXT_BOX_WIDTH / 2) / this.nodeContainerWidth}%`; let yDistance = `${100 * (touchDownInfo.y - TEXT_BOX_HEIGHT / 2) / this.nodeContainerHeight}%`; let pos: Position = { x: xDistance, y: yDistance }; let textInfo: TextInputData = new TextInputData(`TextInput_${touchDownInfo.uniqueId}`, pos, this.color); textInfo.parentScale = this.currentParentScale; textInfo.baseScale = 1; textInfo.scaleOpt = { x: 1 / this.currentParentScale, y: 1 / this.currentParentScale }; textInfo.parentWidth = this.nodeContainerWidth; textInfo.parentHeight = this.nodeContainerHeight; textInfo.center = { x: touchDownInfo.x, y: touchDownInfo.y }; textInfo.angle = -this.totalAngle; textInfo.onRemove = (uniqueId: number) => { textInfo.onRemove = undefined; this.controller.removeTextNode(uniqueId); }; textInfo.onClick = (data: TextInputData) => { if (data.isActivated()) { this.onAddTextArea(data); } else { this.controller.hideAllTextNodeEdge(); data.setActivated(true); } }; this.controller.addTextInputNode(textInfo); } setSelectedColor(color: string): void { this.color = color; this.controller.modifyTopTextColor(color); } setContainerSize(width: number, height: number): void { this.nodeContainerHeight = height; this.nodeContainerWidth = width; } refreshScale(scale: number) { this.currentParentScale = scale; this.controller.refreshTextScale(scale); } onRotate(angle: number) { this.totalAngle = (this.totalAngle + angle) % 360; } }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/textInput/TextInputController.ets#L51-L152
a09aad96d3fb093146c1a34bde783ee330c54a91
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语要求接口
export interface GreetingRequirements { length: number; includeEmoji: boolean; language: string; tone: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingRequirements AST#object_type#Left { AST#type_member#Left length : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left includeEmoji : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tone : 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 GreetingRequirements { length: number; includeEmoji: boolean; language: string; tone: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L21-L26
30bee4f91effb17871ce12fdd9e3b1a7872f7419
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/ReadMessageRequest.ets
arkts
@file 已读消息请求模型 @author Joker.X
export class ReadMessageRequest { /** * 消息ID数组,用于批量已读 */ ids: number[]; /** * @param {ReadMessageRequest} init - 初始化数据 */ constructor(init: ReadMessageRequest) { this.ids = init.ids; } }
AST#export_declaration#Left export AST#class_declaration#Left class ReadMessageRequest AST#class_body#Left { /** * 消息ID数组,用于批量已读 */ AST#property_declaration#Left ids : 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#property_declaration#Right /** * @param {ReadMessageRequest} init - 初始化数据 */ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left ReadMessageRequest 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 . ids AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left init AST#expression#Right . ids 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#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ReadMessageRequest { ids: number[]; constructor(init: ReadMessageRequest) { this.ids = init.ids; } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/ReadMessageRequest.ets#L5-L17
70a32bc65a48a6bb4bb452b6df626bd0655aab0c
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/path_sensitive/conditional_stmt/conditional_switch_001_T.ets
arkts
Introduction 路径敏感-区分switch Level 3
export function conditional_switch_001_T(taint_src : string) { let data = "" let n = 2; switch (n) { case 2: data = taint_src break } taint.Sink(data) }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_switch_001_T 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 data = AST#expression#Left "" 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 n = AST#expression#Left 2 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 switch 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#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 case AST#property_name#Right AST#ERROR#Left 2 AST#ERROR#Right : AST#expression#Left AST#assignment_expression#Left data = AST#expression#Left taint_src AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#property_assignment#Right AST#ERROR#Left break AST#ERROR#Right } AST#object_literal#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 taint AST#expression#Right . Sink 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#function_declaration#Right AST#export_declaration#Right
export function conditional_switch_001_T(taint_src : string) { let data = "" let n = 2; switch (n) { case 2: data = taint_src break } taint.Sink(data) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/conditional_stmt/conditional_switch_001_T.ets#L7-L16
e140d83b27cbb96aab59cabfd5ab2dfed2d1851d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
省市区类型枚举
export enum AddressType { Province = 0, City = 1, Region = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum AddressType AST#enum_body#Left { AST#enum_member#Left Province = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left City = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left Region = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum AddressType { Province = 0, City = 1, Region = 2 }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L75-L79
ceba90c194644b7d1e9aa5cfe0d1395dc9a76688
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AppUtils.ets
arkts
getContext
获取上下文,common.UIAbilityContext @returns
static getContext(): common.UIAbilityContext { if (!AppUtils.context) { AppUtils.context = getContext() as common.UIAbilityContext; //兜底 LogUtils.error('AppUtils', "context为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!") } return AppUtils.context }
AST#method_declaration#Left static getContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left AppUtils AST#expression#Right AST#unary_expression#Right AST#expression#Right . context AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AppUtils AST#expression#Right . context AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 LogUtils AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AppUtils' AST#expression#Right , AST#expression#Left "context为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!" 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#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtils AST#expression#Right . context AST#member_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static getContext(): common.UIAbilityContext { if (!AppUtils.context) { AppUtils.context = getContext() as common.UIAbilityContext; LogUtils.error('AppUtils', "context为空,请在UIAbility的onWindowStageCreate方法中调用AppUtils的init方法初始化!") } return AppUtils.context }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L29-L35
dc33959ba02501bda7af51a9482684d786532a9e
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
stateEffect
Sets whether or not to display the press status effect. @param { boolean } stateEffect - press status effect. @returns { ToolBarModifier } returns the instance of the ToolBarModifier. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13
stateEffect(stateEffect: boolean): ToolBarModifier;
AST#method_declaration#Left stateEffect AST#parameter_list#Left ( AST#parameter#Left stateEffect : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ToolBarModifier AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
stateEffect(stateEffect: boolean): ToolBarModifier;
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L271-L271
0b6a55d4c8b73dcca5dacf98e1153e8426994eda
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取用户梦想统计数据 @param userId 用户ID @returns 梦想统计数据
export function getDreamStats(userId: number): Promise<DreamStats> { try { // 从后端API获取数据,API返回的是ApiResponse<DreamStats>格式 return request<ApiResponse<DreamStats>>(RequestMethod.GET, `/dreams/user/${userId}/stats`) .then(response => { // 处理ApiResponse,提取data字段并返回 if (response && response.data) { console.info(`成功获取梦想统计: ${JSON.stringify(response.data)}`); return response.data; } // 如果响应没有data字段,抛出错误 throw new Error('获取梦想统计数据失败: 响应格式错误'); }); } catch (error) { console.error(`获取梦想统计数据失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`获取梦想统计数据失败: ${error instanceof Error ? error.message : String(error)}`); } }
AST#export_declaration#Left export AST#function_declaration#Left function getDreamStats AST#parameter_list#Left ( AST#parameter#Left userId : 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DreamStats 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 { // 从后端API获取数据,API返回的是ApiResponse<DreamStats>格式 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 request AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DreamStats 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left RequestMethod AST#expression#Right . GET AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` /dreams/user/ AST#template_substitution#Left $ { AST#expression#Left userId AST#expression#Right } AST#template_substitution#Right /stats ` AST#template_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 response => AST#block_statement#Left { // 处理ApiResponse,提取data字段并返回 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 response AST#expression#Right && AST#expression#Left response AST#expression#Right AST#binary_expression#Right AST#expression#Right . data 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 ` 成功获取梦想统计: 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 AST#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_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#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#member_expression#Left AST#expression#Left response AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 如果响应没有data字段,抛出错误 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#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#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#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#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 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#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#function_declaration#Right AST#export_declaration#Right
export function getDreamStats(userId: number): Promise<DreamStats> { try { return request<ApiResponse<DreamStats>>(RequestMethod.GET, `/dreams/user/${userId}/stats`) .then(response => { if (response && response.data) { console.info(`成功获取梦想统计: ${JSON.stringify(response.data)}`); return response.data; } throw new Error('获取梦想统计数据失败: 响应格式错误'); }); } catch (error) { console.error(`获取梦想统计数据失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`获取梦想统计数据失败: ${error instanceof Error ? error.message : String(error)}`); } }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L355-L372
8cbb643f360f293c4525f2eab589b3707cfcb9bc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
addData
改变单个数据 @param {number} index - 索引值 @param {PanelDataType} data - 修改后的值
public addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#method_declaration#Left public addData 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 data : AST#type_annotation#Left AST#primary_type#Left PanelDataType 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 . dataArray AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left data 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 . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index 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 addData(index: number, data: PanelDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottompanelslide/src/main/ets/model/DataSource.ets#L213-L216
af5c37b66b23cf24041a5b90b64afffcbaced65e
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets
arkts
createWantAgentForStartAbility
create wantAgent for start ability @param bundleName @param abilityName @return return the created WantAgent object.
async createWantAgentForStartAbility(bundleName: string, abilityName: string) { let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: bundleName, abilityName: abilityName } ], operationType: ohosWantAgent.OperationType.START_ABILITY, requestCode: REQUEST_CODE // requestCode是WantAgentInfo的请求码,是使用者定义的一个私有值 } return await wantAgent.getWantAgent(wantAgentInfo); }
AST#method_declaration#Left async createWantAgentForStartAbility AST#parameter_list#Left ( AST#parameter#Left bundleName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left abilityName : 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 wantAgentInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left wantAgent . WantAgentInfo 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 wants AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bundleName AST#property_name#Right : AST#expression#Left bundleName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left abilityName AST#property_name#Right : AST#expression#Left abilityName AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left operationType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ohosWantAgent AST#expression#Right . OperationType AST#member_expression#Right AST#expression#Right . START_ABILITY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left requestCode AST#property_name#Right : AST#expression#Left REQUEST_CODE AST#expression#Right AST#property_assignment#Right // requestCode是WantAgentInfo的请求码,是使用者定义的一个私有值 } AST#object_literal#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#await_expression#Left await AST#expression#Left wantAgent AST#expression#Right AST#await_expression#Right AST#expression#Right . getWantAgent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left wantAgentInfo 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 createWantAgentForStartAbility(bundleName: string, abilityName: string) { let wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: bundleName, abilityName: abilityName } ], operationType: ohosWantAgent.OperationType.START_ABILITY, requestCode: REQUEST_CODE } return await wantAgent.getWantAgent(wantAgentInfo); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/WantAgentUtil.ets#L28-L40
a7bb83069c95c90e49b756006ce78cbd9a19771c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets
arkts
自定义动效tab控制器,控制自定义动效Tab组件进行页签切换
export class CustomAnimationTabController extends SwiperController { // 状态监听器 private listener: (state: number) => void = (state: number) => {}; public changeTabIndex(index: number, useAnimation?: boolean) { this.listener(1); super.changeIndex(index, useAnimation); } public setListener(func: (state: number) => void) { this.listener = func; } }
AST#export_declaration#Left export AST#class_declaration#Left class CustomAnimationTabController extends AST#type_annotation#Left AST#primary_type#Left SwiperController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 状态监听器 AST#property_declaration#Left private listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left state : 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#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left state : 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left public changeTabIndex 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 useAnimation ? : AST#type_annotation#Left AST#primary_type#Left boolean 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 . listener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 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 super AST#expression#Right . changeIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left useAnimation 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 public setListener AST#parameter_list#Left ( AST#parameter#Left func : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left state : 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#function_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 this AST#expression#Right . listener AST#member_expression#Right = AST#expression#Left func AST#expression#Right AST#assignment_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 CustomAnimationTabController extends SwiperController { private listener: (state: number) => void = (state: number) => {}; public changeTabIndex(index: number, useAnimation?: boolean) { this.listener(1); super.changeIndex(index, useAnimation); } public setListener(func: (state: number) => void) { this.listener = func; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/CustomAniamtionTabController.ets#L20-L32
52c31795dbb8a70938179be6e982ec4038a5184a
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/beans/Account.ets
arkts
导出一个名为 Account 的类,该类用于表示记账应用中的一笔记账信息
export default class Account { // 记账ID id: number = -1; // 记账类型,0 表示支出,1 表示收入 accountType: number = 0; // 类型文本,用于描述记账类型 typeText: string = ''; // 金额,表示记账的金额 amount: number = 0; // 日期,表示收入或支出发生的日期,默认为当前日期 date: Date = new Date(); // 描述,用于记录收入或支出的详细信息 desc: string = ''; // 构造函数,用于创建 Account 类的实例 constructor( accountType: number = 0, // 初始化记账类型,默认为支出 typeText: string = '', // 初始化类型文本,默认为空字符串 amount: number = 0, // 初始化金额,默认为0 date: Date = new Date(), // 初始化日期,默认为当前日期 desc: string = '' // 初始化描述,默认为空字符串 ) { // 将传入的参数赋值给实例的各个属性 this.accountType = accountType; this.typeText = typeText; this.amount = amount; this.date = date; this.desc = desc; } }
AST#export_declaration#Left export default AST#class_declaration#Left class Account AST#class_body#Left { // 记账ID AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right // 记账类型,0 表示支出,1 表示收入 AST#property_declaration#Left accountType : 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#property_declaration#Left typeText : 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 amount : 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#property_declaration#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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 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 ; AST#property_declaration#Right // 描述,用于记录收入或支出的详细信息 AST#property_declaration#Left desc : 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 // 构造函数,用于创建 Account 类的实例 AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left accountType : 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#parameter#Right , // 初始化记账类型,默认为支出 AST#parameter#Left typeText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , // 初始化类型文本,默认为空字符串 AST#parameter#Left amount : 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#parameter#Right , // 初始化金额,默认为0 AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date 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 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 AST#parameter#Right , // 初始化日期,默认为当前日期 AST#parameter#Left desc : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#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 . accountType AST#member_expression#Right = AST#expression#Left accountType 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 . typeText AST#member_expression#Right = AST#expression#Left typeText 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 . amount AST#member_expression#Right = AST#expression#Left amount 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 . date AST#member_expression#Right = AST#expression#Left date 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 . desc AST#member_expression#Right = AST#expression#Left desc 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 default class Account { id: number = -1; accountType: number = 0; typeText: string = ''; amount: number = 0; date: Date = new Date(); desc: string = ''; constructor( accountType: number = 0, typeText: string = '', amount: number = 0, date: Date = new Date(), desc: string = '' ) { this.accountType = accountType; this.typeText = typeText; this.amount = amount; this.date = date; this.desc = desc; } }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/beans/Account.ets#L2-L36
39cf806c37ee8c1121dd036e5d786eedad7b03ba
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/utils/PhotoHelperPage.ets
arkts
saveButton
安全控件保存,图片保存进相册。
saveButton() { let uri = FileUtil.getUriFromPath(this.filePath); PhotoHelper.applyChanges(uri).then((result) => { this.uriStr = `保存图片成功:${result.uri}`; }).catch((err: BusinessError) => { this.uriStr = `保存图片失败:${JSON.stringify(err)}`; }); }
AST#method_declaration#Left saveButton AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left uri = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtil AST#expression#Right . getUriFromPath 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 . filePath 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 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 PhotoHelper AST#expression#Right . applyChanges AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri 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 result 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 . uriStr AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` 保存图片成功: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . uri AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` 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 . 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 . uriStr AST#member_expression#Right = 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 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#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#method_declaration#Right
saveButton() { let uri = FileUtil.getUriFromPath(this.filePath); PhotoHelper.applyChanges(uri).then((result) => { this.uriStr = `保存图片成功:${result.uri}`; }).catch((err: BusinessError) => { this.uriStr = `保存图片失败:${JSON.stringify(err)}`; }); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/utils/PhotoHelperPage.ets#L189-L196
69d9354f0360283a6a43bd583059a29ba772289f
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/DB/relationDB.ets
arkts
getDatas
根据谓词指定的查询条件查找数据
async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) { let predicates = new relationalStore.RdbPredicates(tableName); predicates.equalTo(key, val); if (store != undefined) { return new Promise((resolve, reject) => { (store as relationalStore.RdbStore).query(predicates, atomArr, (err, resultSet) => { if (err) { console.error(`Failed to query data. Code:${err.code}, message:${err.message}`); reject(err); return; } resolve(resultSet); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); }) }) } }
AST#method_declaration#Left async getDatas AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left atomArr : 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#parameter#Right , 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 val : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left predicates = 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 relationalStore AST#expression#Right AST#new_expression#Right AST#expression#Right . RdbPredicates AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tableName 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 predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left val 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 store 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left store AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore 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 . query AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left atomArr AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left resultSet AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left err 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 ` Failed to query data. Code: 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: 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 reject 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#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 resolve AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet 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 ` ResultSet column names: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . columnNames AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , column count: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left resultSet AST#expression#Right . columnCount 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 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getDatas(tableName: string, atomArr: Array<string>, key: string, val: string | number) { let predicates = new relationalStore.RdbPredicates(tableName); predicates.equalTo(key, val); if (store != undefined) { return new Promise((resolve, reject) => { (store as relationalStore.RdbStore).query(predicates, atomArr, (err, resultSet) => { if (err) { console.error(`Failed to query data. Code:${err.code}, message:${err.message}`); reject(err); return; } resolve(resultSet); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`); }) }) } }
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/DB/relationDB.ets#L78-L94
77abecfbc0357fdbeec5572e40ef523957cca613
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
getPaymentMethodText
获取支付方式文案 @returns {ResourceStr} 支付方式文案
private getPaymentMethodText(order: Order): ResourceStr { switch (order.payType) { case 1: return $r("app.string.pay_method_wechat"); case 2: return $r("app.string.pay_method_alipay"); default: return $r("app.string.unpaid"); } }
AST#method_declaration#Left private getPaymentMethodText AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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 AST#member_expression#Left AST#expression#Left order AST#expression#Right . payType AST#member_expression#Right 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 1 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.pay_method_wechat" AST#expression#Right ) AST#resource_expression#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 2 AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.pay_method_alipay" AST#expression#Right ) AST#resource_expression#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 : return AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.unpaid" AST#expression#Right ) AST#resource_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#builder_function_body#Right AST#method_declaration#Right
private getPaymentMethodText(order: Order): ResourceStr { switch (order.payType) { case 1: return $r("app.string.pay_method_wechat"); case 2: return $r("app.string.pay_method_alipay"); default: return $r("app.string.unpaid"); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L481-L490
e3889f87ebe674e73b23e446c3d69af059303ca4
github
ericple/ohos-weather
f197791bce462c5eb1b22945c25f5bcd5fcc9f7c
libNMC/src/main/ets/Data/City.ets
arkts
This file is part of libNMC, which is the foundation of ohos-weather. Copyright (C) 2023 Tingjin<dev@peercat.cn> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
export interface City{ name: string; id: string; lat: string, lon: string, adm2: string; adm1: string; country: string; tz: string; utcOffset: string; isDst: string; type: string; rank: string; fxLink: string; isCurrentLocation?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface City AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left lat : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left lon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , AST#type_member#Left adm2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left adm1 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tz : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left utcOffset : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isDst : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rank : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left fxLink : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isCurrentLocation ? : AST#type_annotation#Left AST#primary_type#Left boolean 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 City{ name: string; id: string; lat: string, lon: string, adm2: string; adm1: string; country: string; tz: string; utcOffset: string; isDst: string; type: string; rank: string; fxLink: string; isCurrentLocation?: boolean; }
https://github.com/ericple/ohos-weather/blob/f197791bce462c5eb1b22945c25f5bcd5fcc9f7c/libNMC/src/main/ets/Data/City.ets#L16-L31
56390391ad2b39c2f6498cca4b92e64c3ea8d1b5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/social/CommunityPage.ets
arkts
buildTabBar
构建标签栏
@Builder buildTabBar() { Row() { ForEach(this.tabs, (tab, index: number) => { Column({ space: 4 }) { Stack() { Image($r(`app.media.ic_${tab.icon}`)) .width(20) .height(20) .fillColor(this.selectedTab === index ? $r('app.color.primary') : $r('app.color.text_secondary')) // 消息红点 if (tab.id === 'notifications' && this.getUnreadCount() > 0) { Circle({ width: 8, height: 8 }) .fill('#FF3030') .position({ x: 12, y: -2 }) } } Text(tab.name) .fontSize(10) .fontColor(this.selectedTab === index ? $r('app.color.primary') : $r('app.color.text_secondary')) .fontWeight(this.selectedTab === index ? FontWeight.Medium : FontWeight.Normal) } .layoutWeight(1) .height(56) .justifyContent(FlexAlign.Center) .onClick(() => { this.selectedTab = index; if (index === 0) this.loadPosts(); else if (index === 1) this.loadTopics(); else if (index === 2) this.loadEvents(); else if (index === 3) this.loadNotifications(); }) }) } .width('100%') .backgroundColor(Color.White) .borderRadius({ bottomLeft: 0, bottomRight: 0 }) .shadow({ radius: 2, color: Color.Black, offsetX: 0, offsetY: 1 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBar 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 Row ( ) 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 . tabs AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left tab 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 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 Stack ( ) 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 AST#template_literal#Left ` app.media.ic_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left tab AST#expression#Right . icon AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( 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 . selectedTab AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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#ui_control_flow#Left AST#ui_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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tab AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left 'notifications' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . getUnreadCount 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#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 8 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( AST#expression#Left '#FF3030' AST#expression#Right ) AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 2 AST#expression#Right AST#unary_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#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#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 tab AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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 . selectedTab AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left 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 . selectedTab AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 56 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#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 . selectedTab AST#member_expression#Right = AST#expression#Left index 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#binary_expression#Left AST#expression#Left index 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadPosts 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 else AST#if_statement#Left if ( 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#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 . loadTopics 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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right 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 this AST#expression#Right . loadEvents 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 else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left 3 AST#expression#Right AST#binary_expression#Right 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 this AST#expression#Right . loadNotifications 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#if_statement#Right AST#if_statement#Right AST#if_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#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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' 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 AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right 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 2 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 . Black AST#member_expression#Right 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 1 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#builder_function_body#Right AST#method_declaration#Right
@Builder buildTabBar() { Row() { ForEach(this.tabs, (tab, index: number) => { Column({ space: 4 }) { Stack() { Image($r(`app.media.ic_${tab.icon}`)) .width(20) .height(20) .fillColor(this.selectedTab === index ? $r('app.color.primary') : $r('app.color.text_secondary')) if (tab.id === 'notifications' && this.getUnreadCount() > 0) { Circle({ width: 8, height: 8 }) .fill('#FF3030') .position({ x: 12, y: -2 }) } } Text(tab.name) .fontSize(10) .fontColor(this.selectedTab === index ? $r('app.color.primary') : $r('app.color.text_secondary')) .fontWeight(this.selectedTab === index ? FontWeight.Medium : FontWeight.Normal) } .layoutWeight(1) .height(56) .justifyContent(FlexAlign.Center) .onClick(() => { this.selectedTab = index; if (index === 0) this.loadPosts(); else if (index === 1) this.loadTopics(); else if (index === 2) this.loadEvents(); else if (index === 3) this.loadNotifications(); }) }) } .width('100%') .backgroundColor(Color.White) .borderRadius({ bottomLeft: 0, bottomRight: 0 }) .shadow({ radius: 2, color: Color.Black, offsetX: 0, offsetY: 1 }) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/social/CommunityPage.ets#L129-L174
ce058c3bba1ca7d7d5b1704ed50ff6e9abd680eb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/Index.ets
arkts
ImageFitType
utils
export { ImageFitType,ConstrainOffsetAndAnimationType,getMaxAllowedOffset,getImgSize,constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain'
AST#export_declaration#Left export { ImageFitType , ConstrainOffsetAndAnimationType , getMaxAllowedOffset , getImgSize , constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain' AST#export_declaration#Right
export { ImageFitType,ConstrainOffsetAndAnimationType,getMaxAllowedOffset,getImgSize,constrainOffsetAndAnimation } from './src/main/ets/utils/Constrain'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/Index.ets#L22-L22
8e633bf45040094dd9b84d44cfbbfe5c435220fa
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/Index.ets
arkts
buildQuickActionItem
构建快捷操作项
@Builder buildQuickActionItem(title: string, icon: Resource, onClick: () => void) { Column({ space: 8 }) { Image(icon) .width(32) .height(32) .objectFit(ImageFit.Contain) Text(title) .fontSize(12) .fontColor('#666666') .textAlign(TextAlign.Center) } .width(60) .padding(8) .borderRadius(8) .backgroundColor('#f8f9fa') .onClick(onClick) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQuickActionItem 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#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onClick : 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#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#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 Image ( AST#expression#Left icon AST#expression#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 . 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#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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 60 AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f8f9fa' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left onClick 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 buildQuickActionItem(title: string, icon: Resource, onClick: () => void) { Column({ space: 8 }) { Image(icon) .width(32) .height(32) .objectFit(ImageFit.Contain) Text(title) .fontSize(12) .fontColor('#666666') .textAlign(TextAlign.Center) } .width(60) .padding(8) .borderRadius(8) .backgroundColor('#f8f9fa') .onClick(onClick) }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/Index.ets#L384-L402
e316fa7d327198fa4875bf3cef6e7dc118734eb8
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/SavePhotoUtils.ets
arkts
savePixelMapToAlbum
将 PixelMap 保存到系统相册 @param context 上下文对象 @param pixel PixelMap 对象 @param format 保存格式 (默认 'jpeg')
static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') { if (!pixel) return console.error('❌ pixelMap 为空'); try { const context = getAppContext() const helper = photoAccessHelper.getPhotoAccessHelper(context); const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, format); const file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); const packer = image.createImagePacker(); const packOpts: image.PackingOption = { format: `image/${format}`, quality: 98 }; await new Promise<void>((resolve, reject) => { packer.packToFile(pixel, file.fd, packOpts, (err: BusinessError) => { if (err) reject(err); else resolve(); }); }); packer.release(() => {}); fileIo.close(file.fd); console.log('✅ 图片已保存到相册') } catch (err) { const error = err as BusinessError; console.error(`❌ 保存 PixelMap 出错: code=${error.code}, message=${error.message}`); } }
AST#method_declaration#Left static async savePixelMapToAlbum AST#parameter_list#Left ( AST#parameter#Left pixel : 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#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format AST#ERROR#Left : 'jpeg' | 'png' AST#ERROR#Right = AST#expression#Left 'png' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left pixel AST#expression#Right AST#unary_expression#Right AST#expression#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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '❌ pixelMap 为空' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#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#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getAppContext 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 helper = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . getPhotoAccessHelper AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 uri = 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 helper AST#expression#Right AST#await_expression#Right AST#expression#Right . createAsset 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 photoAccessHelper AST#expression#Right . PhotoType AST#member_expression#Right AST#expression#Right . IMAGE AST#member_expression#Right AST#expression#Right , AST#expression#Left format 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 file = 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 fileIo AST#expression#Right AST#await_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#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#member_expression#Left AST#expression#Left fileIo AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE AST#member_expression#Right AST#expression#Right | AST#expression#Left fileIo AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE 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#variable_declaration#Left const AST#variable_declarator#Left packer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImagePacker 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 packOpts : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PackingOption 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 format AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` image/ AST#template_substitution#Left $ { AST#expression#Left format 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 quality AST#property_name#Right : AST#expression#Left 98 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#await_expression#Left await AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#await_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#Left reject 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 packer AST#expression#Right . packToFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixel AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left packOpts 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 err AST#expression#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 err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right else 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#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#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 packer AST#expression#Right . release 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#expression#Left AST#object_literal#Left { } AST#object_literal#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileIo AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd 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 console AST#expression#Right . log 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#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left error = AST#expression#Left AST#as_expression#Left AST#expression#Left err 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 ` ❌ 保存 PixelMap 出错: code= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error 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
static async savePixelMapToAlbum(pixel: image.PixelMap | null | undefined, format: 'jpeg' | 'png' = 'png') { if (!pixel) return console.error('❌ pixelMap 为空'); try { const context = getAppContext() const helper = photoAccessHelper.getPhotoAccessHelper(context); const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, format); const file = await fileIo.open(uri, fileIo.OpenMode.READ_WRITE | fileIo.OpenMode.CREATE); const packer = image.createImagePacker(); const packOpts: image.PackingOption = { format: `image/${format}`, quality: 98 }; await new Promise<void>((resolve, reject) => { packer.packToFile(pixel, file.fd, packOpts, (err: BusinessError) => { if (err) reject(err); else resolve(); }); }); packer.release(() => {}); fileIo.close(file.fd); console.log('✅ 图片已保存到相册') } catch (err) { const error = err as BusinessError; console.error(`❌ 保存 PixelMap 出错: code=${error.code}, message=${error.message}`); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/SavePhotoUtils.ets#L22-L46
c71458b78fee4fc74816878b3d6b0cc67a2af2d8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/SpecSelectModal.ets
arkts
构建规格选择弹窗 @returns {void} 无返回值
build() { BottomModal({ visible: this.visible, title: $r("app.string.modal_select_spec"), onDismiss: this.onDismiss, content: (): void => this.ModalContentNetWorkLayout() }); }
AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_custom_component_statement#Left BottomModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . visible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.modal_select_spec" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onDismiss AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#arrow_function#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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ModalContentNetWorkLayout 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#build_body#Right AST#build_method#Right
build() { BottomModal({ visible: this.visible, title: $r("app.string.modal_select_spec"), onDismiss: this.onDismiss, content: (): void => this.ModalContentNetWorkLayout() }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/SpecSelectModal.ets#L103-L110
a468c0794c282ad78d9666559427304219fc0bac
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/model/KeyboardController.ets
arkts
sendKeyFunction
发送功能键
public sendKeyFunction(): void { this.addLog('sendKeyFunction') if (this.mTextInputClient && this.mEditorAttribute) { this.mTextInputClient.sendKeyFunction(this.mEditorAttribute.enterKeyType); } else { this.addLog('sendKeyFunction this.mTextInputClient is undefined'); } }
AST#method_declaration#Left public sendKeyFunction 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 . addLog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sendKeyFunction' 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mTextInputClient AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . mEditorAttribute 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 . mTextInputClient AST#member_expression#Right AST#expression#Right . sendKeyFunction 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 . mEditorAttribute AST#member_expression#Right AST#expression#Right . enterKeyType AST#member_expression#Right 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 this AST#expression#Right . addLog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sendKeyFunction this.mTextInputClient is undefined' 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
public sendKeyFunction(): void { this.addLog('sendKeyFunction') if (this.mTextInputClient && this.mEditorAttribute) { this.mTextInputClient.sendKeyFunction(this.mEditorAttribute.enterKeyType); } else { this.addLog('sendKeyFunction this.mTextInputClient is undefined'); } }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/KeyboardController.ets#L117-L124
ecae78f176a44522d6701bf90da252dac5ae3807
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/NavigationService.ets
arkts
获取当前导航栈实例 @returns {NavPathStack | undefined} 导航栈实例;未初始化时返回 undefined
export function getNavPathStack(): NavPathStack | undefined { if (!globalNavStack) { const msg: string = "[NavigationService] nav stack is not initialized, call setNavPathStack first."; hilog.error(DOMAIN, "NavSvc", msg); return undefined; } return globalNavStack; }
AST#export_declaration#Left export AST#function_declaration#Left function getNavPathStack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left NavPathStack AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left globalNavStack AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "[NavigationService] nav stack is not initialized, call setNavPathStack first." 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 DOMAIN AST#expression#Right , AST#expression#Left "NavSvc" AST#expression#Right , AST#expression#Left msg 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 undefined AST#expression#Right ; AST#return_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 globalNavStack AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function getNavPathStack(): NavPathStack | undefined { if (!globalNavStack) { const msg: string = "[NavigationService] nav stack is not initialized, call setNavPathStack first."; hilog.error(DOMAIN, "NavSvc", msg); return undefined; } return globalNavStack; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L36-L43
b3eff11bb7b6ade8aa329e39118be9a513e15e61
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets
arkts
bottomRightComponent
下部分右侧纵向滚动列表,用于展示车型信息
@Builder bottomRightComponent() { List({ scroller: this.bottomRightListScroller }) { // TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销 LazyForEach(this.dataSource, (item: ShowData, index: number) => { ListItemGroup({ header: this.rightFixedTitle(index) }) { this.bottomRightListItem(item); }; }, (item: ShowData, index: number) => item.sticky + index); } .onScrollFrameBegin((offset: number, state: ScrollState) => { // 下方左侧行标题列表与下方右侧列表的滚动偏移量保持一致 this.bottomLeftListScroller.scrollTo({ xOffset: 0, // 滚动偏移量为右下列表滚动控制器的当前偏移量+本次滚动的的偏移量 yOffset: this.bottomRightListScroller.currentOffset().yOffset + offset }); return { offsetRemain: offset }; }) .onDidScroll((scrollOffset: number, scrollState: ScrollState) => { // 行标题列表纵向滚动时,计算额外偏移量 let xOffset: number = this.topListScroller.currentOffset().xOffset - this.scrollerIndex * LIST_ITEM_WIDTH; this.showDataArray.forEach((showData: ShowData) => { showData.scrollerArray.forEach((scroller: Scroller) => { // 行标题列表纵向滚动时,下方右侧的每一行展示内容的索引号和横向偏移量保持一致 scroller.scrollToIndex(this.scrollerIndex, false, ScrollAlign.START, { extraOffset: LengthMetrics.vp(xOffset) }); }) }); }) .cachedCount(LIST_PRElOAD_NUMBER) // TODO:性能知识点: 列表较长,设置预加载数量减少性能消耗 .width(CALCULATED_SIZE) .height($r('app.string.vertical_horizontal_linkage_bottom_left_list_height_size')) .scrollBar(BarState.Off) .edgeEffect(EdgeEffect.None) // 将边缘滑动效果设置为无 .listDirection(Axis.Vertical) // 设置滚动方向为纵向滚动 .sticky(StickyStyle.Header) // 设置ListItemGroup标题的吸顶效果 .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bottomRightComponent 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 List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomRightListScroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO:性能知识点:数据量较大,使用了[LazyForEach](https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-rendering-control-lazyforeach-V5) 进行数据懒加载优化,以降低内存占用和渲染开销 AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource 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 ShowData 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 ListItemGroup ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rightFixedTitle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right ) AST#argument_list#Right AST#call_expression#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 . bottomRightListItem 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#expression_statement#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#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 ShowData 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . sticky AST#member_expression#Right AST#expression#Right + AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_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#modifier_chain_expression#Left . onScrollFrameBegin ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left ScrollState 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . bottomLeftListScroller AST#member_expression#Right AST#expression#Right . scrollTo 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 xOffset AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 滚动偏移量为右下列表滚动控制器的当前偏移量+本次滚动的的偏移量 AST#property_assignment#Left AST#property_name#Left yOffset AST#property_name#Right : AST#expression#Left AST#binary_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 . bottomRightListScroller AST#member_expression#Right AST#expression#Right . currentOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . yOffset AST#member_expression#Right AST#expression#Right + AST#expression#Left offset AST#expression#Right AST#binary_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 ; 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 offsetRemain AST#property_name#Right : AST#expression#Left offset 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDidScroll ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left scrollOffset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left scrollState : AST#type_annotation#Left AST#primary_type#Left ScrollState 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 xOffset : 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#member_expression#Left AST#expression#Left AST#binary_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 . topListScroller AST#member_expression#Right AST#expression#Right . currentOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . xOffset AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scrollerIndex AST#member_expression#Right AST#expression#Right * AST#expression#Left LIST_ITEM_WIDTH 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#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 . showDataArray AST#member_expression#Right 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 showData : AST#type_annotation#Left AST#primary_type#Left ShowData 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 AST#member_expression#Left AST#expression#Left showData AST#expression#Right . scrollerArray AST#member_expression#Right 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 scroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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 scroller AST#expression#Right . scrollToIndex 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 . scrollerIndex AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollAlign AST#expression#Right . START AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left extraOffset AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LengthMetrics AST#expression#Right . vp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left xOffset AST#expression#Right ) AST#argument_list#Right AST#call_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 ; 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#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#Left . cachedCount ( AST#expression#Left LIST_PRElOAD_NUMBER AST#expression#Right ) // TODO:性能知识点: 列表较长,设置预加载数量减少性能消耗 AST#modifier_chain_expression#Left . width ( AST#expression#Left CALCULATED_SIZE AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.vertical_horizontal_linkage_bottom_left_list_height_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) // 将边缘滑动效果设置为无 AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 设置滚动方向为纵向滚动 AST#modifier_chain_expression#Left . sticky ( AST#expression#Left AST#member_expression#Left AST#expression#Left StickyStyle AST#expression#Right . Header AST#member_expression#Right AST#expression#Right ) // 设置ListItemGroup标题的吸顶效果 AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . SYSTEM AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM 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#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#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 bottomRightComponent() { List({ scroller: this.bottomRightListScroller }) { LazyForEach(this.dataSource, (item: ShowData, index: number) => { ListItemGroup({ header: this.rightFixedTitle(index) }) { this.bottomRightListItem(item); }; }, (item: ShowData, index: number) => item.sticky + index); } .onScrollFrameBegin((offset: number, state: ScrollState) => { this.bottomLeftListScroller.scrollTo({ xOffset: 0, yOffset: this.bottomRightListScroller.currentOffset().yOffset + offset }); return { offsetRemain: offset }; }) .onDidScroll((scrollOffset: number, scrollState: ScrollState) => { let xOffset: number = this.topListScroller.currentOffset().xOffset - this.scrollerIndex * LIST_ITEM_WIDTH; this.showDataArray.forEach((showData: ShowData) => { showData.scrollerArray.forEach((scroller: Scroller) => { scroller.scrollToIndex(this.scrollerIndex, false, ScrollAlign.START, { extraOffset: LengthMetrics.vp(xOffset) }); }) }); }) .cachedCount(LIST_PRElOAD_NUMBER) .width(CALCULATED_SIZE) .height($r('app.string.vertical_horizontal_linkage_bottom_left_list_height_size')) .scrollBar(BarState.Off) .edgeEffect(EdgeEffect.None) .listDirection(Axis.Vertical) .sticky(StickyStyle.Header) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verticalhorizontallinkage/src/main/ets/view/VerticalAndHorizontalList.ets#L256-L294
de0a01bc524370656fde442b21231c9a989d8540
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/ToDoListArkTS/entry/src/main/ets/viewmodel/DataModel.ets
arkts
getData
Get the data.
getData(): Array<string> { return this.tasks; }
AST#method_declaration#Left getData 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#member_expression#Left AST#expression#Left this AST#expression#Right . tasks AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getData(): Array<string> { return this.tasks; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ToDoListArkTS/entry/src/main/ets/viewmodel/DataModel.ets#L30-L32
b8330fa539edbc4d25ee3e6ac2a75fca7e78ddf2
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/WindowManager.ets
arkts
immerseFullScreenSync
沉浸式全屏(全屏屏幕,且显示状态栏、导航栏) 同步方法:适合一次性定性设置沉浸式状态栏,不会动态调整。此方案大多数场景够用了,用户不会频繁显示|隐藏导航栏。 仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行
static immerseFullScreenSync(windowStage: window.WindowStage) { // 同步获取一个主窗口实例 let windowClass: window.Window = windowStage.getMainWindowSync() let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); let navBar = px2vp(area.bottomRect.height) area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); // 状态栏高度 const statusBar = px2vp(area.topRect.height) if (!navBar) { // 优先获取底部指示器导航栏高度,如果没有值得再尝试获取常规导航栏(鸿蒙5.0以下的传统底部三键导航栏)高度,两者显示是互斥的 navBar = px2vp(area.bottomRect.height) } // 将值保存到静态变量中,以便后续使用 WindowManager.statusBarHeight = statusBar WindowManager.navBarHeight = navBar // 设置窗口布局为沉浸式布局 windowClass.setWindowLayoutFullScreen(true) windowClass.setWindowSystemBarEnable(["status", "navigation"]) // 设置状态栏和导航栏的背景为透明 windowClass.setWindowSystemBarProperties({ navigationBarColor: "#00000000", statusBarColor: "#00000000", // navigationBarContentColor: "#FF000000", // statusBarContentColor: "#FF000000" }) }
AST#method_declaration#Left static immerseFullScreenSync AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage 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#variable_declaration#Left let AST#variable_declarator#Left windowClass : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . getMainWindowSync 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 area = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . getWindowAvoidArea 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 window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR 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#variable_declaration#Left let AST#variable_declarator#Left navBar AST#ERROR#Left = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left area AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right area AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . getWindowAvoidArea 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 window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM 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#variable_declaration#Left const AST#variable_declarator#Left statusBar = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left area AST#expression#Right . topRect AST#member_expression#Right AST#expression#Right . height 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left navBar AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 优先获取底部指示器导航栏高度,如果没有值得再尝试获取常规导航栏(鸿蒙5.0以下的传统底部三键导航栏)高度,两者显示是互斥的 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left navBar = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left area AST#expression#Right . bottomRect AST#member_expression#Right AST#expression#Right . height 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left WindowManager AST#expression#Right . statusBarHeight AST#member_expression#Right = AST#expression#Left statusBar 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 WindowManager AST#expression#Right . navBarHeight AST#member_expression#Right = AST#expression#Left navBar 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 windowClass AST#expression#Right . setWindowLayoutFullScreen 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 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . setWindowSystemBarEnable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left "status" AST#expression#Right , AST#expression#Left "navigation" AST#expression#Right ] 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . setWindowSystemBarProperties 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 navigationBarColor AST#property_name#Right : AST#expression#Left "#00000000" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left statusBarColor AST#property_name#Right : AST#expression#Left "#00000000" AST#expression#Right AST#property_assignment#Right , // navigationBarContentColor: "#FF000000", // statusBarContentColor: "#FF000000" } 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#method_declaration#Right
static immerseFullScreenSync(windowStage: window.WindowStage) { let windowClass: window.Window = windowStage.getMainWindowSync() let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); let navBar = px2vp(area.bottomRect.height) area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); const statusBar = px2vp(area.topRect.height) if (!navBar) { navBar = px2vp(area.bottomRect.height) } WindowManager.statusBarHeight = statusBar WindowManager.navBarHeight = navBar windowClass.setWindowLayoutFullScreen(true) windowClass.setWindowSystemBarEnable(["status", "navigation"]) windowClass.setWindowSystemBarProperties({ navigationBarColor: "#00000000", statusBarColor: "#00000000", }) }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/WindowManager.ets#L65-L92
f96073d5f4786765894a6408cbb4142955ec6085
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
onShadow
影子回调函数,由SDK自动调用 @param requestId 请求id @param shadow 影子
public onShadow(requestId: string, shadow: Shadow): void { }
AST#method_declaration#Left public onShadow AST#parameter_list#Left ( AST#parameter#Left requestId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left shadow : AST#type_annotation#Left AST#primary_type#Left Shadow 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
public onShadow(requestId: string, shadow: Shadow): void { }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L218-L220
064629f1b7a66f80ee0075c0e8a2e546b83409db
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/permission/PermissionUtils.ets
arkts
requestPermissionsEasy
申请权限,拒绝后并二次向用户申请授权 @param {Array<Permissions>} permissions 目标权限 @returns {Promise<boolean>} 是否已授权
private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> { try { // 第一次请求权限 let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions); let isGranted = request.authResults.every(status => status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED); if (isGranted) return true; // 二次请求权限 for (const permission of permissions) { if (!(await this.checkPermissionGrant(permission))) { const result = await this.atManager.requestPermissionOnSetting(this.context, [permission]); if (!result.every(status => status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED)) { return false; } } } return true; } catch (error) { throw this.wrapError(error, "申请权限失败"); } }
AST#method_declaration#Left private async requestPermissionsEasy AST#parameter_list#Left ( AST#parameter#Left permissions : 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 Permissions 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#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#try_statement#Left try AST#block_statement#Left { // 第一次请求权限 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left request : AST#type_annotation#Left AST#primary_type#Left PermissionRequestResult 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#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 . atManager AST#member_expression#Right AST#expression#Right . requestPermissionsFromUser 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#expression#Left permissions 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 isGranted = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left request AST#expression#Right . authResults AST#member_expression#Right AST#expression#Right . every AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left status => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left status AST#expression#Right === AST#expression#Left abilityAccessCtrl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_GRANTED AST#member_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#if_statement#Left if ( AST#expression#Left isGranted AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 二次请求权限 AST#statement#Left AST#for_statement#Left for ( const permission of AST#expression#Left permissions AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! 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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . checkPermissionGrant AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left permission AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { 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 . atManager AST#member_expression#Right AST#expression#Right . requestPermissionOnSetting 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#expression#Left AST#array_literal#Left [ AST#expression#Left permission 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left result AST#expression#Right AST#unary_expression#Right AST#expression#Right . every AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left status => AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left status AST#expression#Right === AST#expression#Left abilityAccessCtrl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GrantStatus AST#member_expression#Right AST#expression#Right . PERMISSION_GRANTED AST#member_expression#Right AST#expression#Right AST#arrow_function#Right 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#expression#Left AST#boolean_literal#Left false AST#boolean_literal#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#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#boolean_literal#Left true AST#boolean_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#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . wrapError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right , 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private async requestPermissionsEasy(permissions: Array<Permissions>): Promise<boolean> { try { let request: PermissionRequestResult = await this.atManager.requestPermissionsFromUser(this.context, permissions); let isGranted = request.authResults.every(status => status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED); if (isGranted) return true; for (const permission of permissions) { if (!(await this.checkPermissionGrant(permission))) { const result = await this.atManager.requestPermissionOnSetting(this.context, [permission]); if (!result.every(status => status === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED)) { return false; } } } return true; } catch (error) { throw this.wrapError(error, "申请权限失败"); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/permission/PermissionUtils.ets#L47-L67
cae06de4ca89e7108640454a3eb65658a73570dd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
关系统计接口
export interface RelationStats { family: number; friend: number; colleague: number; other: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RelationStats AST#object_type#Left { AST#type_member#Left family : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left friend : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left colleague : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left other : AST#type_annotation#Left AST#primary_type#Left number 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 RelationStats { family: number; friend: number; colleague: number; other: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L218-L223
fca68815484b84950b80d62fd0f0028c90b965a5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
solarToLunar
公历转农历 @param solarDate 公历日期(YYYY-MM-DD格式) @returns 农历日期信息
async solarToLunar(solarDate: string): Promise<LunarDate | null> { try { // 优先使用联网数据 if (this.useOnlineData) { const onlineLunar = await this.onlineLunarService.solarToLunarOnline(solarDate); if (onlineLunar) { // 转换为标准LunarDate格式 return { year: onlineLunar.lunarYear, month: onlineLunar.lunarMonth, day: onlineLunar.lunarDay, leapMonth: onlineLunar.isLeapMonth, yearName: onlineLunar.ganzhi, monthName: this.getMonthName(onlineLunar.lunarMonth, onlineLunar.isLeapMonth), dayName: this.getDayName(onlineLunar.lunarDay), zodiac: onlineLunar.zodiac, ganzhi: onlineLunar.ganzhi }; } } // 联网失败时使用本地计算 const lunarInfo = LunarUtils.solarToLunar(solarDate); return lunarInfo; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to convert solar to lunar: ${error}`); return null; } }
AST#method_declaration#Left async solarToLunar AST#parameter_list#Left ( AST#parameter#Left solarDate : 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 LunarDate 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#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 this AST#expression#Right . useOnlineData AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left onlineLunar = 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 . onlineLunarService AST#member_expression#Right AST#expression#Right . solarToLunarOnline AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left solarDate 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 onlineLunar AST#expression#Right ) AST#block_statement#Left { // 转换为标准LunarDate格式 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left year AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . lunarYear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . lunarMonth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left day AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . lunarDay AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left leapMonth AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . isLeapMonth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left yearName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . ganzhi AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left monthName AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMonthName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . lunarMonth AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . isLeapMonth AST#member_expression#Right 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 dayName AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getDayName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . lunarDay AST#member_expression#Right 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 zodiac AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . zodiac AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ganzhi AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left onlineLunar AST#expression#Right . ganzhi 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#if_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 lunarInfo = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LunarUtils AST#expression#Right . solarToLunar AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left solarDate 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 lunarInfo 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 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_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to convert solar to lunar: 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#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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async solarToLunar(solarDate: string): Promise<LunarDate | null> { try { if (this.useOnlineData) { const onlineLunar = await this.onlineLunarService.solarToLunarOnline(solarDate); if (onlineLunar) { return { year: onlineLunar.lunarYear, month: onlineLunar.lunarMonth, day: onlineLunar.lunarDay, leapMonth: onlineLunar.isLeapMonth, yearName: onlineLunar.ganzhi, monthName: this.getMonthName(onlineLunar.lunarMonth, onlineLunar.isLeapMonth), dayName: this.getDayName(onlineLunar.lunarDay), zodiac: onlineLunar.zodiac, ganzhi: onlineLunar.ganzhi }; } } const lunarInfo = LunarUtils.solarToLunar(solarDate); return lunarInfo; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to convert solar to lunar: ${error}`); return null; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L146-L174
8eea51d16ec92731df4ebd02a032151c24d588dd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
文本颜色接口
export interface TextColorConfig { primary: string; secondary: string; disabled: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TextColorConfig AST#object_type#Left { AST#type_member#Left primary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left secondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left disabled : 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 TextColorConfig { primary: string; secondary: string; disabled: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L215-L219
5ef2231843e7be9245636ddbf2e49006291b41a5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets
arkts
FloatingButton
[Start floating_button]
@Entry @Component export struct FloatingButton { @State private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; // [StartExclude floating_button] pathStack: NavPathStack = new NavPathStack(); resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } // [EndExclude floating_button] build() { // [StartExclude floating_button] NavDestination() { // [EndExclude floating_button] Stack() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ListItem() { Text(`${item}`) .width('100%') .height(100) .fontSize(16) .textAlign(TextAlign.Center) .borderRadius(10) .backgroundColor(0xFFFFFF) } }, (item: number) => item.toString()) } .id('List') .width('100%') .padding({ left: 15, right: 15 }) // [Start custom_button_function] Button() { Image($r('sys.media.ohos_ic_public_add')) .fillColor(0xffffff) .width(24) .height(24) } .id('Button') .width(40) .height(40) .position({ x: '80%', y: 570 }) .onClick(() => { // 需要执行的操作 // [StartExclude custom_button_function] this.arr.push(this.arr.length); // [EndExclude custom_button_function] }) // [End custom_button_function] } .width('100%') .height('100%') .backgroundColor(0xDCDCDC) .padding({ top: 6 }) } // [End floating_button] .backgroundColor('#f1f2f3') .title(this.resourceToString($r('app.string.FloatingButton_title'))) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FloatingButton AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private 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#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 6 AST#expression#Right , AST#expression#Left 7 AST#expression#Right , AST#expression#Left 8 AST#expression#Right , AST#expression#Left 9 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // [StartExclude floating_button] AST#property_declaration#Left pathStack : AST#type_annotation#Left AST#primary_type#Left NavPathStack 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 NavPathStack 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#method_declaration#Left resourceToString 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_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left 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 . resourceManager AST#member_expression#Right AST#expression#Right . getStringSync 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // [EndExclude floating_button] AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude floating_button] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { // [EndExclude floating_button] 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 List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left initialIndex : 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 this AST#expression#Right . arr 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 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 ListItem ( ) 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 item AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#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 . fontSize ( AST#expression#Left 16 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#Left . borderRadius ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF 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#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 AST#parameter_list#Left ( AST#parameter#Left item : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#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#modifier_chain_expression#Left . id ( AST#expression#Left 'List' AST#expression#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 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // [Start custom_button_function] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) 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 'sys.media.ohos_ic_public_add' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left 0xffffff AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 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 . id ( AST#expression#Left 'Button' AST#expression#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 . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left '80%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 570 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 { // 需要执行的操作 // [StartExclude custom_button_function] 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 . arr AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . arr AST#member_expression#Right 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 // [EndExclude custom_button_function] } 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 // [End custom_button_function] } 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 0xDCDCDC 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 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right // [End floating_button] AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . resourceToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.FloatingButton_title' AST#expression#Right ) AST#resource_expression#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#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Entry @Component export struct FloatingButton { @State private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; pathStack: NavPathStack = new NavPathStack(); resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } build() { NavDestination() { Stack() { List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item: number) => { ListItem() { Text(`${item}`) .width('100%') .height(100) .fontSize(16) .textAlign(TextAlign.Center) .borderRadius(10) .backgroundColor(0xFFFFFF) } }, (item: number) => item.toString()) } .id('List') .width('100%') .padding({ left: 15, right: 15 }) Button() { Image($r('sys.media.ohos_ic_public_add')) .fillColor(0xffffff) .width(24) .height(24) } .id('Button') .width(40) .height(40) .position({ x: '80%', y: 570 }) .onClick(() => { this.arr.push(this.arr.length); }) } .width('100%') .height('100%') .backgroundColor(0xDCDCDC) .padding({ top: 6 }) } .backgroundColor('#f1f2f3') .title(this.resourceToString($r('app.string.FloatingButton_title'))) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/FloatingButton.ets#L17-L82
3311442d52f6fa5da9eaf4da834baf82e24bbc24
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
选择文件保存位置
export async function getSaveFilePath(context: Context): Promise<string> { let selectedSaveFilePath: string = "" let documentSaveOptions = new picker.DocumentSaveOptions(); let documentPicker = new picker.DocumentViewPicker(context); await documentPicker.save(documentSaveOptions).then((result: Array<string>) => { selectedSaveFilePath = result[0] }) return selectedSaveFilePath }
AST#export_declaration#Left export AST#function_declaration#Left async function getSaveFilePath AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context 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#variable_declaration#Left let AST#variable_declarator#Left selectedSaveFilePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" 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 documentSaveOptions = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentSaveOptions 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 documentPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left documentPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . save AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left documentSaveOptions 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 result : 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#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left selectedSaveFilePath = AST#expression#Left AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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 AST#statement#Left AST#return_statement#Left return AST#expression#Left selectedSaveFilePath 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 getSaveFilePath(context: Context): Promise<string> { let selectedSaveFilePath: string = "" let documentSaveOptions = new picker.DocumentSaveOptions(); let documentPicker = new picker.DocumentViewPicker(context); await documentPicker.save(documentSaveOptions).then((result: Array<string>) => { selectedSaveFilePath = result[0] }) return selectedSaveFilePath }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L33-L41
3a71bd5b21a887f05470b9b7253556702482f7c6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets
arkts
totalCount
获取数据的长度
public totalCount(): number { return 0; }
AST#method_declaration#Left public totalCount 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 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public totalCount(): number { return 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/page/DataSource.ets#L29-L31
318fefefc4e50c71cec1d542f0c52ea6c8923b00
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
HomeModule/src/main/ets/viewmodel/HomeViewModel.ets
arkts
getQuestionList
获取首页列表数据
getQuestionList(params: QueryQuestionListParams) { return HttpUtils.get<{ total: number pageTotal: number rows: QuestionItemModel[] }>('question/list', params) }
AST#method_declaration#Left getQuestionList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left QueryQuestionListParams 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#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . get AST#member_expression#Right AST#expression#Right < AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left total AST#property_name#Right : AST#expression#Left number AST#expression#Right AST#property_assignment#Right AST#ERROR#Left pageTotal : AST#primary_type#Left AST#array_type#Left number AST#ERROR#Left rows : QuestionItemModel AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#ERROR#Right } AST#object_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left 'question/list' AST#expression#Right AST#ERROR#Left , params AST#ERROR#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#method_declaration#Right
getQuestionList(params: QueryQuestionListParams) { return HttpUtils.get<{ total: number pageTotal: number rows: QuestionItemModel[] }>('question/list', params) }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/viewmodel/HomeViewModel.ets#L20-L26
719a950b7c9ff6e0834383c19de5ab9408e4231e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/AnimationHelper.ets
arkts
transitionInUp
InUp动画 @param duration 动画时间 @returns
static transitionInUp(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 }) .combine(TransitionEffect.OPACITY.animation({ duration: duration })), TransitionEffect.OPACITY.animation({ duration: duration, curve: Curve.Linear }) .combine(TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4, delay: duration * 0.4, curve: Curve.Linear })) ); }
AST#method_declaration#Left static transitionInUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TransitionEffect 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 TransitionEffect AST#expression#Right . asymmetric 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#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 TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation 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 duration AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right * AST#expression#Left 0.4 AST#expression#Right AST#binary_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 . combine 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 TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation 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 duration AST#property_name#Right : AST#expression#Left duration 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#argument_list#Right AST#call_expression#Right AST#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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation 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 duration AST#property_name#Right : AST#expression#Left duration 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 . Linear 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 . combine 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . move AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEdge AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . animation 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 duration AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left duration AST#expression#Right * AST#expression#Left 0.4 AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left duration AST#expression#Right * AST#expression#Left 0.4 AST#expression#Right AST#binary_expression#Right 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 . Linear 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 ) 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 transitionInUp(duration: number = 300): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4 }) .combine(TransitionEffect.OPACITY.animation({ duration: duration })), TransitionEffect.OPACITY.animation({ duration: duration, curve: Curve.Linear }) .combine(TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration * 0.4, delay: duration * 0.4, curve: Curve.Linear })) ); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/AnimationHelper.ets#L30-L37
a2eadf27f31fc279dbbceca687242439be4e7d61
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/url.ets
arkts
_parse
==================== 核心解析方法 ====================
private _parse(input: string): void { // 1. 分离片段 const hashIndex = input.indexOf("#"); if (hashIndex !== -1) { this._hash = input.substring(hashIndex + 1); input = input.substring(0, hashIndex); } // 2. 分离查询部分 const queryIndex = input.indexOf("?"); if (queryIndex !== -1) { this._search = input.substring(queryIndex + 1); this._searchParams = new URLSearchParams(this._search); input = input.substring(0, queryIndex); } // 3. 分离协议 const schemeMatch = input.match(/^([a-z][a-z0-9+\-.]*):/i); if (schemeMatch) { this._scheme = schemeMatch[1].toLowerCase(); input = input.substring(schemeMatch[0].length); } // 4. 处理特殊协议的双斜杠 if (URL.SPECIAL_SCHEMES.has(this._scheme) && input.startsWith("//")) { input = input.substring(2); // 5. 解析授权部分 const authorityEnd = this._findAuthorityEnd(input); const authority = input.substring(0, authorityEnd); input = input.substring(authorityEnd); this._parseAuthority(authority); } // 6. 剩余部分为路径 this._pathname = input || "/"; // 7. 构建完整URL组件 this._buildComponents(); }
AST#method_declaration#Left private _parse AST#parameter_list#Left ( AST#parameter#Left input : 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 { // 1. 分离片段 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left hashIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . indexOf 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#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 hashIndex AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _hash AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hashIndex AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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 input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left hashIndex 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 // 2. 分离查询部分 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left queryIndex = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . indexOf 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#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 queryIndex AST#expression#Right !== AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _search AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left queryIndex AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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 this AST#expression#Right . _searchParams AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left URLSearchParams AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _search 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 input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left queryIndex 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 // 3. 分离协议 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left schemeMatch = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( / AST#ERROR#Right ^ AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left z AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left + AST#ERROR#Left \ AST#ERROR#Right - . ] * ) : AST#ERROR#Right / AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#subscript_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right 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#if_statement#Left if ( AST#expression#Left schemeMatch 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 . _scheme AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left schemeMatch AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . toLowerCase 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 input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left schemeMatch AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . length 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 // 4. 处理特殊协议的双斜杠 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#member_expression#Left AST#expression#Left URL AST#expression#Right . SPECIAL_SCHEMES AST#member_expression#Right AST#expression#Right . has 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 . _scheme AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left input AST#expression#Right AST#binary_expression#Right AST#expression#Right . startsWith 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 input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 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 // 5. 解析授权部分 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left authorityEnd = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _findAuthorityEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left input 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 authority = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left authorityEnd 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 input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left input AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left authorityEnd 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 this AST#expression#Right . _parseAuthority AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left authority 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 // 6. 剩余部分为路径 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 . _pathname AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left input AST#expression#Right || AST#expression#Left "/" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 7. 构建完整URL组件 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 . _buildComponents 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
private _parse(input: string): void { const hashIndex = input.indexOf("#"); if (hashIndex !== -1) { this._hash = input.substring(hashIndex + 1); input = input.substring(0, hashIndex); } const queryIndex = input.indexOf("?"); if (queryIndex !== -1) { this._search = input.substring(queryIndex + 1); this._searchParams = new URLSearchParams(this._search); input = input.substring(0, queryIndex); } const schemeMatch = input.match(/^([a-z][a-z0-9+\-.]*):/i); if (schemeMatch) { this._scheme = schemeMatch[1].toLowerCase(); input = input.substring(schemeMatch[0].length); } if (URL.SPECIAL_SCHEMES.has(this._scheme) && input.startsWith("//")) { input = input.substring(2); const authorityEnd = this._findAuthorityEnd(input); const authority = input.substring(0, authorityEnd); input = input.substring(authorityEnd); this._parseAuthority(authority); } this._pathname = input || "/"; this._buildComponents(); }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L324-L364
8145c3033f0798de1dc16af2c298d9e1f6645fc0
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/Base64Util.ets
arkts
decode
解码,通过输入参数解码后输出对应Uint8Array对象。 @param array @returns
static decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.decode(array, options); }
AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_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 util . Type 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 Uint8Array 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 const AST#variable_declarator#Left base64 = 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 . Base64Helper 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . decode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array 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 decode(array: Uint8Array | string, options?: util.Type): Promise<Uint8Array> { const base64 = new util.Base64Helper(); return base64.decode(array, options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/Base64Util.ets#L75-L78
d835b2432607b0ed4bbc2762b7f99c0ccf14ef3e
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/dateAndTime.ets
arkts
onAccept
Successfully built Dialog
onAccept() { LogUtil.info(MODULE_TAG + 'onAccept'); }
AST#method_declaration#Left onAccept 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 LogUtil 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 MODULE_TAG AST#expression#Right + AST#expression#Left 'onAccept' 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#builder_function_body#Right AST#method_declaration#Right
onAccept() { LogUtil.info(MODULE_TAG + 'onAccept'); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/dateAndTime.ets#L161-L163
955d0216acafb452ec7b4c600d54a86b51f63077
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets
arkts
notifyDataSetChanged
Lets the chart know its underlying data has changed and performs all necessary recalculations. It is crucial that this method is called everytime data is changed dynamically. Not calling this method can lead to crashes or unexpected behaviour.
public abstract notifyDataSetChanged();
AST#method_declaration#Left public abstract notifyDataSetChanged AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
public abstract notifyDataSetChanged();
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L283-L283
21c8e567f6e61340280ec7ba87d3527ce8756859
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PathUtility.ets
arkts
isDirectory
检查路径是否为目录 @param path 目标路径 @returns 是否为目录
static isDirectory(path: string): boolean { try { const stat = fs.statSync(path); return stat.isDirectory(); } catch { return false; } }
AST#method_declaration#Left static isDirectory 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#type_annotation#Left AST#primary_type#Left boolean 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 stat = 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 path 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 stat AST#expression#Right . isDirectory 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#catch_clause#Left catch 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 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isDirectory(path: string): boolean { try { const stat = fs.statSync(path); return stat.isDirectory(); } catch { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L130-L137
85bc03c6b00ed78edde567267a29cba9e4b049ee
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/data/Square.ets
arkts
Copyright (C) 2022 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 default class Square { public data: number[] = [ 0.0, //#0 0.0025000000745058065, //#1 0.010000000298023226, //#2 0.02250000178813938, //#3 0.040000001192092904, //#4 0.0625, //#5 0.09000000715255752, //#6 0.1225000166893011, //#7 0.16000002861023077, //#8 0.2025000429153465, //#9 0.25000005960464833, //#10 0.3025000786781362, //#11 0.3600001001358102, //#12 0.42250012397767023, //#13 0.49000015020371634, //#14 0.5625001788139485, //#15 0.6400002098083668, //#16 0.7225002431869711, //#17 0.8100002789497616, //#18 0.9025003170967381, //#19 1.0000002384185933, //#20 1.10250015020371, //#21 1.210000052452088, //#22 1.3224999451637274, //#23 1.4399998283386282, //#24 1.5624997019767903, //#25 1.6899995660782139, //#26 1.8224994206428988, //#27 1.9599992656708451, //#28 2.102499101162053, //#29 2.249998927116522, //#30 2.4024987435342524, //#31 2.5599985504152443, //#32 2.7224983477594975, //#33 2.889998135567012, //#34 3.062497913837788, //#35 3.2399976825718255, //#36 3.4224974417691243, //#37 3.6099971914296844, //#38 3.802496931553506, //#39 3.999996662140589, //#40 4.202496871948824, //#41 4.4099965953833475, //#42 4.622496309281132, //#43 4.839996013642178, //#44 5.062495708466486, //#45 5.2899953937540545, //#46 5.522495069504885, //#47 5.759994735718976, //#48 6.002494392396329, //#49 6.2499940395369435, //#50 6.502493677140819, //#51 6.759993305207956, //#52 7.022492923738355, //#53 7.289992532732015, //#54 7.562492132188936, //#55 7.839991722109119, //#56 8.122491302492563, //#57 8.409990873339268, //#58 8.702490434649235, //#59 8.999989986422463, //#60 9.302489528658953, //#61 9.609989061358704, //#62 9.922488584521716, //#63 10.23998809814799, //#64 10.562487602237525, //#65 10.889987096790321, //#66 11.222486581806379, //#67 11.559986057285698, //#68 11.902485523228279, //#69 12.249984979634121, //#70 12.602484426503224, //#71 12.959983863835589, //#72 13.322483291631215, //#73 13.689982709890103, //#74 14.062482118612252, //#75 14.439981517797662, //#76 14.822480907446334, //#77 15.209980287558267, //#78 15.602479658133461, //#79 15.999979019171917, //#80 16.402478370673634, //#81 16.809979667669722, //#82 17.222481002812856, //#83 17.639982376103035, //#84 18.06248378754026, //#85 18.48998523712453, //#86 18.922486724855844, //#87 19.359988250734204, //#88 19.80248981475961, //#89 20.249991416932062, //#90 20.70249305725156, //#91 21.1599947357181, //#92 21.62249645233169, //#93 22.08999820709232, //#94 22.5625, //#95 23.040001831054724, //#96 23.522503700256493, //#97 24.010005607605308, //#98 24.502507553101168,//#99 ] }
AST#export_declaration#Left export default AST#class_declaration#Left class Square AST#class_body#Left { AST#property_declaration#Left public data : 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#expression#Left AST#array_literal#Left [ AST#expression#Left 0.0 AST#expression#Right , //#0 AST#expression#Left 0.0025000000745058065 AST#expression#Right , //#1 AST#expression#Left 0.010000000298023226 AST#expression#Right , //#2 AST#expression#Left 0.02250000178813938 AST#expression#Right , //#3 AST#expression#Left 0.040000001192092904 AST#expression#Right , //#4 AST#expression#Left 0.0625 AST#expression#Right , //#5 AST#expression#Left 0.09000000715255752 AST#expression#Right , //#6 AST#expression#Left 0.1225000166893011 AST#expression#Right , //#7 AST#expression#Left 0.16000002861023077 AST#expression#Right , //#8 AST#expression#Left 0.2025000429153465 AST#expression#Right , //#9 AST#expression#Left 0.25000005960464833 AST#expression#Right , //#10 AST#expression#Left 0.3025000786781362 AST#expression#Right , //#11 AST#expression#Left 0.3600001001358102 AST#expression#Right , //#12 AST#expression#Left 0.42250012397767023 AST#expression#Right , //#13 AST#expression#Left 0.49000015020371634 AST#expression#Right , //#14 AST#expression#Left 0.5625001788139485 AST#expression#Right , //#15 AST#expression#Left 0.6400002098083668 AST#expression#Right , //#16 AST#expression#Left 0.7225002431869711 AST#expression#Right , //#17 AST#expression#Left 0.8100002789497616 AST#expression#Right , //#18 AST#expression#Left 0.9025003170967381 AST#expression#Right , //#19 AST#expression#Left 1.0000002384185933 AST#expression#Right , //#20 AST#expression#Left 1.10250015020371 AST#expression#Right , //#21 AST#expression#Left 1.210000052452088 AST#expression#Right , //#22 AST#expression#Left 1.3224999451637274 AST#expression#Right , //#23 AST#expression#Left 1.4399998283386282 AST#expression#Right , //#24 AST#expression#Left 1.5624997019767903 AST#expression#Right , //#25 AST#expression#Left 1.6899995660782139 AST#expression#Right , //#26 AST#expression#Left 1.8224994206428988 AST#expression#Right , //#27 AST#expression#Left 1.9599992656708451 AST#expression#Right , //#28 AST#expression#Left 2.102499101162053 AST#expression#Right , //#29 AST#expression#Left 2.249998927116522 AST#expression#Right , //#30 AST#expression#Left 2.4024987435342524 AST#expression#Right , //#31 AST#expression#Left 2.5599985504152443 AST#expression#Right , //#32 AST#expression#Left 2.7224983477594975 AST#expression#Right , //#33 AST#expression#Left 2.889998135567012 AST#expression#Right , //#34 AST#expression#Left 3.062497913837788 AST#expression#Right , //#35 AST#expression#Left 3.2399976825718255 AST#expression#Right , //#36 AST#expression#Left 3.4224974417691243 AST#expression#Right , //#37 AST#expression#Left 3.6099971914296844 AST#expression#Right , //#38 AST#expression#Left 3.802496931553506 AST#expression#Right , //#39 AST#expression#Left 3.999996662140589 AST#expression#Right , //#40 AST#expression#Left 4.202496871948824 AST#expression#Right , //#41 AST#expression#Left 4.4099965953833475 AST#expression#Right , //#42 AST#expression#Left 4.622496309281132 AST#expression#Right , //#43 AST#expression#Left 4.839996013642178 AST#expression#Right , //#44 AST#expression#Left 5.062495708466486 AST#expression#Right , //#45 AST#expression#Left 5.2899953937540545 AST#expression#Right , //#46 AST#expression#Left 5.522495069504885 AST#expression#Right , //#47 AST#expression#Left 5.759994735718976 AST#expression#Right , //#48 AST#expression#Left 6.002494392396329 AST#expression#Right , //#49 AST#expression#Left 6.2499940395369435 AST#expression#Right , //#50 AST#expression#Left 6.502493677140819 AST#expression#Right , //#51 AST#expression#Left 6.759993305207956 AST#expression#Right , //#52 AST#expression#Left 7.022492923738355 AST#expression#Right , //#53 AST#expression#Left 7.289992532732015 AST#expression#Right , //#54 AST#expression#Left 7.562492132188936 AST#expression#Right , //#55 AST#expression#Left 7.839991722109119 AST#expression#Right , //#56 AST#expression#Left 8.122491302492563 AST#expression#Right , //#57 AST#expression#Left 8.409990873339268 AST#expression#Right , //#58 AST#expression#Left 8.702490434649235 AST#expression#Right , //#59 AST#expression#Left 8.999989986422463 AST#expression#Right , //#60 AST#expression#Left 9.302489528658953 AST#expression#Right , //#61 AST#expression#Left 9.609989061358704 AST#expression#Right , //#62 AST#expression#Left 9.922488584521716 AST#expression#Right , //#63 AST#expression#Left 10.23998809814799 AST#expression#Right , //#64 AST#expression#Left 10.562487602237525 AST#expression#Right , //#65 AST#expression#Left 10.889987096790321 AST#expression#Right , //#66 AST#expression#Left 11.222486581806379 AST#expression#Right , //#67 AST#expression#Left 11.559986057285698 AST#expression#Right , //#68 AST#expression#Left 11.902485523228279 AST#expression#Right , //#69 AST#expression#Left 12.249984979634121 AST#expression#Right , //#70 AST#expression#Left 12.602484426503224 AST#expression#Right , //#71 AST#expression#Left 12.959983863835589 AST#expression#Right , //#72 AST#expression#Left 13.322483291631215 AST#expression#Right , //#73 AST#expression#Left 13.689982709890103 AST#expression#Right , //#74 AST#expression#Left 14.062482118612252 AST#expression#Right , //#75 AST#expression#Left 14.439981517797662 AST#expression#Right , //#76 AST#expression#Left 14.822480907446334 AST#expression#Right , //#77 AST#expression#Left 15.209980287558267 AST#expression#Right , //#78 AST#expression#Left 15.602479658133461 AST#expression#Right , //#79 AST#expression#Left 15.999979019171917 AST#expression#Right , //#80 AST#expression#Left 16.402478370673634 AST#expression#Right , //#81 AST#expression#Left 16.809979667669722 AST#expression#Right , //#82 AST#expression#Left 17.222481002812856 AST#expression#Right , //#83 AST#expression#Left 17.639982376103035 AST#expression#Right , //#84 AST#expression#Left 18.06248378754026 AST#expression#Right , //#85 AST#expression#Left 18.48998523712453 AST#expression#Right , //#86 AST#expression#Left 18.922486724855844 AST#expression#Right , //#87 AST#expression#Left 19.359988250734204 AST#expression#Right , //#88 AST#expression#Left 19.80248981475961 AST#expression#Right , //#89 AST#expression#Left 20.249991416932062 AST#expression#Right , //#90 AST#expression#Left 20.70249305725156 AST#expression#Right , //#91 AST#expression#Left 21.1599947357181 AST#expression#Right , //#92 AST#expression#Left 21.62249645233169 AST#expression#Right , //#93 AST#expression#Left 22.08999820709232 AST#expression#Right , //#94 AST#expression#Left 22.5625 AST#expression#Right , //#95 AST#expression#Left 23.040001831054724 AST#expression#Right , //#96 AST#expression#Left 23.522503700256493 AST#expression#Right , //#97 AST#expression#Left 24.010005607605308 AST#expression#Right , //#98 AST#expression#Left 24.502507553101168 AST#expression#Right , //#99 ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class Square { public data: number[] = [ 0.0, 0.0025000000745058065, 0.010000000298023226, 0.02250000178813938, 0.040000001192092904, 0.0625, 0.09000000715255752, 0.1225000166893011, 0.16000002861023077, 0.2025000429153465, 0.25000005960464833, 0 0.3025000786781362, 1 0.3600001001358102, 2 0.42250012397767023, 3 0.49000015020371634, 4 0.5625001788139485, 5 0.6400002098083668, 6 0.7225002431869711, 7 0.8100002789497616, 8 0.9025003170967381, 9 1.0000002384185933, 0 1.10250015020371, 1 1.210000052452088, 2 1.3224999451637274, 3 1.4399998283386282, 4 1.5624997019767903, 5 1.6899995660782139, 6 1.8224994206428988, 7 1.9599992656708451, 8 2.102499101162053, 9 2.249998927116522, 0 2.4024987435342524, 1 2.5599985504152443, 2 2.7224983477594975, 3 2.889998135567012, 4 3.062497913837788, 5 3.2399976825718255, 6 3.4224974417691243, 7 3.6099971914296844, 8 3.802496931553506, 9 3.999996662140589, 0 4.202496871948824, 1 4.4099965953833475, 2 4.622496309281132, 3 4.839996013642178, 4 5.062495708466486, 5 5.2899953937540545, 6 5.522495069504885, 7 5.759994735718976, 8 6.002494392396329, 9 6.2499940395369435, 0 6.502493677140819, 1 6.759993305207956, 2 7.022492923738355, 3 7.289992532732015, 4 7.562492132188936, 5 7.839991722109119, 6 8.122491302492563, 7 8.409990873339268, 8 8.702490434649235, 9 8.999989986422463, 0 9.302489528658953, 1 9.609989061358704, 2 9.922488584521716, 3 10.23998809814799, 4 10.562487602237525, 5 10.889987096790321, 6 11.222486581806379, 7 11.559986057285698, 8 11.902485523228279, 9 12.249984979634121, 0 12.602484426503224, 1 12.959983863835589, 2 13.322483291631215, 3 13.689982709890103, 4 14.062482118612252, 5 14.439981517797662, 6 14.822480907446334, 7 15.209980287558267, 8 15.602479658133461, 9 15.999979019171917, 0 16.402478370673634, 1 16.809979667669722, 2 17.222481002812856, 3 17.639982376103035, 4 18.06248378754026, 5 18.48998523712453, 6 18.922486724855844, 7 19.359988250734204, 8 19.80248981475961, 9 20.249991416932062, 0 20.70249305725156, 1 21.1599947357181, 2 21.62249645233169, 3 22.08999820709232, 4 22.5625, 5 23.040001831054724, 6 23.522503700256493, 7 24.010005607605308, 8 24.502507553101168,9 ] }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Square.ets#L16-L119
9206f3e8afa0c504098098f009a8d703ab96d868
gitee
common-apps/dsbrigde-harmony-os
bb03e4e95984db32939a1ad609f688537b5a92e8
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
setGlobalErrorMessageListener
设置全局错误监听 @param listener
setGlobalErrorMessageListener(listener: OnErrorMessageListener): void { this.bridge.setGlobalErrorMessageListener(listener) }
AST#method_declaration#Left setGlobalErrorMessageListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left OnErrorMessageListener 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 . bridge AST#member_expression#Right AST#expression#Right . setGlobalErrorMessageListener AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left listener 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
setGlobalErrorMessageListener(listener: OnErrorMessageListener): void { this.bridge.setGlobalErrorMessageListener(listener) }
https://github.com/common-apps/dsbrigde-harmony-os/blob/bb03e4e95984db32939a1ad609f688537b5a92e8/library/src/main/ets/core/WebViewControllerProxy.ets#L26-L28
fe3e0f9abf38e3ae21d43305b89709e742f71b26
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragandexchange/src/main/ets/pages/Launcher.ets
arkts
Launcher
功能描述: 本示例使用position绝对定位实现应用内悬浮窗,并且通过animateTo结合curves动画曲线实现悬浮窗拖拽跟手和松手吸附边缘的弹性动画效果 推荐场景: 悬浮窗显示场景 核心组件: 1. FloatWindowView 实现步骤: 1. 悬浮窗组件使用Stack嵌套video布局,使用属性position绝对定位使组件悬浮,position使用Edges类型控制悬浮窗到父组件四条边的距离 2. 初始化时悬浮窗的position属性设置top和right,让悬浮窗靠右 3. 父组件添加onAreaChange回调,获取父组件的宽高 4. 悬浮窗组件添加onTouchEvent回调,在手指按下时保存触摸点在窗口中的坐标,用于移动时悬浮窗位置的计算 5. 手指移动时,获取触摸点相对于应用窗口左上角的X和Y坐标,通过计算设置悬浮窗的position坐标实现拖拽,使用默认参数的弹性跟手动画曲线curves.responsiveSpringMotion结合animateTo实现跟手动画效果 6. 手指抬起时,通过判断悬浮窗中心在水平方向位于父组件中心的左侧或右侧设置悬浮窗靠左或靠右,如果悬浮窗超出内容区上下边界,则将悬浮窗设置在边界位置,使用curves.springMotion弹性动画曲线实现吸附边界时的弹性动画效果
@Component export struct Launcher { build() { Column() { GridSceneView() // 实现Grid拖拽场景 ListSceneView() // 实现List拖拽场景 } .width($r("app.string.drag_and_exchange_layout_100_percent")) .height($r("app.string.drag_and_exchange_layout_100_percent")) .justifyContent(FlexAlign.Center) .backgroundImage($r('app.media.drag_and_exchange_wallpaper_default')) .backgroundImageSize(ImageSize.Cover) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Launcher 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 GridSceneView ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 实现Grid拖拽场景 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListSceneView ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 实现List拖拽场景 } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_100_percent" 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.string.drag_and_exchange_layout_100_percent" AST#expression#Right ) AST#resource_expression#Right 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#Left . backgroundImage ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.drag_and_exchange_wallpaper_default' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundImageSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageSize AST#expression#Right . Cover 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#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 Launcher { build() { Column() { GridSceneView() ListSceneView() } .width($r("app.string.drag_and_exchange_layout_100_percent")) .height($r("app.string.drag_and_exchange_layout_100_percent")) .justifyContent(FlexAlign.Center) .backgroundImage($r('app.media.drag_and_exchange_wallpaper_default')) .backgroundImageSize(ImageSize.Cover) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/pages/Launcher.ets#L35-L48
ff02d6c8765941e2d64e4d84288a726ad029c92e
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/chat/PrivateChatComponent.ets
arkts
aboutToDisappear
界面被销毁时被调用。
aboutToDisappear() { // this.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false); // 清除动画循环 clearInterval(this.animationId); EmitterUtil.unsubscribe(VHRoomEventType.IM_PRIVATE_TEXT); }
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // this.setKeyboardAvoidModeToRESIZE(this.getUIContext(), false); // 清除动画循环 AST#ui_custom_component_statement#Left clearInterval ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . animationId AST#member_expression#Right AST#expression#Right ) ; AST#ui_custom_component_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EmitterUtil AST#expression#Right . unsubscribe AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left VHRoomEventType AST#expression#Right . IM_PRIVATE_TEXT 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
aboutToDisappear() { clearInterval(this.animationId); EmitterUtil.unsubscribe(VHRoomEventType.IM_PRIVATE_TEXT); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/chat/PrivateChatComponent.ets#L81-L86
3e82cc4065fb3eb3a7dc5f6f648570a69143af41
gitee
fourseas1998/hos.RankingDemo.git
5a98167826252c3c2b5ac58fa9a3db29d5f49d02
entry/src/main/ets/view/ListItemComponent.ets
arkts
isRenderCircleText
判断是否为前三个
isRenderCircleText(): boolean { return this.index === 1 || this.index === 2 || this.index === 3; }
AST#method_declaration#Left isRenderCircleText 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#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 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 . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . index AST#member_expression#Right AST#expression#Right === AST#expression#Left 3 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
isRenderCircleText(): boolean { return this.index === 1 || this.index === 2 || this.index === 3; }
https://github.com/fourseas1998/hos.RankingDemo.git/blob/5a98167826252c3c2b5ac58fa9a3db29d5f49d02/entry/src/main/ets/view/ListItemComponent.ets#L54-L56
521428cc111ff6c73efc2f2d9745d4cfabaf11ae
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_settings.ets
arkts
init
Initializes the bunch_of_settings.
static async init() { // Register the default Settings // Customization bunch_of_settings.register_setting('title_bar_position', 'string', 'bottom'); bunch_of_settings.register_setting('status_showing_large_my_window_alias', 'boolean', 'false'); bunch_of_settings.register_setting('tabs_style', 'string', 'vertical'); bunch_of_settings.register_setting('tabs_style_non_tablet_mode', 'string', 'vertical'); bunch_of_settings.register_setting('bottom_avoid', 'boolean', 'true'); bunch_of_settings.register_setting('navigation_indicator', 'boolean', 'true'); bunch_of_settings.register_setting('effects', 'boolean', 'false'); bunch_of_settings.register_setting('title_function_buttons', 'string', '01'); // ltr bunch_of_settings.register_setting('title_function_extensions', 'boolean', 'false'); // Experience bunch_of_settings.register_setting('sys_back_access_backward', 'boolean', 'true'); bunch_of_settings.register_setting('esc_to_access_backward', 'boolean', 'false'); bunch_of_settings.register_setting('max_bookmark_suggest', 'number', '5'); bunch_of_settings.register_setting('max_history_suggest', 'number', '5'); bunch_of_settings.register_setting('tabs_vertical_auto_hide', 'boolean', 'false'); bunch_of_settings.register_setting('tabs_vertical_auto_hide_button', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_enabled', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_image_preview', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_web_preview', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_image_height', 'number', '300'); bunch_of_settings.register_setting('web_context_web_height', 'number', '500'); // Statuses bunch_of_settings.register_setting('status_tabs_open', 'boolean', 'false'); bunch_of_settings.register_setting('status_showing_my_windows_alias', 'boolean', 'false'); bunch_of_settings.register_setting('status_showing_my_windows_alias_non_tablet', 'boolean', 'false'); bunch_of_settings.register_setting('my_window_alias_position', 'string', 'center'); bunch_of_settings.register_setting('my_window_alias_last', 'string', default_new_window_name()); // Continuation bunch_of_settings.register_setting('continuation_auto_exit', 'boolean', 'false'); bunch_of_settings.register_setting('continuation_auto_close_tab', 'boolean', 'true'); // Keyboard shortcuts bunch_of_settings.register_setting('key_shortcuts', 'string', ''); // Surf bunch_of_settings.register_setting('home_url', 'string', ''); bunch_of_settings.register_setting('new_tab_url', 'string', ''); bunch_of_settings.register_setting('start_up_option', 'string', 'new tab'); bunch_of_settings.register_setting('intelligent_tracking_prevention', 'boolean', 'false'); bunch_of_settings.register_setting('enable_third_party_cookies', 'boolean', 'false'); bunch_of_settings.register_setting('continue_tabs_count', 'number', '0'); // Deprecated bunch_of_settings.register_setting('continue_tabs_main_on', 'number', '0'); bunch_of_settings.register_setting('continue_tabs_sub_on', 'number', '-1'); bunch_of_settings.register_setting('last_zone', 'string', ''); // Empty for a temp windows // Animation defaults bunch_of_settings.register_setting('animation_response', 'number', '36'); bunch_of_settings.register_setting('animation_damping_coefficient', 'number', '20'); // UA & Search Engines & Homepage bunch_of_settings.register_setting('custom_user_agents', 'string', default_user_agents()); bunch_of_settings.register_setting('custom_user_agents_selected_index', 'number', '-1'); bunch_of_settings.register_setting('custom_search_engines', 'string', preset_search_engines()); bunch_of_settings.register_setting('custom_search_engines_selected_index', 'number', '-1'); bunch_of_settings.register_setting('homepage_shortcuts_bookmarks_dir', 'string', ''); bunch_of_settings.register_setting('homepage_shortcuts_init_height', 'number', '50'); // Single hand accessibility bunch_of_settings.register_setting('preferred_hand_left_or_right', 'string', 'right'); bunch_of_settings.register_setting('preferred_hand_reverse_settings_menu', 'boolean', 'true'); bunch_of_settings.register_setting('preferred_hand_reverse_tabs_panel', 'boolean', 'true'); bunch_of_settings.register_setting('preferred_hand_reverse_homepage_shortcuts', 'boolean', 'false'); bunch_of_settings.register_setting('preferred_hand_auto', 'boolean', 'false'); // Ad blocker bunch_of_settings.register_setting('use_adblock', 'boolean', 'true'); bunch_of_settings.register_setting('adblock_exceptions', 'string', ''); // JS blocker bunch_of_settings.register_setting('disable_js', 'boolean', 'true'); bunch_of_settings.register_setting('disable_js_all_sites', 'boolean', 'false'); bunch_of_settings.register_setting('disable_js_these_sites', 'string', ''); // Image blocker bunch_of_settings.register_setting('disable_image', 'boolean', 'true'); bunch_of_settings.register_setting('disable_image_all_sites', 'boolean', 'false'); bunch_of_settings.register_setting('disable_image_these_sites', 'string', ''); // Dark mode bunch_of_settings.register_setting('web_force_dark_mode', 'boolean', 'false'); bunch_of_settings.register_setting('web_force_dark_mode_exemptions', 'string', ''); // Colors bunch_of_settings.register_setting('color_light_primary', 'string', '#E1E9E3'); bunch_of_settings.register_setting('color_light_secondary', 'string', '#CDD7CD'); bunch_of_settings.register_setting('color_light_font', 'string', '#243B24'); bunch_of_settings.register_setting('color_dark_primary', 'string', '#0F1A0F'); bunch_of_settings.register_setting('color_dark_secondary', 'string', '#2A392A'); bunch_of_settings.register_setting('color_dark_font', 'string', '#E1E9E3'); // Cached size of webview cache bunch_of_settings.register_setting('webview_cache_size', 'number', '-1'); // History bunch_of_settings.register_setting('collect_new_history', 'boolean', 'true'); bunch_of_settings.register_setting('history_index_size', 'number', '-1'); bunch_of_settings.register_setting('history_index_load_quantity', 'number', '6'); // Download bunch_of_settings.register_setting('direct_download', 'boolean', 'false'); bunch_of_settings.register_setting('direct_download_auto_open', 'boolean', 'true'); // Debug bunch_of_settings.register_setting('DEV_MODE', 'boolean', 'false'); bunch_of_settings.register_setting('resource_monitor', 'boolean', 'true'); // Migrate let read = await bunch_of_settings.read_create_and_or_migration(); if (read) { bunch_of_settings.import_json(read); } console.log('[Meow][bunch_of_settings] Init success!'); }
AST#method_declaration#Left static async init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // Register the default Settings // Customization AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_bar_position' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left 'bottom' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_large_my_window_alias' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left 'vertical' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_style_non_tablet_mode' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left 'vertical' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'bottom_avoid' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'navigation_indicator' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'effects' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_function_buttons' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '01' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // ltr AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'title_function_extensions' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Experience AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'sys_back_access_backward' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'esc_to_access_backward' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_bookmark_suggest' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '5' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'max_history_suggest' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '5' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'tabs_vertical_auto_hide_button' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_enabled' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_image_preview' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_menu_web_preview' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_image_height' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '300' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_context_web_height' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '500' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Statuses AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_tabs_open' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_my_windows_alias' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'status_showing_my_windows_alias_non_tablet' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_alias_position' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left 'center' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_alias_last' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left default_new_window_name 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 // Continuation AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_exit' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continuation_auto_close_tab' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Keyboard shortcuts AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'key_shortcuts' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Surf AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'home_url' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'new_tab_url' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'start_up_option' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left 'new tab' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'intelligent_tracking_prevention' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'enable_third_party_cookies' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continue_tabs_count' AST#expression#Right , AST#expression#Left 'number' 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 // Deprecated AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continue_tabs_main_on' AST#expression#Right , AST#expression#Left 'number' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'continue_tabs_sub_on' AST#expression#Right , AST#expression#Left 'number' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'last_zone' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Empty for a temp windows // Animation defaults AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_response' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '36' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'animation_damping_coefficient' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '20' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // UA & Search Engines & Homepage AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_user_agents' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left default_user_agents 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_user_agents_selected_index' AST#expression#Right , AST#expression#Left 'number' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_search_engines' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left preset_search_engines 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'custom_search_engines_selected_index' AST#expression#Right , AST#expression#Left 'number' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_bookmarks_dir' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'homepage_shortcuts_init_height' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '50' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Single hand accessibility AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_left_or_right' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_settings_menu' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_tabs_panel' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_reverse_homepage_shortcuts' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'preferred_hand_auto' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Ad blocker AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'use_adblock' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'adblock_exceptions' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // JS blocker AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_all_sites' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_js_these_sites' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Image blocker AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_all_sites' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'disable_image_these_sites' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Dark mode AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'web_force_dark_mode_exemptions' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Colors AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_primary' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#E1E9E3' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_secondary' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#CDD7CD' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_light_font' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#243B24' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_primary' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#0F1A0F' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_secondary' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#2A392A' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'color_dark_font' AST#expression#Right , AST#expression#Left 'string' AST#expression#Right , AST#expression#Left '#E1E9E3' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Cached size of webview cache AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'webview_cache_size' AST#expression#Right , AST#expression#Left 'number' 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 // History AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'collect_new_history' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'history_index_size' AST#expression#Right , AST#expression#Left 'number' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'history_index_load_quantity' AST#expression#Right , AST#expression#Left 'number' AST#expression#Right , AST#expression#Left '6' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Download AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'direct_download_auto_open' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Debug AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'DEV_MODE' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'false' 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 bunch_of_settings AST#expression#Right . register_setting AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'resource_monitor' AST#expression#Right , AST#expression#Left 'boolean' AST#expression#Right , AST#expression#Left 'true' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // Migrate AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left read = 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 bunch_of_settings AST#expression#Right AST#await_expression#Right AST#expression#Right . read_create_and_or_migration 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left read AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bunch_of_settings AST#expression#Right . import_json AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left read 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#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 '[Meow][bunch_of_settings] Init success!' 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 async init() { bunch_of_settings.register_setting('title_bar_position', 'string', 'bottom'); bunch_of_settings.register_setting('status_showing_large_my_window_alias', 'boolean', 'false'); bunch_of_settings.register_setting('tabs_style', 'string', 'vertical'); bunch_of_settings.register_setting('tabs_style_non_tablet_mode', 'string', 'vertical'); bunch_of_settings.register_setting('bottom_avoid', 'boolean', 'true'); bunch_of_settings.register_setting('navigation_indicator', 'boolean', 'true'); bunch_of_settings.register_setting('effects', 'boolean', 'false'); bunch_of_settings.register_setting('title_function_buttons', 'string', '01'); bunch_of_settings.register_setting('title_function_extensions', 'boolean', 'false'); bunch_of_settings.register_setting('sys_back_access_backward', 'boolean', 'true'); bunch_of_settings.register_setting('esc_to_access_backward', 'boolean', 'false'); bunch_of_settings.register_setting('max_bookmark_suggest', 'number', '5'); bunch_of_settings.register_setting('max_history_suggest', 'number', '5'); bunch_of_settings.register_setting('tabs_vertical_auto_hide', 'boolean', 'false'); bunch_of_settings.register_setting('tabs_vertical_auto_hide_button', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_enabled', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_image_preview', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_menu_web_preview', 'boolean', 'true'); bunch_of_settings.register_setting('web_context_image_height', 'number', '300'); bunch_of_settings.register_setting('web_context_web_height', 'number', '500'); bunch_of_settings.register_setting('status_tabs_open', 'boolean', 'false'); bunch_of_settings.register_setting('status_showing_my_windows_alias', 'boolean', 'false'); bunch_of_settings.register_setting('status_showing_my_windows_alias_non_tablet', 'boolean', 'false'); bunch_of_settings.register_setting('my_window_alias_position', 'string', 'center'); bunch_of_settings.register_setting('my_window_alias_last', 'string', default_new_window_name()); bunch_of_settings.register_setting('continuation_auto_exit', 'boolean', 'false'); bunch_of_settings.register_setting('continuation_auto_close_tab', 'boolean', 'true'); bunch_of_settings.register_setting('key_shortcuts', 'string', ''); bunch_of_settings.register_setting('home_url', 'string', ''); bunch_of_settings.register_setting('new_tab_url', 'string', ''); bunch_of_settings.register_setting('start_up_option', 'string', 'new tab'); bunch_of_settings.register_setting('intelligent_tracking_prevention', 'boolean', 'false'); bunch_of_settings.register_setting('enable_third_party_cookies', 'boolean', 'false'); bunch_of_settings.register_setting('continue_tabs_count', 'number', '0'); bunch_of_settings.register_setting('continue_tabs_main_on', 'number', '0'); bunch_of_settings.register_setting('continue_tabs_sub_on', 'number', '-1'); bunch_of_settings.register_setting('last_zone', 'string', ''); bunch_of_settings.register_setting('animation_response', 'number', '36'); bunch_of_settings.register_setting('animation_damping_coefficient', 'number', '20'); bunch_of_settings.register_setting('custom_user_agents', 'string', default_user_agents()); bunch_of_settings.register_setting('custom_user_agents_selected_index', 'number', '-1'); bunch_of_settings.register_setting('custom_search_engines', 'string', preset_search_engines()); bunch_of_settings.register_setting('custom_search_engines_selected_index', 'number', '-1'); bunch_of_settings.register_setting('homepage_shortcuts_bookmarks_dir', 'string', ''); bunch_of_settings.register_setting('homepage_shortcuts_init_height', 'number', '50'); bunch_of_settings.register_setting('preferred_hand_left_or_right', 'string', 'right'); bunch_of_settings.register_setting('preferred_hand_reverse_settings_menu', 'boolean', 'true'); bunch_of_settings.register_setting('preferred_hand_reverse_tabs_panel', 'boolean', 'true'); bunch_of_settings.register_setting('preferred_hand_reverse_homepage_shortcuts', 'boolean', 'false'); bunch_of_settings.register_setting('preferred_hand_auto', 'boolean', 'false'); bunch_of_settings.register_setting('use_adblock', 'boolean', 'true'); bunch_of_settings.register_setting('adblock_exceptions', 'string', ''); bunch_of_settings.register_setting('disable_js', 'boolean', 'true'); bunch_of_settings.register_setting('disable_js_all_sites', 'boolean', 'false'); bunch_of_settings.register_setting('disable_js_these_sites', 'string', ''); bunch_of_settings.register_setting('disable_image', 'boolean', 'true'); bunch_of_settings.register_setting('disable_image_all_sites', 'boolean', 'false'); bunch_of_settings.register_setting('disable_image_these_sites', 'string', ''); bunch_of_settings.register_setting('web_force_dark_mode', 'boolean', 'false'); bunch_of_settings.register_setting('web_force_dark_mode_exemptions', 'string', ''); bunch_of_settings.register_setting('color_light_primary', 'string', '#E1E9E3'); bunch_of_settings.register_setting('color_light_secondary', 'string', '#CDD7CD'); bunch_of_settings.register_setting('color_light_font', 'string', '#243B24'); bunch_of_settings.register_setting('color_dark_primary', 'string', '#0F1A0F'); bunch_of_settings.register_setting('color_dark_secondary', 'string', '#2A392A'); bunch_of_settings.register_setting('color_dark_font', 'string', '#E1E9E3'); bunch_of_settings.register_setting('webview_cache_size', 'number', '-1'); bunch_of_settings.register_setting('collect_new_history', 'boolean', 'true'); bunch_of_settings.register_setting('history_index_size', 'number', '-1'); bunch_of_settings.register_setting('history_index_load_quantity', 'number', '6'); bunch_of_settings.register_setting('direct_download', 'boolean', 'false'); bunch_of_settings.register_setting('direct_download_auto_open', 'boolean', 'true'); bunch_of_settings.register_setting('DEV_MODE', 'boolean', 'false'); bunch_of_settings.register_setting('resource_monitor', 'boolean', 'true'); let read = await bunch_of_settings.read_create_and_or_migration(); if (read) { bunch_of_settings.import_json(read); } console.log('[Meow][bunch_of_settings] Init success!'); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L16-L137
3fabf03e8be398e62cfe9018e5e753ab4ac40777
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets
arkts
stopContinuousTask
结束后台任务 @returns {void}
stopContinuousTask(): void { // 避免重新停止后台任务 if (!this.isBackgroundTaskRunning) { return; } // TODO:知识点:停止后台任务 backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { logger.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning = false; }).catch((err: BusinessError) => { logger.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }
AST#method_declaration#Left stopContinuousTask 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#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 . isBackgroundTaskRunning 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 // TODO:知识点:停止后台任务 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 backgroundTaskManager AST#expression#Right . stopBackgroundRunning AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bindContext AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Succeeded in operationing stopBackgroundRunning. ` 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 . isBackgroundTaskRunning 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#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#template_literal#Left ` Failed to operation stopBackgroundRunning. 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#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#method_declaration#Right
stopContinuousTask(): void { if (!this.isBackgroundTaskRunning) { return; } backgroundTaskManager.stopBackgroundRunning(this.bindContext!).then(() => { logger.info(`Succeeded in operationing stopBackgroundRunning.`); this.isBackgroundTaskRunning = false; }).catch((err: BusinessError) => { logger.error(`Failed to operation stopBackgroundRunning. Code is ${err.code}, message is ${err.message}`); }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/model/AVSessionModel.ets#L320-L333
12b6858a49eadbb343cd063d5cd1429b0f91832b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
mime_types/src/main/ets/Mime.ets
arkts
getFileExtention
根据 文件名/文件path/文件uri/文件url,获取文件后缀名 @param src 例如: test.txt test.doc @returns
static getFileExtention(src: string): string { if (src.length > 1 && src.includes(".")) { return src.substring(src.lastIndexOf(".") + 1); } return ''; }
AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left 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#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left src 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#expression#Left src 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left src AST#expression#Right . substring AST#member_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 src AST#expression#Right . lastIndexOf 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 1 AST#expression#Right AST#binary_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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getFileExtention(src: string): string { if (src.length > 1 && src.includes(".")) { return src.substring(src.lastIndexOf(".") + 1); } return ''; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/mime_types/src/main/ets/Mime.ets#L71-L76
0b9d27ec3f66c776b39e20be0e55b181ebb14a7b
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the build types of the same baseline code. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get buildType(): string;
AST#method_declaration#Left static get AST#ERROR#Left build Type AST#ERROR#Right 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#method_declaration#Right
static get buildType(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L327-L327
31e44c2408ce5845d76b54e3ae34da83c914bc28
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets
arkts
stop
结束播放
static async stop() { await AudioRendererManager.audioRender?.stop() }
AST#method_declaration#Left static async stop 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 AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AudioRendererManager AST#expression#Right AST#await_expression#Right AST#expression#Right . audioRender AST#member_expression#Right AST#expression#Right ?. stop 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
static async stop() { await AudioRendererManager.audioRender?.stop() }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L82-L84
52d161164e50ffee7dd60837cd6bee06a71de6b5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreviewUtil.ets
arkts
getIconFileStr
根据文件后缀名获取对应文件类型的图标 @param fileExtention 文件后缀名,例如:html txt doc ts mp3
static getIconFileStr(fileExtention: string): string { const descriptor = PreviewUtil.getTypeDescriptor(fileExtention); return descriptor.iconFile; }
AST#method_declaration#Left static getIconFileStr AST#parameter_list#Left ( AST#parameter#Left fileExtention : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left descriptor = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PreviewUtil AST#expression#Right . getTypeDescriptor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileExtention 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 descriptor AST#expression#Right . iconFile AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getIconFileStr(fileExtention: string): string { const descriptor = PreviewUtil.getTypeDescriptor(fileExtention); return descriptor.iconFile; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreviewUtil.ets#L156-L159
8570adfbdb9111665fa98b881d0785deb9f1ab62
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets
arkts
fancy
Common text styles.
@Extend(Text) function fancy() { .fontColor($r("app.color.dialog_fancy_text_color")) .fontSize($r("app.float.dialog_fancy_text_size")) .textAlign(TextAlign.Center) .fontWeight(FontWeight.Medium) .layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fancy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.dialog_fancy_text_color" 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 "app.float.dialog_fancy_text_size" AST#expression#Right ) AST#resource_expression#Right 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#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 . layoutWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . COMMON_LAYOUT_WEIGHT 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#decorated_function_declaration#Right
@Extend(Text) function fancy() { .fontColor($r("app.color.dialog_fancy_text_color")) .fontSize($r("app.float.dialog_fancy_text_size")) .textAlign(TextAlign.Center) .fontWeight(FontWeight.Medium) .layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/view/CustomDialogComponent.ets#L90-L97
400025df3a35235db08d9f62f47259b4e97176d9
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
common font weight
export const COMMON_NUM_FONT_WEIGHT: number = 500;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_NUM_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const COMMON_NUM_FONT_WEIGHT: number = 500;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L79-L79
cf51b5169e7c25213823e6eb7072c7cbd3ccfdbf
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the product model represented by a string. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get productModel(): string;
AST#method_declaration#Left static get AST#ERROR#Left productModel AST#ERROR#Right 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#method_declaration#Right
static get productModel(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L99-L99
bd2649de0595d224a7ee44fe083c2bd329b1d009
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/util/Base64Util.ets
arkts
encodeToStr
将Uint8Array转化为字符串-异步 @param array Uint8Array数组 @returns 转码后的字符串
static encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { let base64 = new util.Base64Helper(); return base64.encodeToString(array, options); }
AST#method_declaration#Left static encodeToStr AST#parameter_list#Left ( AST#parameter#Left array : 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 util . Type 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 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#variable_declaration#Left let AST#variable_declarator#Left base64 = 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 . Base64Helper 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left base64 AST#expression#Right . encodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left array 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 encodeToStr(array: Uint8Array, options?: util.Type): Promise<string> { let base64 = new util.Base64Helper(); return base64.encodeToString(array, options); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/Base64Util.ets#L31-L34
a6b18f799da4f3e516b206970b7c44f7e62ff74b
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/configs/Colors.ets
arkts
/ Colors.ets / / Created by iotjin on 2024/08/01. / description:
export class KColors { // 主题色(导航条背景、提交按钮背景、弹框确认文字、表单图标录入光标) // 暗黑模式高亮显示颜色按kThemeColor设置,如tabBar选中文字图标、提交按钮背景色、指示器选中下划线、光标等 static readonly kThemeColor: ResourceColor = '#3BB815' static readonly kThemeDarkColor: ResourceColor = '#0A0A0A' // (10, 10, 10) static readonly kThemeBlueColor: ResourceColor = '#4688FA' static readonly kThemePurpleColor: ResourceColor = '#9C27B0' // 渐变色(appBar和按钮) static readonly kGradientStartColor: ResourceColor = '#2683BE' // 渐变开始色 static readonly kGradientEndColor: ResourceColor = '#34CABE' // 渐变结束色 // 导航条背景色(主题色背景白色文字,透明背景为黑色文字,暗黑模式是白色文字) static readonly kNavThemeBgColor: ResourceColor = this.kThemeColor // 导航条背景色(白色背景色黑色文字,透明背景为黑色文字,暗黑模式是白色文字) static readonly kNavWhiteBgColor: ResourceColor = '#EDEDED' //(237, 237, 237) static readonly kNavBgDarkColor: ResourceColor = this.kThemeDarkColor // (10, 10, 10) static readonly kNavTitleColor: Color = Color.White // tabBar背景颜色 static readonly kTabBarBgColor: ResourceColor = Color.White static readonly kTabBarBgDarkColor: ResourceColor = '#1D1D1D' // (29, 29, 29) // tabBar默认文字颜色 static readonly kTabBarNormalTextColor: ResourceColor = '#333333' // (51, 51, 51) static readonly kTabBarNormalTextDarkColor: ResourceColor = '#C6C6C6' // (198, 198, 198) // tabBar选中文字颜色 static readonly kTabBarSelectTextColor: ResourceColor = this.kThemeColor static readonly kTabBarSelectTextDarkColor: ResourceColor = this.kThemeColor // 背景色 static readonly kBgColor: ResourceColor = '#F8F8F8' // (248, 248, 248) static readonly kBgDarkColor: ResourceColor = '#111111' // (17, 17, 17) // cell背景 static readonly kCellBgColor: ResourceColor = Color.White static readonly kCellBgDarkColor: ResourceColor = '#191919' // (25, 25, 25) static readonly kMaterialBgColor: ResourceColor = '#FFFFFF' // (255, 255, 255) static readonly kMaterialBgDarkColor: ResourceColor = '#303233' // (48, 50, 51) // btn背景颜色 // static readonly kBtnBgColor : ResourceColor = kThemeColor // static readonly kBtnBgDarkColor : ResourceColor = Color(0xFF2B2B2B) // (43, 43, 43) // 黑色文字 static readonly kBlackTextColor: ResourceColor = '#333333' // (51, 51, 51) static readonly kBlackTextDarkColor: ResourceColor = '#C6C6C6' // (198, 198, 198) // 灰色文字 static readonly kGreyTextColor: ResourceColor = '#777777' // (119, 119, 119) static readonly kGreyTextDarkColor: ResourceColor = '#787878' // (120, 120, 120) // 浅灰色文字 static readonly kLightGreyTextColor: ResourceColor = '#999999' // (153, 153, 153) static readonly kLightGreyTextDarkColor: ResourceColor = '#666666' // (102, 102, 102) // 表单title文字 static readonly kFormTitleColor: ResourceColor = this.kBlackTextColor static readonly kFormTitleDarkColor: ResourceColor = this.kBlackTextDarkColor // 表单info文字 static readonly kFormInfoColor: ResourceColor = this.kBlackTextColor static readonly kFormInfoDarkColor: ResourceColor = this.kBlackTextDarkColor // 表单hint文字 static readonly kFormHintColor: ResourceColor = '#BBBBBB' // (187, 187, 187) static readonly kFormHintDarkColor: ResourceColor = '#575757' // (87, 87, 87) // 分割线 static readonly kLineColor: ResourceColor = '#E6E6E6' // (230, 230, 230) static readonly kLineDarkColor: ResourceColor = '#232323' // (35, 35, 35) // 表单分割线 static readonly kFormLineColor: ResourceColor = this.kLineColor static readonly kFormLineDarkColor: ResourceColor = this.kLineDarkColor // 表单暗黑模式Focused状态下划线颜色 static readonly kFocusedBorderDarkColor: ResourceColor = this.kLineColor // error颜色 static readonly kErrorTextColor: ResourceColor = '#FF4759' // (255, 71, 89) static readonly kErrorTextDarkColor: ResourceColor = '#E03E4E' // (224, 62, 78) // 搜索框颜色 static readonly kSearchBarBgColor: ResourceColor = this.kCellBgColor static readonly kSearchBarBgDarkColor: ResourceColor = this.kCellBgDarkColor // textView背景颜色 static readonly kTextViewBgColor: ResourceColor = '#FAFAFA' // (250, 250, 250) static readonly kTextViewBgDarkColor: ResourceColor = '#323232' // (50, 50, 50) // toast背景颜色 static readonly kToastBgColor: ResourceColor = '#202020' // (32, 32, 32) static readonly kToastBgDarkColor: ResourceColor = '#2F2F2F' // (47, 47, 47) // alert背景颜色 static readonly kAlertBgColor: ResourceColor = Color.White static readonly kAlertBgDarkColor: ResourceColor = '#2C2C2C' // (44, 44, 44) static readonly kAlertInputBgColor: ResourceColor = Color.White static readonly kAlertInputBgDarkColor: ResourceColor = '#1E1E1E' // (30, 30, 30) // picker、bottomSheet颜色 static readonly kPickerBgColor: ResourceColor = Color.White static readonly kPickerBgDarkColor: ResourceColor = '#1E1E1E' // (30, 30, 30) static readonly kPickerTitleColor: ResourceColor = '#787878' // (120, 120, 120) static readonly kPickerTitleDarkColor: ResourceColor = '#878787' // (135, 135, 135) static readonly kPickerTextColor: ResourceColor = this.kBlackTextColor static readonly kPickerTextDarkColor: ResourceColor = this.kBlackTextDarkColor static readonly kPickerRedTextDarkColor: ResourceColor = '#E64242' // (230, 66, 66) static readonly kPickerHeaderColor: ResourceColor = this.kPickerBgColor static readonly kPickerHeaderDarkColor: ResourceColor = this.kPickerBgDarkColor static readonly kPickerHeaderLineColor: ResourceColor = this.kLineColor static readonly kPickerHeaderLineDarkColor: ResourceColor = this.kLineDarkColor static readonly kPickerBtnColor: ResourceColor = this.kBlackTextColor static readonly kPickerBtnDarkColor: ResourceColor = this.kBlackTextDarkColor // card颜色 static readonly kCardBgColor: ResourceColor = Color.White static readonly kCardBgDarkColor: ResourceColor = '#2C2C2C' // (44, 44, 44) // icon颜色 static readonly kIconColor: ResourceColor = '#646464' // (100, 100, 100) static readonly kIconDarkColor: ResourceColor = '#C8C8C8' // (200, 200, 200) static readonly kTagWarningColor: ResourceColor = '#FFBA00' static readonly kTagErrorColor: ResourceColor = '#FF4949' static readonly kTagSuccessColor: ResourceColor = '#13CE66' // 微信主题色 rgb(59,184,21) static readonly wxThemeColor: ResourceColor = '#3BB815' static readonly wxThemeDarkColor: ResourceColor = '#00BE66' // rgb(50, 179, 116) static readonly wxPayColor: ResourceColor = '#32B374' // rgb(0, 174, 91) static readonly wxTextColor: ResourceColor = '#00AE5B' // rgb(255, 139, 34) static readonly wxTextOrangeColor: ResourceColor = '#FF8B22' static readonly wxTitleColor: ResourceColor = Color.White // 微信背景色 rgb(237,237,237) static readonly wxBgColor: ResourceColor = '#EDEDED' // 深蓝色 static readonly wxTextBlueColor: ResourceColor = '#586D98' static readonly transparent: ResourceColor = Color.Transparent }
AST#export_declaration#Left export AST#class_declaration#Left class KColors AST#class_body#Left { // 主题色(导航条背景、提交按钮背景、弹框确认文字、表单图标录入光标) // 暗黑模式高亮显示颜色按kThemeColor设置,如tabBar选中文字图标、提交按钮背景色、指示器选中下划线、光标等 AST#property_declaration#Left static readonly kThemeColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#3BB815' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kThemeDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#0A0A0A' AST#expression#Right // (10, 10, 10) AST#property_declaration#Right AST#property_declaration#Left static readonly kThemeBlueColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#4688FA' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kThemePurpleColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#9C27B0' AST#expression#Right // 渐变色(appBar和按钮) AST#property_declaration#Right AST#property_declaration#Left static readonly kGradientStartColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2683BE' AST#expression#Right // 渐变开始色 AST#property_declaration#Right AST#property_declaration#Left static readonly kGradientEndColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#34CABE' AST#expression#Right // 渐变结束色 // 导航条背景色(主题色背景白色文字,透明背景为黑色文字,暗黑模式是白色文字) AST#property_declaration#Right AST#property_declaration#Left static readonly kNavThemeBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kThemeColor AST#member_expression#Right AST#expression#Right // 导航条背景色(白色背景色黑色文字,透明背景为黑色文字,暗黑模式是白色文字) AST#property_declaration#Right AST#property_declaration#Left static readonly kNavWhiteBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EDEDED' AST#expression#Right //(237, 237, 237) AST#property_declaration#Right AST#property_declaration#Left static readonly kNavBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kThemeDarkColor AST#member_expression#Right AST#expression#Right // (10, 10, 10) AST#property_declaration#Right AST#property_declaration#Left static readonly kNavTitleColor : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right // tabBar背景颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kTabBarBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kTabBarBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1D1D1D' AST#expression#Right // (29, 29, 29) // tabBar默认文字颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kTabBarNormalTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#333333' AST#expression#Right // (51, 51, 51) AST#property_declaration#Right AST#property_declaration#Left static readonly kTabBarNormalTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#C6C6C6' AST#expression#Right // (198, 198, 198) // tabBar选中文字颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kTabBarSelectTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kThemeColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kTabBarSelectTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kThemeColor AST#member_expression#Right AST#expression#Right // 背景色 AST#property_declaration#Right AST#property_declaration#Left static readonly kBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#F8F8F8' AST#expression#Right // (248, 248, 248) AST#property_declaration#Right AST#property_declaration#Left static readonly kBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#111111' AST#expression#Right // (17, 17, 17) // cell背景 AST#property_declaration#Right AST#property_declaration#Left static readonly kCellBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kCellBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#191919' AST#expression#Right // (25, 25, 25) AST#property_declaration#Right AST#property_declaration#Left static readonly kMaterialBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FFFFFF' AST#expression#Right // (255, 255, 255) AST#property_declaration#Right AST#property_declaration#Left static readonly kMaterialBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#303233' AST#expression#Right // (48, 50, 51) // btn背景颜色 // static readonly kBtnBgColor : ResourceColor = kThemeColor // static readonly kBtnBgDarkColor : ResourceColor = Color(0xFF2B2B2B) // (43, 43, 43) // 黑色文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kBlackTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#333333' AST#expression#Right // (51, 51, 51) AST#property_declaration#Right AST#property_declaration#Left static readonly kBlackTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#C6C6C6' AST#expression#Right // (198, 198, 198) // 灰色文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kGreyTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#777777' AST#expression#Right // (119, 119, 119) AST#property_declaration#Right AST#property_declaration#Left static readonly kGreyTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#787878' AST#expression#Right // (120, 120, 120) // 浅灰色文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kLightGreyTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#999999' AST#expression#Right // (153, 153, 153) AST#property_declaration#Right AST#property_declaration#Left static readonly kLightGreyTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#666666' AST#expression#Right // (102, 102, 102) // 表单title文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kFormTitleColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kFormTitleDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextDarkColor AST#member_expression#Right AST#expression#Right // 表单info文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kFormInfoColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kFormInfoDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextDarkColor AST#member_expression#Right AST#expression#Right // 表单hint文字 AST#property_declaration#Right AST#property_declaration#Left static readonly kFormHintColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#BBBBBB' AST#expression#Right // (187, 187, 187) AST#property_declaration#Right AST#property_declaration#Left static readonly kFormHintDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#575757' AST#expression#Right // (87, 87, 87) // 分割线 AST#property_declaration#Right AST#property_declaration#Left static readonly kLineColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#E6E6E6' AST#expression#Right // (230, 230, 230) AST#property_declaration#Right AST#property_declaration#Left static readonly kLineDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#232323' AST#expression#Right // (35, 35, 35) // 表单分割线 AST#property_declaration#Right AST#property_declaration#Left static readonly kFormLineColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kLineColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kFormLineDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kLineDarkColor AST#member_expression#Right AST#expression#Right // 表单暗黑模式Focused状态下划线颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kFocusedBorderDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kLineColor AST#member_expression#Right AST#expression#Right // error颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kErrorTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FF4759' AST#expression#Right // (255, 71, 89) AST#property_declaration#Right AST#property_declaration#Left static readonly kErrorTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#E03E4E' AST#expression#Right // (224, 62, 78) // 搜索框颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kSearchBarBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kCellBgColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kSearchBarBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kCellBgDarkColor AST#member_expression#Right AST#expression#Right // textView背景颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kTextViewBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FAFAFA' AST#expression#Right // (250, 250, 250) AST#property_declaration#Right AST#property_declaration#Left static readonly kTextViewBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#323232' AST#expression#Right // (50, 50, 50) // toast背景颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kToastBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#202020' AST#expression#Right // (32, 32, 32) AST#property_declaration#Right AST#property_declaration#Left static readonly kToastBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2F2F2F' AST#expression#Right // (47, 47, 47) // alert背景颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kAlertBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kAlertBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2C2C2C' AST#expression#Right // (44, 44, 44) AST#property_declaration#Right AST#property_declaration#Left static readonly kAlertInputBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kAlertInputBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1E1E1E' AST#expression#Right // (30, 30, 30) // picker、bottomSheet颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kPickerBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1E1E1E' AST#expression#Right // (30, 30, 30) AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerTitleColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#787878' AST#expression#Right // (120, 120, 120) AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerTitleDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#878787' AST#expression#Right // (135, 135, 135) AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextDarkColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerRedTextDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#E64242' AST#expression#Right // (230, 66, 66) AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerHeaderColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kPickerBgColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerHeaderDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kPickerBgDarkColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerHeaderLineColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kLineColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerHeaderLineDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kLineDarkColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerBtnColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextColor AST#member_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kPickerBtnDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . kBlackTextDarkColor AST#member_expression#Right AST#expression#Right // card颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kCardBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#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_declaration#Right AST#property_declaration#Left static readonly kCardBgDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2C2C2C' AST#expression#Right // (44, 44, 44) // icon颜色 AST#property_declaration#Right AST#property_declaration#Left static readonly kIconColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#646464' AST#expression#Right // (100, 100, 100) AST#property_declaration#Right AST#property_declaration#Left static readonly kIconDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#C8C8C8' AST#expression#Right // (200, 200, 200) AST#property_declaration#Right AST#property_declaration#Left static readonly kTagWarningColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FFBA00' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kTagErrorColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FF4949' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly kTagSuccessColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#13CE66' AST#expression#Right // 微信主题色 rgb(59,184,21) AST#property_declaration#Right AST#property_declaration#Left static readonly wxThemeColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#3BB815' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly wxThemeDarkColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#00BE66' AST#expression#Right // rgb(50, 179, 116) AST#property_declaration#Right AST#property_declaration#Left static readonly wxPayColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#32B374' AST#expression#Right // rgb(0, 174, 91) AST#property_declaration#Right AST#property_declaration#Left static readonly wxTextColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#00AE5B' AST#expression#Right // rgb(255, 139, 34) AST#property_declaration#Right AST#property_declaration#Left static readonly wxTextOrangeColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FF8B22' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly wxTitleColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right // 微信背景色 rgb(237,237,237) AST#property_declaration#Right AST#property_declaration#Left static readonly wxBgColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#EDEDED' AST#expression#Right // 深蓝色 AST#property_declaration#Right AST#property_declaration#Left static readonly wxTextBlueColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#586D98' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly transparent : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class KColors { static readonly kThemeColor: ResourceColor = '#3BB815' static readonly kThemeDarkColor: ResourceColor = '#0A0A0A' static readonly kThemeBlueColor: ResourceColor = '#4688FA' static readonly kThemePurpleColor: ResourceColor = '#9C27B0' static readonly kGradientStartColor: ResourceColor = '#2683BE' static readonly kGradientEndColor: ResourceColor = '#34CABE' static readonly kNavThemeBgColor: ResourceColor = this.kThemeColor static readonly kNavWhiteBgColor: ResourceColor = '#EDEDED' static readonly kNavBgDarkColor: ResourceColor = this.kThemeDarkColor static readonly kNavTitleColor: Color = Color.White static readonly kTabBarBgColor: ResourceColor = Color.White static readonly kTabBarBgDarkColor: ResourceColor = '#1D1D1D' static readonly kTabBarNormalTextColor: ResourceColor = '#333333' static readonly kTabBarNormalTextDarkColor: ResourceColor = '#C6C6C6' static readonly kTabBarSelectTextColor: ResourceColor = this.kThemeColor static readonly kTabBarSelectTextDarkColor: ResourceColor = this.kThemeColor static readonly kBgColor: ResourceColor = '#F8F8F8' static readonly kBgDarkColor: ResourceColor = '#111111' static readonly kCellBgColor: ResourceColor = Color.White static readonly kCellBgDarkColor: ResourceColor = '#191919' static readonly kMaterialBgColor: ResourceColor = '#FFFFFF' static readonly kMaterialBgDarkColor: ResourceColor = '#303233' static readonly kBlackTextColor: ResourceColor = '#333333' static readonly kBlackTextDarkColor: ResourceColor = '#C6C6C6' static readonly kGreyTextColor: ResourceColor = '#777777' static readonly kGreyTextDarkColor: ResourceColor = '#787878' static readonly kLightGreyTextColor: ResourceColor = '#999999' static readonly kLightGreyTextDarkColor: ResourceColor = '#666666' static readonly kFormTitleColor: ResourceColor = this.kBlackTextColor static readonly kFormTitleDarkColor: ResourceColor = this.kBlackTextDarkColor static readonly kFormInfoColor: ResourceColor = this.kBlackTextColor static readonly kFormInfoDarkColor: ResourceColor = this.kBlackTextDarkColor static readonly kFormHintColor: ResourceColor = '#BBBBBB' static readonly kFormHintDarkColor: ResourceColor = '#575757' static readonly kLineColor: ResourceColor = '#E6E6E6' static readonly kLineDarkColor: ResourceColor = '#232323' static readonly kFormLineColor: ResourceColor = this.kLineColor static readonly kFormLineDarkColor: ResourceColor = this.kLineDarkColor static readonly kFocusedBorderDarkColor: ResourceColor = this.kLineColor static readonly kErrorTextColor: ResourceColor = '#FF4759' static readonly kErrorTextDarkColor: ResourceColor = '#E03E4E' static readonly kSearchBarBgColor: ResourceColor = this.kCellBgColor static readonly kSearchBarBgDarkColor: ResourceColor = this.kCellBgDarkColor static readonly kTextViewBgColor: ResourceColor = '#FAFAFA' static readonly kTextViewBgDarkColor: ResourceColor = '#323232' static readonly kToastBgColor: ResourceColor = '#202020' static readonly kToastBgDarkColor: ResourceColor = '#2F2F2F' static readonly kAlertBgColor: ResourceColor = Color.White static readonly kAlertBgDarkColor: ResourceColor = '#2C2C2C' static readonly kAlertInputBgColor: ResourceColor = Color.White static readonly kAlertInputBgDarkColor: ResourceColor = '#1E1E1E' static readonly kPickerBgColor: ResourceColor = Color.White static readonly kPickerBgDarkColor: ResourceColor = '#1E1E1E' static readonly kPickerTitleColor: ResourceColor = '#787878' static readonly kPickerTitleDarkColor: ResourceColor = '#878787' static readonly kPickerTextColor: ResourceColor = this.kBlackTextColor static readonly kPickerTextDarkColor: ResourceColor = this.kBlackTextDarkColor static readonly kPickerRedTextDarkColor: ResourceColor = '#E64242' static readonly kPickerHeaderColor: ResourceColor = this.kPickerBgColor static readonly kPickerHeaderDarkColor: ResourceColor = this.kPickerBgDarkColor static readonly kPickerHeaderLineColor: ResourceColor = this.kLineColor static readonly kPickerHeaderLineDarkColor: ResourceColor = this.kLineDarkColor static readonly kPickerBtnColor: ResourceColor = this.kBlackTextColor static readonly kPickerBtnDarkColor: ResourceColor = this.kBlackTextDarkColor static readonly kCardBgColor: ResourceColor = Color.White static readonly kCardBgDarkColor: ResourceColor = '#2C2C2C' static readonly kIconColor: ResourceColor = '#646464' static readonly kIconDarkColor: ResourceColor = '#C8C8C8' static readonly kTagWarningColor: ResourceColor = '#FFBA00' static readonly kTagErrorColor: ResourceColor = '#FF4949' static readonly kTagSuccessColor: ResourceColor = '#13CE66' static readonly wxThemeColor: ResourceColor = '#3BB815' static readonly wxThemeDarkColor: ResourceColor = '#00BE66' static readonly wxPayColor: ResourceColor = '#32B374' static readonly wxTextColor: ResourceColor = '#00AE5B' static readonly wxTextOrangeColor: ResourceColor = '#FF8B22' static readonly wxTitleColor: ResourceColor = Color.White static readonly wxBgColor: ResourceColor = '#EDEDED' static readonly wxTextBlueColor: ResourceColor = '#586D98' static readonly transparent: ResourceColor = Color.Transparent }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/configs/Colors.ets#L6-L141
fa469460dd6450efc74bd3f754a9d06f144613d6
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
drawImage
Draw image.
private drawImage(): void { if (this.ctx !== undefined) { this.ctx.save(); this.clearCanvas(); let x = this.displayWidth / 2; let y = this.displayHeight / 2; this.ctx.translate(this.isFlipHorizontal ? 2 * x : 0, this.isFlipVertically ? 2 * y : 0); let tX = this.isFlipHorizontal ? -1 : 1; let tY = this.isFlipVertically ? -1 : 1; this.ctx.scale(tX, tY); this.ctx.translate(x, y); this.ctx.rotate(MathUtils.formulaAngle(this.rotationAngle * tX * tY + this.sliderAngle)); this.ctx.translate(-x, -y); let image = this.cropShow.getImageRect(); MathUtils.roundOutRect(image); if (this.input !== undefined) { this.ctx.drawImage(this.input.pixelMap, image.left, image.top, image.getWidth(), image.getHeight()); } this.ctx.restore(); } }
AST#method_declaration#Left private drawImage 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#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 . ctx 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#ERROR#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 . ctx AST#member_expression#Right AST#expression#Right . save 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 . clearCanvas 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 let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left x = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left y = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayHeight AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right 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 . translate AST#member_expression#Right AST#expression#Right ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipHorizontal AST#member_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left 2 AST#expression#Right * x : 0 AST#ERROR#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right AST#expression#Right ? AST#expression#Left 2 AST#expression#Right * y : 0 ) ; AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left tX = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipHorizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left 1 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#variable_declaration#Left let AST#variable_declarator#Left tY = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFlipVertically AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left 1 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left tX AST#expression#Right , AST#expression#Left tY 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 this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . translate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y 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 this AST#expression#Right . ctx AST#member_expression#Right AST#expression#Right . rotate 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 MathUtils AST#expression#Right . formulaAngle 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 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 . rotationAngle AST#member_expression#Right AST#expression#Right * AST#expression#Left tX AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left tY AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . sliderAngle AST#member_expression#Right 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#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 . translate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left x AST#expression#Right AST#unary_expression#Right AST#expression#Right , AST#expression#Left AST#unary_expression#Left - AST#expression#Left y AST#expression#Right AST#unary_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#variable_declaration#Left let AST#variable_declarator#Left image = 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 . cropShow AST#member_expression#Right AST#expression#Right . getImageRect 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 MathUtils AST#expression#Right . roundOutRect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left image 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 this AST#expression#Right . input 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#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 . ctx AST#member_expression#Right AST#expression#Right . drawImage 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 . input AST#member_expression#Right AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . left AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . top AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . getWidth 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . getHeight 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#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 . ctx AST#member_expression#Right AST#expression#Right . restore 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#method_declaration#Right
private drawImage(): void { if (this.ctx !== undefined) { this.ctx.save(); this.clearCanvas(); let x = this.displayWidth / 2; let y = this.displayHeight / 2; this.ctx.translate(this.isFlipHorizontal ? 2 * x : 0, this.isFlipVertically ? 2 * y : 0); let tX = this.isFlipHorizontal ? -1 : 1; let tY = this.isFlipVertically ? -1 : 1; this.ctx.scale(tX, tY); this.ctx.translate(x, y); this.ctx.rotate(MathUtils.formulaAngle(this.rotationAngle * tX * tY + this.sliderAngle)); this.ctx.translate(-x, -y); let image = this.cropShow.getImageRect(); MathUtils.roundOutRect(image); if (this.input !== undefined) { this.ctx.drawImage(this.input.pixelMap, image.left, image.top, image.getWidth(), image.getHeight()); } this.ctx.restore(); } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L463-L487
98a6a8caf84ade4466cad9e0d32ff780b1b82152
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
sortPartsAndUnits
对parts和units进行排序
private sortPartsAndUnits(): void { // 对parts按partId升序排序 this.parts.sort((a, b) => { return (a.partId || 0) - (b.partId || 0); }); // 对units按unitId升序排序 this.units.sort((a, b) => { return (a.unitId || 0) - (b.unitId || 0); }); // 对每个part中的units按unitId排序 for (let i = 0; i < this.parts.length; i++) { const part = this.parts[i]; if (part.units && part.units.length > 0) { part.units.sort((a, b) => { return (a.unitId || 0) - (b.unitId || 0); }); } } }
AST#method_declaration#Left private sortPartsAndUnits 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 { // 对parts按partId升序排序 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 . parts AST#member_expression#Right 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return 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 a AST#expression#Right . partId 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 AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . partId 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#binary_expression#Right AST#expression#Right ; AST#return_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 // 对units按unitId升序排序 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 . units AST#member_expression#Right 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return 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 a AST#expression#Right . unitId 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 AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . unitId 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#binary_expression#Right AST#expression#Right ; AST#return_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 // 对每个part中的units按unitId排序 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . parts 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 i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left part = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parts AST#member_expression#Right 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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left part AST#expression#Right . units AST#member_expression#Right AST#expression#Right && AST#expression#Left part AST#expression#Right AST#binary_expression#Right AST#expression#Right . units 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#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 part AST#expression#Right . units AST#member_expression#Right 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return 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 a AST#expression#Right . unitId 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 AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . unitId 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#binary_expression#Right AST#expression#Right ; AST#return_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#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private sortPartsAndUnits(): void { this.parts.sort((a, b) => { return (a.partId || 0) - (b.partId || 0); }); this.units.sort((a, b) => { return (a.unitId || 0) - (b.unitId || 0); }); for (let i = 0; i < this.parts.length; i++) { const part = this.parts[i]; if (part.units && part.units.length > 0) { part.units.sort((a, b) => { return (a.unitId || 0) - (b.unitId || 0); }); } } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L278-L298
40fdba10b29ed1a3bb8c00a396215c620fd0deb0
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.fs.d.ets
arkts
RandomAccessFileOptions type @interface RandomAccessFileOptions @syscap SystemCapability.FileManagement.File.FileIO @since 20
export interface RandomAccessFileOptions { /** * The starting position of file offset. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ start?: number; /** * The ending position of file offset. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ end?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RandomAccessFileOptions AST#object_type#Left { /** * The starting position of file offset. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left start ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The ending position of file offset. * * @type { ?number } * @syscap SystemCapability.FileManagement.File.FileIO * @since 20 */ AST#type_member#Left end ? : AST#type_annotation#Left AST#primary_type#Left number 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 RandomAccessFileOptions { start?: number; end?: number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4460-L4478
76d0c9c7e7e2bc8582644afb28778dc9b7a6a6c2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets
arkts
normalProcess
非原子操作,进行10000次++
@Concurrent function normalProcess(int32Array: Int32Array) { for (let i = 0; i < 10000; i++) { int32Array[0]++; } }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function normalProcess AST#parameter_list#Left ( AST#parameter#Left int32Array : AST#type_annotation#Left AST#primary_type#Left Int32Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { 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#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left 10000 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left int32Array AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#decorated_function_declaration#Right
@Concurrent function normalProcess(int32Array: Int32Array) { for (let i = 0; i < 10000; i++) { int32Array[0]++; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets#L97-L102
78b4ee76d4ca625bd5e3014418b3e9d1ce50ef08
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/SoundEffect/SEManager.ets
arkts
get
获取单例实例
public static get shared(): SEService { if (!SEService.instance) { SEService.instance = new SEService(); } return SEService.instance; }
AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SEService 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left SEService AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left SEService AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SEService 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left SEService AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public static get shared(): SEService { if (!SEService.instance) { SEService.instance = new SEService(); } return SEService.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L30-L35
174716212c0b7cf663f4d3d729cdcf6b7d271e45
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/constants/CommonConstants.ets
arkts
全局常量定义
export class CommonConstants { /** * 字体大小定义 */ static readonly FONT_SIZE_SMALL: number = 14; static readonly FONT_SIZE_NORMAL: number = 16; static readonly FONT_SIZE_LARGE: number = 20; static readonly FONT_SIZE_XLARGE: number = 24; /** * 边距定义 */ static readonly MARGIN_SMALL: number = 4; static readonly MARGIN_NORMAL: number = 8; static readonly MARGIN_LARGE: number = 16; static readonly MARGIN_XLARGE: number = 24; /** * 圆角定义 */ static readonly RADIUS_SMALL: number = 4; static readonly RADIUS_NORMAL: number = 8; static readonly RADIUS_LARGE: number = 16; /** * 颜色定义 */ static readonly COLOR_PRIMARY: string = '#2196F3'; static readonly COLOR_PRIMARY_DARK: string = '#1976D2'; static readonly COLOR_ACCENT: string = '#FF4081'; static readonly COLOR_BACKGROUND: string = '#F5F5F5'; static readonly COLOR_TEXT_PRIMARY: string = '#333333'; static readonly COLOR_TEXT_SECONDARY: string = '#666666'; static readonly COLOR_TEXT_TERTIARY: string = '#999999'; /** * 梦想分类 */ static readonly DREAM_CATEGORIES: string[] = ['学习', '健康', '旅行', '创作', '艺术', '职业', '生活技能']; /** * 梦想优先级 */ static readonly DREAM_PRIORITIES: number[] = [1, 2, 3, 4, 5]; static readonly DREAM_PRIORITY_LABELS: string[] = ['最高', '较高', '中等', '较低', '最低']; /** * 梦想状态 */ static readonly DREAM_STATUS_NOT_STARTED: number = 0; static readonly DREAM_STATUS_IN_PROGRESS: number = 1; static readonly DREAM_STATUS_COMPLETED: number = 2; static readonly DREAM_STATUS_ABANDONED: number = 3; /** * 梦想状态标签 */ static readonly DREAM_STATUS_LABELS: string[] = ['未开始', '进行中', '已完成', '已放弃']; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * 字体大小定义 */ AST#property_declaration#Left static readonly FONT_SIZE_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 14 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FONT_SIZE_NORMAL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FONT_SIZE_LARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly FONT_SIZE_XLARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right /** * 边距定义 */ AST#property_declaration#Left static readonly MARGIN_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_NORMAL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_LARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly MARGIN_XLARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right /** * 圆角定义 */ AST#property_declaration#Left static readonly RADIUS_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly RADIUS_NORMAL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly RADIUS_LARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right ; AST#property_declaration#Right /** * 颜色定义 */ AST#property_declaration#Left static readonly COLOR_PRIMARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#2196F3' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_PRIMARY_DARK : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#1976D2' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_ACCENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#FF4081' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_BACKGROUND : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#F5F5F5' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_TEXT_PRIMARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#333333' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_TEXT_SECONDARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#666666' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly COLOR_TEXT_TERTIARY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#999999' AST#expression#Right ; AST#property_declaration#Right /** * 梦想分类 */ AST#property_declaration#Left static readonly DREAM_CATEGORIES : 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#expression#Left '学习' AST#expression#Right , AST#expression#Left '健康' AST#expression#Right , AST#expression#Left '旅行' AST#expression#Right , AST#expression#Left '创作' AST#expression#Right , 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 ; AST#property_declaration#Right /** * 梦想优先级 */ AST#property_declaration#Left static readonly DREAM_PRIORITIES : 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#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#expression#Left 4 AST#expression#Right , AST#expression#Left 5 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DREAM_PRIORITY_LABELS : 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#expression#Left '最高' AST#expression#Right , AST#expression#Left '较高' AST#expression#Right , 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 ; AST#property_declaration#Right /** * 梦想状态 */ AST#property_declaration#Left static readonly DREAM_STATUS_NOT_STARTED : 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#property_declaration#Left static readonly DREAM_STATUS_IN_PROGRESS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DREAM_STATUS_COMPLETED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DREAM_STATUS_ABANDONED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /** * 梦想状态标签 */ AST#property_declaration#Left static readonly DREAM_STATUS_LABELS : 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#expression#Left '未开始' AST#expression#Right , 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 ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { static readonly FONT_SIZE_SMALL: number = 14; static readonly FONT_SIZE_NORMAL: number = 16; static readonly FONT_SIZE_LARGE: number = 20; static readonly FONT_SIZE_XLARGE: number = 24; static readonly MARGIN_SMALL: number = 4; static readonly MARGIN_NORMAL: number = 8; static readonly MARGIN_LARGE: number = 16; static readonly MARGIN_XLARGE: number = 24; static readonly RADIUS_SMALL: number = 4; static readonly RADIUS_NORMAL: number = 8; static readonly RADIUS_LARGE: number = 16; static readonly COLOR_PRIMARY: string = '#2196F3'; static readonly COLOR_PRIMARY_DARK: string = '#1976D2'; static readonly COLOR_ACCENT: string = '#FF4081'; static readonly COLOR_BACKGROUND: string = '#F5F5F5'; static readonly COLOR_TEXT_PRIMARY: string = '#333333'; static readonly COLOR_TEXT_SECONDARY: string = '#666666'; static readonly COLOR_TEXT_TERTIARY: string = '#999999'; static readonly DREAM_CATEGORIES: string[] = ['学习', '健康', '旅行', '创作', '艺术', '职业', '生活技能']; static readonly DREAM_PRIORITIES: number[] = [1, 2, 3, 4, 5]; static readonly DREAM_PRIORITY_LABELS: string[] = ['最高', '较高', '中等', '较低', '最低']; static readonly DREAM_STATUS_NOT_STARTED: number = 0; static readonly DREAM_STATUS_IN_PROGRESS: number = 1; static readonly DREAM_STATUS_COMPLETED: number = 2; static readonly DREAM_STATUS_ABANDONED: number = 3; static readonly DREAM_STATUS_LABELS: string[] = ['未开始', '进行中', '已完成', '已放弃']; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/constants/CommonConstants.ets#L4-L62
c5d836c55e9d2a8b3c7bfbb7ebdbdb176e71e26d
github
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/core/MyWrapper.ets
arkts
getUpdate
拼接set语句
getUpdate() { return this.updateList.join(",") }
AST#method_declaration#Left getUpdate AST#parameter_list#Left ( ) 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateList AST#member_expression#Right AST#expression#Right . join 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getUpdate() { return this.updateList.join(",") }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/MyWrapper.ets#L74-L76
fc6fc0c1e86743b411c4e7d555407907862b5963
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/GattClientManager.ets
arkts
[EndExclude generic_attribute]
export class GattData { public serviceUuid: string = '00001810-0000-1000-8000-00805F9B34FB'; public characteristicUuid: string = '00001820-0000-1000-8000-00805F9B34FB'; public descriptorUuid: string = '00002902-0000-1000-8000-00805F9B34FB'; public characteristicValue: string = ''; public descriptorValue: string = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class GattData AST#class_body#Left { AST#property_declaration#Left public serviceUuid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '00001810-0000-1000-8000-00805F9B34FB' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public characteristicUuid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '00001820-0000-1000-8000-00805F9B34FB' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public descriptorUuid : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '00002902-0000-1000-8000-00805F9B34FB' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public characteristicValue : 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 public descriptorValue : 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class GattData { public serviceUuid: string = '00001810-0000-1000-8000-00805F9B34FB'; public characteristicUuid: string = '00001820-0000-1000-8000-00805F9B34FB'; public descriptorUuid: string = '00002902-0000-1000-8000-00805F9B34FB'; public characteristicValue: string = ''; public descriptorValue: string = ''; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/bluetoothService/GattClientManager.ets#L28-L34
ed1dbe99e557d3c97104853f89208c1444a296f3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
AI设置接口
export interface AISettings { enabled: boolean; provider: string; personalization: boolean; responseLength: string; creativity: number; language: Language; apiProvider: AIProvider; apiKey: string; apiUrl?: string; model: string; maxTokens: number; temperature: number; customPrompt?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AISettings AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left personalization : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left responseLength : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left creativity : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left Language AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiProvider : AST#type_annotation#Left AST#primary_type#Left AIProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiUrl ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left model : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left maxTokens : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left temperature : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left customPrompt ? : 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 AISettings { enabled: boolean; provider: string; personalization: boolean; responseLength: string; creativity: number; language: Language; apiProvider: AIProvider; apiKey: string; apiUrl?: string; model: string; maxTokens: number; temperature: number; customPrompt?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L199-L213
75099387637c522caf4d89006bd0ea02b66af15f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CartPage.ets
arkts
onPageIndexChange
监听 main 页面当前选中的页面索引变化
@Monitor('currentPageIndex') onPageIndexChange() { if (this.currentPageIndex === 2) { this.vm.loadCartData(); } }
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'currentPageIndex' AST#expression#Right ) AST#decorator#Right onPageIndexChange 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 this AST#expression#Right . currentPageIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left 2 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#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . loadCartData 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#builder_function_body#Right AST#method_declaration#Right
@Monitor('currentPageIndex') onPageIndexChange() { if (this.currentPageIndex === 2) { this.vm.loadCartData(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L35-L40
55fada402a38d572d20ddc06f38a45b913cd9dee
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/entryability/EntryAbility.ets
arkts
handleNewIntent
处理新的启动意图 @param want Want信息
private handleNewIntent(want: Want): void { // 解析启动参数 if (want.parameters) { const action = want.parameters['action'] as string; const data = want.parameters['data'] as string; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Handle new intent - action: %{public}s, data: %{public}s', action || 'none', data || 'none'); // 根据不同的action处理不同的业务逻辑 switch (action) { case 'birthday_reminder': // 处理生日提醒通知点击 this.handleBirthdayReminderIntent(data); break; case 'add_contact': // 处理添加联系人意图 this.handleAddContactIntent(data);
AST#method_declaration#Left private handleNewIntent AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { // 解析启动参数 if ( AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right ) { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left action = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'action' AST#expression#Right ] AST#subscript_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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left data = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left want AST#expression#Right . parameters AST#member_expression#Right AST#expression#Right [ AST#expression#Left 'data' AST#expression#Right ] AST#subscript_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#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 . 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_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left 'Handle new intent - action: %{public}s, data: %{public}s' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left action AST#expression#Right || AST#expression#Left 'none' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right || AST#expression#Left 'none' 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 // 根据不同的action处理不同的业务逻辑 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left action 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#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'birthday_reminder' AST#property_name#Right : // 处理生日提醒通知点击 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handleBirthdayReminderIntent 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#property_assignment#Right AST#object_literal#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'add_contact' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // 处理添加联系人意图 AST#ERROR#Left AST#qualified_type#Left this . handleAddContactIntent 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 data AST#primary_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
private handleNewIntent(want: Want): void { if (want.parameters) { const action = want.parameters['action'] as string; const data = want.parameters['data'] as string; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Handle new intent - action: %{public}s, data: %{public}s', action || 'none', data || 'none'); switch (action) { case 'birthday_reminder': this.handleBirthdayReminderIntent(data); break; case 'add_contact': this.handleAddContactIntent(data);
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L204-L221
bd24886b97f9763acb119c836105330ab49af210
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets
arkts
[EndExclude set_gesture_judge]
build() { NavDestination() { Column({ space: 12 }) { Text($r('app.string.gesture_GestureJudge_text')) .fontSize(14) .fontColor('#666') Stack({ alignContent: Alignment.TopStart }) { Scroll(this.scroller) { // 外部滚动容器 Column() { Text('Scroll Area') .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) Scroll(this.scroller2) { // 内部滚动容器 Column() { Text('Scroll Area2') .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) Column() { ForEach(this.arr, (item: number) => { Text(item.toString()) .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) }, (item: string) => item) }.width('100%') } } .id('inner') .width('100%') .height(800) }.width('100%') } .id('outer') .height(600) .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 .scrollBar(BarState.On) // 滚动条常驻显示 .scrollBarColor(Color.Gray) // 滚动条颜色 .scrollBarWidth(10) // 滚动条宽度 .edgeEffect(EdgeEffect.None) .shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array<GestureRecognizer>) => { for (let i = 0; i < others.length; i++) { let target = others[i].getEventTargetInfo(); if (target.getId() == 'inner' && others[i].isBuiltIn() && others[i].getType() == GestureControl.GestureType.PAN_GESTURE) { // 找到将要组成并行手势的识别器 this.currentRecognizer = current; // 保存当前组件的识别器 this.childRecognizer = others[i]; // 保存将要组成并行手势的识别器 return others[i]; // 返回和当前手势将要组成并行手势的识别器 } } return undefined; }) .onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer, others: Array<GestureRecognizer>) => { // 在识别器即将要成功时,根据当前组件状态,设置识别器使能状态 let target = current.getEventTargetInfo(); if (target.getId() == 'outer' && current.isBuiltIn() && current.getType() == GestureControl.GestureType.PAN_GESTURE) { for (let i = 0; i < others.length; i++) { let target = others[i].getEventTargetInfo() as ScrollableTargetInfo; if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') { // 找到响应链上对应并行的识别器 let panEvent = event as PanGestureEvent; this.childRecognizer.setEnabled(true); this.currentRecognizer.setEnabled(false); if (target.isEnd()) { // 根据当前组件状态以及移动方向动态控制识别器使能状态 if (panEvent && panEvent.offsetY < 0) { this.childRecognizer.setEnabled(false); this.currentRecognizer.setEnabled(true); } } else if (target.isBegin()) { if (panEvent.offsetY > 0) { this.childRecognizer.setEnabled(false); this.currentRecognizer.setEnabled(true); } } } } } return GestureJudgeResult.CONTINUE; }) // [StartExclude set_gesture_judge] .parallelGesture( // 绑定一个Pan手势作为动态控制器 PanGesture() .onActionUpdate((event: GestureEvent) => { if (this.childRecognizer.getState() != GestureRecognizerState.SUCCESSFUL || this.currentRecognizer.getState() != GestureRecognizerState.SUCCESSFUL) { // 如果识别器状态不是SUCCESSFUL,则不做控制 return; } let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo; let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo; if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) { this.childRecognizer.setEnabled(true); this.currentRecognizer.setEnabled(false); if (target.isEnd()) { // 在移动过程中实时根据当前组件状态,控制识别器的开闭状态 if ((event.offsetY - this.lastOffset) < 0) { this.childRecognizer.setEnabled(false); if (currentTarget.isEnd()) { this.currentRecognizer.setEnabled(false); } else { this.currentRecognizer.setEnabled(true); } } } else if (target.isBegin()) { if ((event.offsetY - this.lastOffset) > 0) { this.childRecognizer.setEnabled(false); if (currentTarget.isBegin()) { this.currentRecognizer.setEnabled(false); } else { this.currentRecognizer.setEnabled(true); } } } } this.lastOffset = event.offsetY; }) ) // [EndExclude set_gesture_judge] }.width('100%').height('90%').backgroundColor(0xDCDCDC) } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.gesture_GestureJudge_title')) }
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 Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.gesture_GestureJudge_text' AST#expression#Right ) AST#resource_expression#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 '#666' 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 Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopStart 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 Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#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 'Scroll Area' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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#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#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 Scroll ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller2 AST#member_expression#Right AST#expression#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 'Scroll Area2' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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#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#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 Column ( ) 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 . arr 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 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 Text ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item 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#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 150 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xFFFFFF AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 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#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#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#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : 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#expression#Left item 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'inner' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 800 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#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 . id ( AST#expression#Left 'outer' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 600 AST#expression#Right ) AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Vertical AST#member_expression#Right AST#expression#Right ) // 滚动方向纵向 AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . On AST#member_expression#Right AST#expression#Right ) // 滚动条常驻显示 AST#modifier_chain_expression#Left . scrollBarColor ( 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 . scrollBarWidth ( AST#expression#Left 10 AST#expression#Right ) // 滚动条宽度 AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shouldBuiltInRecognizerParallelWith ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left others : 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 GestureRecognizer 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#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 others 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#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getEventTargetInfo 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#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#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . getId 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 'inner' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBuiltIn 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#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . getType 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 GestureControl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GestureType AST#member_expression#Right AST#expression#Right . PAN_GESTURE 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 . currentRecognizer AST#member_expression#Right = AST#expression#Left current 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 . childRecognizer AST#member_expression#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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 AST#subscript_expression#Left AST#expression#Left others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_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#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left undefined AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onGestureRecognizerJudgeBegin ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left BaseGestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left GestureRecognizer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left others : 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 GestureRecognizer 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#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . getEventTargetInfo 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#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#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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . getId 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 'outer' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left current AST#expression#Right AST#binary_expression#Right AST#expression#Right . isBuiltIn 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 current AST#expression#Right AST#binary_expression#Right AST#expression#Right . getType 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 GestureControl AST#expression#Right AST#binary_expression#Right AST#expression#Right . GestureType AST#member_expression#Right AST#expression#Right . PAN_GESTURE AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { 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 others 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#variable_declaration#Left let AST#variable_declarator#Left target = AST#expression#Left AST#as_expression#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 others AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo 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#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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left target AST#expression#Right AST#binary_expression#Right AST#expression#Right . getId 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 'inner' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 找到响应链上对应并行的识别器 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left panEvent = AST#expression#Left AST#as_expression#Left AST#expression#Left event AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left PanGestureEvent 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isEnd 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#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 panEvent AST#expression#Right && AST#expression#Left panEvent AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetY 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#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isBegin 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left panEvent AST#expression#Right . offsetY 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#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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#for_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 AST#member_expression#Left AST#expression#Left GestureJudgeResult AST#expression#Right . CONTINUE AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) // [StartExclude set_gesture_judge] AST#modifier_chain_expression#Left . parallelGesture ( // 绑定一个Pan手势作为动态控制器 AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left PanGesture AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionUpdate 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#primary_type#Left GestureEvent 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 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 AST#binary_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#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right 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#expression#Left GestureRecognizerState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESSFUL AST#member_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentRecognizer AST#member_expression#Right 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#expression#Left GestureRecognizerState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESSFUL AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 如果识别器状态不是SUCCESSFUL,则不做控制 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 let AST#variable_declarator#Left target = AST#expression#Left AST#as_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 . childRecognizer AST#member_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo 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 let AST#variable_declarator#Left currentTarget = AST#expression#Left AST#as_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 . currentRecognizer AST#member_expression#Right AST#expression#Right . getEventTargetInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ScrollableTargetInfo 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left currentTarget AST#expression#Right instanceof AST#expression#Left ScrollableTargetInfo 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isEnd 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_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 event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastOffset AST#member_expression#Right AST#expression#Right ) AST#parenthesized_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#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentTarget AST#expression#Right . isEnd 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#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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 } 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 else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left target AST#expression#Right . isBegin 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_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 event AST#expression#Right . offsetY AST#member_expression#Right AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . lastOffset AST#member_expression#Right AST#expression#Right ) AST#parenthesized_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#member_expression#Left AST#expression#Left this AST#expression#Right . childRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentTarget AST#expression#Right . isBegin 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#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 . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false 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 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentRecognizer AST#member_expression#Right AST#expression#Right . setEnabled 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 } 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#if_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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . lastOffset AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetY 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 ) 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#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 // [EndExclude set_gesture_judge] } 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 '90%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xDCDCDC 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 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.gesture_GestureJudge_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
build() { NavDestination() { Column({ space: 12 }) { Text($r('app.string.gesture_GestureJudge_text')) .fontSize(14) .fontColor('#666') Stack({ alignContent: Alignment.TopStart }) { Scroll(this.scroller) { Column() { Text('Scroll Area') .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) Scroll(this.scroller2) { Column() { Text('Scroll Area2') .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) Column() { ForEach(this.arr, (item: number) => { Text(item.toString()) .width('90%') .height(150) .backgroundColor(0xFFFFFF) .borderRadius(15) .fontSize(16) .textAlign(TextAlign.Center) .margin({ top: 10 }) }, (item: string) => item) }.width('100%') } } .id('inner') .width('100%') .height(800) }.width('100%') } .id('outer') .height(600) .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) .scrollBarColor(Color.Gray) .scrollBarWidth(10) .edgeEffect(EdgeEffect.None) .shouldBuiltInRecognizerParallelWith((current: GestureRecognizer, others: Array<GestureRecognizer>) => { for (let i = 0; i < others.length; i++) { let target = others[i].getEventTargetInfo(); if (target.getId() == 'inner' && others[i].isBuiltIn() && others[i].getType() == GestureControl.GestureType.PAN_GESTURE) { this.currentRecognizer = current; this.childRecognizer = others[i]; return others[i]; } } return undefined; }) .onGestureRecognizerJudgeBegin((event: BaseGestureEvent, current: GestureRecognizer, others: Array<GestureRecognizer>) => { let target = current.getEventTargetInfo(); if (target.getId() == 'outer' && current.isBuiltIn() && current.getType() == GestureControl.GestureType.PAN_GESTURE) { for (let i = 0; i < others.length; i++) { let target = others[i].getEventTargetInfo() as ScrollableTargetInfo; if (target instanceof ScrollableTargetInfo && target.getId() == 'inner') { let panEvent = event as PanGestureEvent; this.childRecognizer.setEnabled(true); this.currentRecognizer.setEnabled(false); if (target.isEnd()) { if (panEvent && panEvent.offsetY < 0) { this.childRecognizer.setEnabled(false); this.currentRecognizer.setEnabled(true); } } else if (target.isBegin()) { if (panEvent.offsetY > 0) { this.childRecognizer.setEnabled(false); this.currentRecognizer.setEnabled(true); } } } } } return GestureJudgeResult.CONTINUE; }) .parallelGesture( PanGesture() .onActionUpdate((event: GestureEvent) => { if (this.childRecognizer.getState() != GestureRecognizerState.SUCCESSFUL || this.currentRecognizer.getState() != GestureRecognizerState.SUCCESSFUL) { return; } let target = this.childRecognizer.getEventTargetInfo() as ScrollableTargetInfo; let currentTarget = this.currentRecognizer.getEventTargetInfo() as ScrollableTargetInfo; if (target instanceof ScrollableTargetInfo && currentTarget instanceof ScrollableTargetInfo) { this.childRecognizer.setEnabled(true); this.currentRecognizer.setEnabled(false); if (target.isEnd()) { if ((event.offsetY - this.lastOffset) < 0) { this.childRecognizer.setEnabled(false); if (currentTarget.isEnd()) { this.currentRecognizer.setEnabled(false); } else { this.currentRecognizer.setEnabled(true); } } } else if (target.isBegin()) { if ((event.offsetY - this.lastOffset) > 0) { this.childRecognizer.setEnabled(false); if (currentTarget.isBegin()) { this.currentRecognizer.setEnabled(false); } else { this.currentRecognizer.setEnabled(true); } } } } this.lastOffset = event.offsetY; }) ) }.width('100%').height('90%').backgroundColor(0xDCDCDC) } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.gesture_GestureJudge_title')) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets#L30-L168
a9df4633c32d5b8421c319d63e92117e64467584
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUISymbolGlyphSymbolSpan/entry/src/main/ets/pages/Index.ets
arkts
Row
通过fontWeight属性设置SymbolSpan组件的粗细。
Row() { Column() { Text("Lighter") Text() { SymbolSpan($r('sys.symbol.ohos_trash')) .fontWeight(FontWeight.Lighter) .fontSize(96) }
AST#method_declaration#Left Row 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#ui_component#Right AST#ERROR#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "Lighter" AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right Text ( AST#ERROR#Left ) AST#ERROR#Right { AST#property_name#Left SymbolSpan AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left $r AST#parameter#Right AST#ERROR#Left ( 'sys.symbol.ohos_trash' AST#ERROR#Right ) AST#parameter_list#Right ) AST#ERROR#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Lighter AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 96 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#builder_function_body#Right AST#method_declaration#Right
Row() { Column() { Text("Lighter") Text() { SymbolSpan($r('sys.symbol.ohos_trash')) .fontWeight(FontWeight.Lighter) .fontSize(96) }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUISymbolGlyphSymbolSpan/entry/src/main/ets/pages/Index.ets#L48-L55
b322f0e2c864fd9fdc17b7c8d27c2fb8e7b00cec
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppFunctions.ets
arkts
/延迟 毫秒
export async function awaitDelay(milliSeconds: number = 100) { await new Promise<void>((resolve, reject) => setTimeout(resolve, milliSeconds)); }
AST#export_declaration#Left export AST#function_declaration#Left async function awaitDelay AST#parameter_list#Left ( AST#parameter#Left milliSeconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#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#await_expression#Left await AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#await_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#Left reject AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolve AST#expression#Right , AST#expression#Left milliSeconds 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#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export async function awaitDelay(milliSeconds: number = 100) { await new Promise<void>((resolve, reject) => setTimeout(resolve, milliSeconds)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppFunctions.ets#L25-L27
cb4524f6fa70b6c4a86783dbd2f8e8543071279e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets
arkts
构造函数 @param {common.Context} [context] UIAbility 上下文
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, OrderCacheStoreDataSourceImpl.PREFS_NAME); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context 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#variable_declaration#Left const AST#variable_declarator#Left resolvedContext : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_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#binary_expression#Left AST#expression#Left context AST#expression#Right ?? AST#expression#Left ContextUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . getUIAbilityCtx 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 this AST#expression#Right . prefs AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left PreferencesUtil AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolvedContext AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left OrderCacheStoreDataSourceImpl AST#expression#Right . PREFS_NAME 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#constructor_declaration#Right
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, OrderCacheStoreDataSourceImpl.PREFS_NAME); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/datastore/src/main/ets/datasource/ordercache/OrderCacheStoreDataSourceImpl.ets#L87-L90
4c9ece1a2a32c9c1e26353243bc6ca4e0606f553
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/model/GoodsModel.ets
arkts
设置项的数据类
export class ProductDataModel { id: number; uri: ResourceStr; title: ResourceStr; price: ResourceStr; views: ResourceStr; constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, views: ResourceStr) { this.id = id; this.uri = uri; this.title = title; this.price = price; this.views = views; } }
AST#export_declaration#Left export AST#class_declaration#Left class ProductDataModel 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 ResourceStr 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 price : 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 ResourceStr 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 ResourceStr 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 price : 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 ResourceStr 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 . price AST#member_expression#Right = AST#expression#Left price 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#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ProductDataModel { id: number; uri: ResourceStr; title: ResourceStr; price: ResourceStr; views: ResourceStr; constructor(id: number, uri: ResourceStr, title: ResourceStr, price: ResourceStr, views: ResourceStr) { this.id = id; this.uri = uri; this.title = title; this.price = price; this.views = views; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/model/GoodsModel.ets#L17-L31
6de76e0623bf491392acb3cd83b510c0f80231c5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
loadRefundReasons
加载退款原因字典数据 @returns {void} 无返回值
loadRefundReasons(): void { if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) { return; } const params: DictDataRequest = new DictDataRequest(); params.types = ["orderRefundReason"]; RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params)) .toast(false) .start((): void => { this.refundReasonsUiState = BaseNetWorkUiState.LOADING; }) .execute() .then((data: DictDataResponse): void => { this.refundReasonList = data.orderRefundReason ?? []; this.refundReasonsUiState = BaseNetWorkUiState.SUCCESS; }) .catch((): void => { this.refundReasonList = []; this.refundReasonsUiState = BaseNetWorkUiState.ERROR; }); }
AST#method_declaration#Left loadRefundReasons 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#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 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 . refundReasonsUiState AST#member_expression#Right AST#expression#Right === AST#expression#Left BaseNetWorkUiState AST#expression#Right AST#binary_expression#Right AST#expression#Right . SUCCESS AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . refundReasonList 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#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 params : AST#type_annotation#Left AST#primary_type#Left DictDataRequest 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 DictDataRequest 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 params AST#expression#Right . types AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "orderRefundReason" AST#expression#Right ] 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#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#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 RequestHelper AST#expression#Right . repository AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#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 . commonRepository AST#member_expression#Right AST#expression#Right . getDictData 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#argument_list#Right AST#call_expression#Right AST#expression#Right . toast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . start 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#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#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 . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . LOADING 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 . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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 data : AST#type_annotation#Left AST#primary_type#Left DictDataResponse 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundReasonList AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . orderRefundReason AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#array_literal#Left [ ] AST#array_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 this AST#expression#Right . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . SUCCESS 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_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refundReasonList 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 . refundReasonsUiState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BaseNetWorkUiState AST#expression#Right . ERROR 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 ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
loadRefundReasons(): void { if (this.refundReasonsUiState === BaseNetWorkUiState.SUCCESS && this.refundReasonList.length > 0) { return; } const params: DictDataRequest = new DictDataRequest(); params.types = ["orderRefundReason"]; RequestHelper.repository<DictDataResponse>(this.commonRepository.getDictData(params)) .toast(false) .start((): void => { this.refundReasonsUiState = BaseNetWorkUiState.LOADING; }) .execute() .then((data: DictDataResponse): void => { this.refundReasonList = data.orderRefundReason ?? []; this.refundReasonsUiState = BaseNetWorkUiState.SUCCESS; }) .catch((): void => { this.refundReasonList = []; this.refundReasonsUiState = BaseNetWorkUiState.ERROR; }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets#L114-L134
f99a8b77f5caaa886a9c65e78924dc8476fdf552
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets
arkts
putPreference
将用户输入的数据,保存到缓存的Preference实例中
async putPreference(key: string, data: string) { if (this.dataPreferences === null) { await this.getPreferencesFromStorage(); } await this.dataPreferences?.put(key, data).then(() => { console.info(`Succeeded in putting value`); }).catch((err: BusinessError) => { console.error(`Failed to get preferences, Cause:` + err); }); // 将Preference实例存储到首选项持久化文件中 await this.dataPreferences?.flush(); }
AST#method_declaration#Left async putPreference 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 data : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataPreferences 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_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 . getPreferencesFromStorage 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#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#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 . dataPreferences AST#member_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 data 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Succeeded in putting value ` 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 . 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 console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#template_literal#Left ` Failed to get preferences, Cause: ` AST#template_literal#Right AST#expression#Right + AST#expression#Left err 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#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 // 将Preference实例存储到首选项持久化文件中 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 . dataPreferences AST#member_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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
async putPreference(key: string, data: string) { if (this.dataPreferences === null) { await this.getPreferencesFromStorage(); } await this.dataPreferences?.put(key, data).then(() => { console.info(`Succeeded in putting value`); }).catch((err: BusinessError) => { console.error(`Failed to get preferences, Cause:` + err); }); await this.dataPreferences?.flush(); }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L26-L39
c552006e2ca745bd1fd68a82f1dc8ee324eaa9db
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/MultiDeviceMusic/features/player/src/main/ets/constants/PlayerConstants.ets
arkts
Constants for player area.
export class PlayerConstants { /** * The font size of the singer is smaller. */ static readonly FONT_REDUCE: number = 4; /** * The layout weight of player info. */ static readonly LAYOUT_WEIGHT_PLAYER_INFO: number = 3; /** * The layout weight of player control. */ static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1; /** * The display priority is 1. */ static readonly DISPLAY_PRIORITY_ONE: number = 1; /** * The display priority is 2. */ static readonly DISPLAY_PRIORITY_TWO: number = 2; /** * The display priority is 3. */ static readonly DISPLAY_PRIORITY_THREE: number = 3; }
AST#export_declaration#Left export AST#class_declaration#Left class PlayerConstants AST#class_body#Left { /** * The font size of the singer is smaller. */ AST#property_declaration#Left static readonly FONT_REDUCE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4 AST#expression#Right ; AST#property_declaration#Right /** * The layout weight of player info. */ AST#property_declaration#Left static readonly LAYOUT_WEIGHT_PLAYER_INFO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /** * The layout weight of player control. */ AST#property_declaration#Left static readonly LAYOUT_WEIGHT_PLAYER_CONTROL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * The display priority is 1. */ AST#property_declaration#Left static readonly DISPLAY_PRIORITY_ONE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * The display priority is 2. */ AST#property_declaration#Left static readonly DISPLAY_PRIORITY_TWO : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /** * The display priority is 3. */ AST#property_declaration#Left static readonly DISPLAY_PRIORITY_THREE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class PlayerConstants { static readonly FONT_REDUCE: number = 4; static readonly LAYOUT_WEIGHT_PLAYER_INFO: number = 3; static readonly LAYOUT_WEIGHT_PLAYER_CONTROL: number = 1; static readonly DISPLAY_PRIORITY_ONE: number = 1; static readonly DISPLAY_PRIORITY_TWO: number = 2; static readonly DISPLAY_PRIORITY_THREE: number = 3; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/features/player/src/main/ets/constants/PlayerConstants.ets#L19-L49
b30510addac543f73b5f7e879032b0997e207d92
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
初次启动应用 router 类型事件 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { if (want?.parameters?.params) { // want.parameters.params 对应 postCardAction() 中 params 内容 let params: Record<string, Object> = JSON.parse(want.parameters.params as string); this.selectPage = params.targetPage as string; } } call类型事件
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.callee.on('changeCount', (data) => { // 准备一个临时数据结构 存放formId 和数字 interface FromData { formId: string, count: number } // 从data中获取数据 let params = JSON.parse(data.readString()) as FromData const newCount: Record<string, number> = { "count": params.count + 1 } // 将这个新的数据响应给卡片 const formData = formBindingData.createFormBindingData(newCount) formProvider.updateForm(params.formId, formData) return null }) }catch (e){ console.log(`dxin => onCreate call 事件出错了 `) } }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left AbilityConstant . LaunchParam 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 void 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . callee AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'changeCount' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 准备一个临时数据结构 存放formId 和数字 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 FromData 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 formId AST#property_name#Right : AST#expression#Left string AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left count 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 // 从data中获取数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . readString 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 as AST#type_annotation#Left AST#primary_type#Left FromData 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 newCount : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string 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#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left "count" AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . count AST#member_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#variable_declaration#Left const AST#variable_declarator#Left formData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formBindingData AST#expression#Right . createFormBindingData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left newCount 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 formProvider AST#expression#Right . updateForm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left params AST#expression#Right . formId AST#member_expression#Right AST#expression#Right , AST#expression#Left formData 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#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#return_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 ( e ) 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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` dxin => onCreate call 事件出错了 ` 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
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.callee.on('changeCount', (data) => { interface FromData { formId: string, count: number } let params = JSON.parse(data.readString()) as FromData const newCount: Record<string, number> = { "count": params.count + 1 } const formData = formBindingData.createFormBindingData(newCount) formProvider.updateForm(params.formId, formData) return null }) }catch (e){ console.log(`dxin => onCreate call 事件出错了 `) } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets#L19-L41
66c7b0c2224058b30025af2af3b2a174d1b2984c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
putBoolean
存储布尔值 @param key 键 @param value 值
async putBoolean(key: string, value: boolean): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.put(key, value); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to put boolean: ${businessError.message}`); throw new Error(businessError.message); } }
AST#method_declaration#Left async putBoolean 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 boolean 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 this AST#expression#Right . checkInitialized 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#non_null_assertion_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 . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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 value 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#non_null_assertion_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 . dataPreferences AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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#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 businessError = 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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0001 AST#expression#Right , AST#expression#Left 'BirthdayReminder' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to put boolean: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError 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#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#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#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 putBoolean(key: string, value: boolean): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.put(key, value); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to put boolean: ${businessError.message}`); throw new Error(businessError.message); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L132-L142
83ab611012e52f4b72f5be4b7c9cc770492f1c95
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onForeground
当切换到前台
onForeground(): void { // Ability has brought to foreground hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); }
AST#method_declaration#Left onForeground 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 { // Ability has brought to foreground 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 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onForeground' 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
onForeground(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/entryability/EntryAbility.ets#L50-L53
528f71cc9982fc872e3e48602dc3a74cfb2e682a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/VerifyModeEnum.ets
arkts
识别类型枚举
export enum VerifyModeEnum { //语音识别 VOICE = 0, //转文字 TEXT = 1, //取消 CANCEL = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum VerifyModeEnum AST#enum_body#Left { //语音识别 AST#enum_member#Left VOICE = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , //转文字 AST#enum_member#Left TEXT = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , //取消 AST#enum_member#Left CANCEL = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum VerifyModeEnum { VOICE = 0, TEXT = 1, CANCEL = 2 }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/enums/VerifyModeEnum.ets#L17-L24
308a4894c05cceea191f79587cec9560a352115c
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets
arkts
根据账目类型和日期范围统计收支数据,返回分类统计信息数组
export function statisticByType( accounts: Array<Account>, accountType: number, beginDate: Date | number, endDate: Date | number ): Array<ClassifiedStatistic> { // 将日期对象转换为时间戳 if (beginDate instanceof Date) { beginDate = beginDate.getTime() } if (endDate instanceof Date) { endDate = endDate.getTime() } // 使用 Map 存储分类统计信息,键为类型文本,值为 ClassifiedStatistic 对象 const map: Map<string, ClassifiedStatistic> = new Map() // 筛选符合条件的账目,并遍历进行统计 accounts .filter((account) => account.accountType === accountType && account.date.getTime() <= endDate && account.date.getTime() >= beginDate) .forEach((account) => { const key = account.typeText // 如果 Map 中没有该类型的统计信息,创建一个新的 ClassifiedStatistic 对象 if (!map.has(key)) { map.set(key, new ClassifiedStatistic(account.typeText, accountType)) } // 获取并更新该类型的统计信息 const cs = map.get(key) cs.count += 1 cs.amount += account.amount }) // 将 Map 转换为数组,并按金额降序排序 const result = Array.from(map.values()) return result.sort((a, b) => b.amount - a.amount) }
AST#export_declaration#Left export AST#function_declaration#Left function statisticByType AST#parameter_list#Left ( AST#parameter#Left accounts : 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 Account 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#Left accountType : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left beginDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date 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#Left endDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date 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 AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ClassifiedStatistic 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#binary_expression#Left AST#expression#Left beginDate AST#expression#Right instanceof AST#expression#Left Date 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 beginDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left beginDate 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left endDate AST#expression#Right instanceof AST#expression#Left Date 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 endDate = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left endDate 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#if_statement#Right AST#statement#Right // 使用 Map 存储分类统计信息,键为类型文本,值为 ClassifiedStatistic 对象 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left map : 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 string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left ClassifiedStatistic 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 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 Map 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#ERROR#Left accounts AST#ERROR#Right . filter 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 account AST#parameter#Right ) AST#parameter_list#Right => 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 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 AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . accountType AST#member_expression#Right AST#expression#Right === AST#expression#Left accountType AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left account AST#expression#Right AST#binary_expression#Right AST#expression#Right . date AST#member_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#expression#Left endDate AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left account AST#expression#Right AST#binary_expression#Right AST#expression#Right . date AST#member_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#expression#Left beginDate 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 . 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 account AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right // 如果 Map 中没有该类型的统计信息,创建一个新的 ClassifiedStatistic 对象 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#unary_expression#Left ! AST#expression#Left map AST#expression#Right AST#unary_expression#Right AST#expression#Right . has 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#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 map AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ClassifiedStatistic AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . typeText AST#member_expression#Right AST#expression#Right , AST#expression#Left accountType 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cs = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left map AST#expression#Right . get 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#ERROR#Left cs AST#ERROR#Right . count AST#member_expression#Right += AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left 1 AST#expression#Right AST#ERROR#Left cs AST#ERROR#Right . amount AST#member_expression#Right += AST#expression#Left AST#member_expression#Left AST#expression#Left account AST#expression#Right . amount AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#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 // 将 Map 转换为数组,并按金额降序排序 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 Array AST#expression#Right . from 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 map AST#expression#Right . values 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#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 result 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . amount AST#member_expression#Right AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . amount AST#member_expression#Right AST#expression#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#function_declaration#Right AST#export_declaration#Right
export function statisticByType( accounts: Array<Account>, accountType: number, beginDate: Date | number, endDate: Date | number ): Array<ClassifiedStatistic> { if (beginDate instanceof Date) { beginDate = beginDate.getTime() } if (endDate instanceof Date) { endDate = endDate.getTime() } const map: Map<string, ClassifiedStatistic> = new Map() accounts .filter((account) => account.accountType === accountType && account.date.getTime() <= endDate && account.date.getTime() >= beginDate) .forEach((account) => { const key = account.typeText if (!map.has(key)) { map.set(key, new ClassifiedStatistic(account.typeText, accountType)) } const cs = map.get(key) cs.count += 1 cs.amount += account.amount }) const result = Array.from(map.values()) return result.sort((a, b) => b.amount - a.amount) }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/StatisticalUtils.ets#L31-L68
c88a1fdcf8214600ece4ba4b6f79da00b0330ce5
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets
arkts
aboutToAppear
页面出现前生命周期 @returns {void} 无返回值
aboutToAppear(): void { super.aboutToAppear(); this.loadSavedCredentials(); }
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 super AST#expression#Right . aboutToAppear 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 . loadSavedCredentials 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 { super.aboutToAppear(); this.loadSavedCredentials(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets#L48-L51
52cff459cc846a4d5a44de935bf9cda09de9c184
github
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/Http.ets
arkts
request
AxiosRequestConfig axios提供的请求对象类型
request<T, R = Object>(obj: AxiosRequestConfig<R>) { // !之前第二个泛型很复杂 因为返回的数据没剥离 // !现在数据剥离了 而且剥离干干净净 就是你要的数据 所以类型就是你要的数据的类型 return instance<null, T, R>(obj) }
AST#method_declaration#Left request AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right , AST#type_parameter#Left R = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosRequestConfig AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left R 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left instance AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left null AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left R AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left obj 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
request<T, R = Object>(obj: AxiosRequestConfig<R>) { return instance<null, T, R>(obj) }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/Http.ets#L76-L80
3a8a6c0f347baf1eed504e4a33c61bf299f7b8aa
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
showTimePicker
时间滑动选择器弹窗 (TimePickerDialog) @param options selected 设置选中项的时间。 默认值:当前系统时间。从API version 10开始,该参数支持$$双向绑定变量。 format 指定需要显示的TimePicker的格式。 默认值:TimePickerFormat.HOUR_MINUTE(HOUR_MINUTE-按照小时和分显示、HOUR_MINUTE_SECOND-按照小时、分钟和秒显示。) useMilitaryTime 展示时间是否为24小时制,默认为12小时制。默认值:false。说明:当展示时间为12小时制时,上下午与小时无联动关系。 onChange:(value: Date) => void 选择弹窗中日期使当前选中项改变时触发该回调。value:选中的日期值。 onAccept:(value: Date) => void 点击弹窗中的“确定”按钮时触发该回调。value:选中的日期值。 onCancel:() => void 点击弹窗中的“取消”按钮时触发该回调。
static showTimePicker(options: TimePickerDialogOptions) { DialogUtil.initPickerDialogDefault(options); TimePickerDialog.show(options); }
AST#method_declaration#Left static showTimePicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TimePickerDialogOptions 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 DialogUtil AST#expression#Right . initPickerDialogDefault 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#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimePickerDialog AST#expression#Right . show 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static showTimePicker(options: TimePickerDialogOptions) { DialogUtil.initPickerDialogDefault(options); TimePickerDialog.show(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L172-L175
39c204c3154cd8e5a67cbb0729b9d438fb100fdf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCtrlComp.ets
arkts
CustomScanCtrlComp
扫码控制组件
@Component export default struct CustomScanCtrlComp { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @Consume('subPageStack') subPageStack: NavPathStack; // 自定义扫码vm实例 @Consume('customScanVM') customScanVM: CustomScanViewModel; @State scanSize: ScanSize = ScanSize.getInstance(); @State xComponentSize: XComponentSize = this.scanSize.xComponentSize; // 相机闪光灯开启状态 @State isCameraLightOpen: boolean = false; // 识别音效播放器 @State avPlayer: PromptTone = PromptTone.getInstance(getContext(this) as common.UIAbilityContext) aboutToAppear() { // 注册闪光灯状态回调 this.customScanVM.regCameraLightUpdateListener((isOpen: boolean) => { this.isCameraLightOpen = isOpen; }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CustomScanCtrlComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'currentBreakpoint' AST#expression#Right ) AST#decorator#Right currentBreakpoint : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left BreakpointConstants AST#expression#Right . BREAKPOINT_SM AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'subPageStack' AST#expression#Right ) AST#decorator#Right subPageStack : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 自定义扫码vm实例 AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'customScanVM' AST#expression#Right ) AST#decorator#Right customScanVM : AST#type_annotation#Left AST#primary_type#Left CustomScanViewModel AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right scanSize : AST#type_annotation#Left AST#primary_type#Left ScanSize 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 ScanSize 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 ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right xComponentSize : AST#type_annotation#Left AST#primary_type#Left XComponentSize AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scanSize AST#member_expression#Right AST#expression#Right . xComponentSize AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 相机闪光灯开启状态 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isCameraLightOpen : 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 avPlayer : AST#type_annotation#Left AST#primary_type#Left PromptTone AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PromptTone AST#expression#Right . getInstance 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 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 as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right 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#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) 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#member_expression#Left AST#expression#Left AST#object_literal#Left { // 注册闪光灯状态回调 AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right . customScanVM AST#member_expression#Right AST#expression#Right . regCameraLightUpdateListener 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 isOpen : AST#type_annotation#Left AST#primary_type#Left boolean 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 . isCameraLightOpen AST#member_expression#Right = AST#expression#Left isOpen 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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct CustomScanCtrlComp { @StorageLink('currentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_SM; @Consume('subPageStack') subPageStack: NavPathStack; @Consume('customScanVM') customScanVM: CustomScanViewModel; @State scanSize: ScanSize = ScanSize.getInstance(); @State xComponentSize: XComponentSize = this.scanSize.xComponentSize; @State isCameraLightOpen: boolean = false; @State avPlayer: PromptTone = PromptTone.getInstance(getContext(this) as common.UIAbilityContext) aboutToAppear() { this.customScanVM.regCameraLightUpdateListener((isOpen: boolean) => { this.isCameraLightOpen = isOpen; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CustomScanCtrlComp.ets#L29-L47
0314a6db970bdf0c752d284023e34938cbc93805
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
数据导入导出服务类
export class DataImportExportService { private static instance: DataImportExportService; private context: common.UIAbilityContext; private constructor(context: common.UIAbilityContext) { this.context = context; } public static getInstance(context: common.UIAbilityContext): DataImportExportService { if (!DataImportExportService.instance) { DataImportExportService.instance = new DataImportExportService(context); } return DataImportExportService.instance; } /** * 从系统通讯录导入联系人 */ async importFromSystemContacts(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting system contacts import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在读取系统通讯录...', percentage: 0 }); } // 模拟系统通讯录数据读取 const systemContacts = await this.getSystemContacts(); if (onProgress) { onProgress({ totalRecords: systemContacts.length, processedRecords: 0, currentOperation: '开始处理联系人数据...', percentage: 10 }); } const result = await this.processContactsImport(systemContacts, onProgress); hilog.info(0x0000, 'DataImportExportService', `System contacts import completed: ${result.importedCount} imported, ${result.skippedCount} skipped`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `System contacts import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`系统通讯录导入失败: ${error}`], contacts: [] }; } } /** * 从文件导入联系人 */ async importFromFile(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting file import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '选择导入文件...', percentage: 0 }); } // 选择文件 const filePath = await this.selectImportFile(); if (!filePath) { return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: ['未选择文件'], contacts: [] }; } if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在读取文件...', percentage: 20 }); } // 读取文件内容 const fileContent = await this.readFileContent(filePath); const parsedContacts = await this.parseFileContent(fileContent, filePath); if (onProgress) { onProgress({ totalRecords: parsedContacts.length, processedRecords: 0, currentOperation: '开始处理联系人数据...', percentage: 40 }); } const result = await this.processContactsImport(parsedContacts, onProgress); hilog.info(0x0000, 'DataImportExportService', `File import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `File import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`文件导入失败: ${error}`], contacts: [] }; } } /** * 从Excel文件导入联系人 */ async importFromExcel(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting Excel import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '选择Excel文件...', percentage: 0 }); } const filePath = await this.selectExcelFile(); if (!filePath) { return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: ['未选择Excel文件'], contacts: [] }; } if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在解析Excel文件...', percentage: 20 }); } const excelData = await this.parseExcelFile(filePath); const result = await this.processContactsImport(excelData, onProgress); hilog.info(0x0000, 'DataImportExportService', `Excel import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`Excel导入失败: ${error}`], contacts: [] }; } } /** * 从其他应用导入联系人 */ async importFromOtherApps(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting other apps import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '检测其他应用数据...', percentage: 0 }); } // 模拟检测其他应用的数据 const otherAppsData = await this.detectOtherAppsData(); if (onProgress) { onProgress({ totalRecords: otherAppsData.length, processedRecords: 0, currentOperation: '开始转换数据格式...', percentage: 30 }); } const result = await this.processContactsImport(otherAppsData, onProgress); hilog.info(0x0000, 'DataImportExportService', `Other apps import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Other apps import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`第三方应用导入失败: ${error}`], contacts: [] }; } } /** * 导出完整备份 */ async exportFullBackup(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting full backup export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '准备备份数据...', percentage: 0 }); } const backupData = await this.createFullBackupData(contacts, onProgress); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length * 0.8, currentOperation: '保存备份文件...', percentage: 80 }); } const filePath = await this.saveBackupFile(backupData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: '备份完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Full backup export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Full backup export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `完整备份导出失败: ${error}` }; } } /** * 仅导出联系人数据 */ async exportContactsOnly(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting contacts only export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '处理联系人数据...', percentage: 0 }); } const contactsData = await this.createContactsOnlyData(contacts, onProgress); const filePath = await this.saveContactsFile(contactsData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: '导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Contacts only export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Contacts only export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `联系人导出失败: ${error}` }; } } /** * 导出为Excel格式 */ async exportToExcel(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting Excel export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '创建Excel工作表...', percentage: 0 }); } const excelData = await this.createExcelData(contacts, onProgress); const filePath = await this.saveExcelFile(excelData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: 'Excel导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Excel export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `Excel导出失败: ${error}` }; } } /** * 导出为CSV格式 */ async exportToCSV(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting CSV export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '生成CSV数据...', percentage: 0 }); } const csvData = await this.createCSVData(contacts, onProgress); const filePath = await this.saveCSVFile(csvData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: 'CSV导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `CSV export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `CSV export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `CSV导出失败: ${error}` }; } } // 私有辅助方法 /** * 获取系统通讯录(模拟实现) */ private async getSystemContacts(): Promise<Contact[]> { // 模拟从系统通讯录读取数据 await new Promise<void>((resolve: () => void) => setTimeout(resolve, 1000)); const currentTime = new Date().toISOString(); return [ { id: 'sys_1', name: '张三', relation: RelationType.FRIEND, gender: Gender.MALE, birthday: { date: '03-15', isLunar: false, month: 3, day: 15, age: 28 }, phone: '13800138001', email: 'zhangsan@example.com', intimacyLevel: 5, tags: ['朋友', '系统导入'], notes: '从系统通讯录导入', isFavorite: false, createdAt: currentTime, updatedAt: currentTime }, { id: 'sys_2', name: '李四', relation: RelationType.COLLEAGUE, gender: Gender.FEMALE, birthday: { date: '07-20', isLunar: true, month: 7, day: 20, age: 25 }, phone: '13800138002', email: 'lisi@example.com', intimacyLevel: 3, tags: ['同事', '系统导入'], notes: '从系统通讯录导入', isFavorite: false, createdAt: currentTime, updatedAt: currentTime } ]; } /** * 选择导入文件 */ private async selectImportFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.json', '.txt', '.csv'] }; const result = await documentPicker.select(documentSelectOptions); return result.length > 0 ? result[0] : null; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `File selection failed: ${error}`); return null; } } /** * 选择Excel文件 */ private async selectExcelFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.xlsx', '.xls'] }; const result = await documentPicker.select(documentSelectOptions); return result.length > 0 ? result[0] : null; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel file selection failed: ${error}`); return null; } } /** * 读取文件内容 */ private async readFileContent(filePath: string): Promise<string> { try { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB buffer const readLen = fs.readSync(file.fd, buffer); fs.closeSync(file); const uint8Array = new Uint8Array(buffer, 0, readLen); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); return textDecoder.decodeToString(uint8Array); } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Read file content failed: ${error}`); throw new Error(`读取文件失败: ${error}`); } } /** * 解析文件内容 */ private async parseFileContent(content: string, filePath: string): Promise<Contact[]> { try { const extension = filePath.split('.').pop()?.toLowerCase(); switch (extension) { case 'json': return this.parseJSONContent(content); case 'csv': return this.parseCSVContent(content); case 'txt': return this.parseTXTContent(content); default: throw new Error('不支持的文件格式'); } } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Parse file content failed: ${error}`); throw new Error(`解析文件内容失败: ${error}`); } }
AST#export_declaration#Left export AST#class_declaration#Left class DataImportExportService AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left DataImportExportService AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext 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 . context AST#member_expression#Right = AST#expression#Left context 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 public static getInstance AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext 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 DataImportExportService 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left DataImportExportService AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left DataImportExportService AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DataImportExportService AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context 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#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DataImportExportService AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 从系统通讯录导入联系人 */ AST#method_declaration#Left async importFromSystemContacts AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback 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 ImportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting system contacts import...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '正在读取系统通讯录...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right // 模拟系统通讯录数据读取 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left systemContacts = 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 . getSystemContacts 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#if_statement#Left if ( AST#expression#Left onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left systemContacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '开始处理联系人数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 10 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#if_statement#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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . processContactsImport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left systemContacts AST#expression#Right , AST#expression#Left onProgress 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` System contacts import completed: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . importedCount AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right imported, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . skippedCount AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right skipped ` 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 result 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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` System contacts import failed: 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#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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#template_literal#Left ` 系统通讯录导入失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 从文件导入联系人 */ AST#method_declaration#Left async importFromFile AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback 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 ImportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting file import...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '选择导入文件...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right // 选择文件 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath = 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 . selectImportFile 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left filePath AST#expression#Right AST#unary_expression#Right AST#expression#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 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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '未选择文件' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '正在读取文件...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 20 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#if_statement#Right AST#statement#Right // 读取文件内容 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileContent = 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 . readFileContent 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#variable_declaration#Left const AST#variable_declarator#Left parsedContacts = 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 . parseFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileContent AST#expression#Right , 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left parsedContacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '开始处理联系人数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 40 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#if_statement#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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . processContactsImport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parsedContacts AST#expression#Right , AST#expression#Left onProgress 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` File import completed: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . importedCount AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right imported ` 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 result 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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` File import failed: 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#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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#template_literal#Left ` 文件导入失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 从Excel文件导入联系人 */ AST#method_declaration#Left async importFromExcel AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback 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 ImportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting Excel import...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '选择Excel文件...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath = 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 . selectExcelFile 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#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left filePath AST#expression#Right AST#unary_expression#Right AST#expression#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 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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '未选择Excel文件' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '正在解析Excel文件...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 20 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left excelData = 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 . parseExcelFile 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#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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . processContactsImport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left excelData AST#expression#Right , AST#expression#Left onProgress 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Excel import completed: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . importedCount AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right imported ` 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 result 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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Excel import failed: 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#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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#template_literal#Left ` Excel导入失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 从其他应用导入联系人 */ AST#method_declaration#Left async importFromOtherApps AST#parameter_list#Left ( AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ImportProgressCallback 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 ImportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting other apps import...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '检测其他应用数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right // 模拟检测其他应用的数据 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left otherAppsData = 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 . detectOtherAppsData 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#if_statement#Left if ( AST#expression#Left onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left otherAppsData AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '开始转换数据格式...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 30 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#if_statement#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#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . processContactsImport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left otherAppsData AST#expression#Right , AST#expression#Left onProgress 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Other apps import completed: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . importedCount AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right imported ` 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 result 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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Other apps import failed: 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#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 importedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left skippedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errorCount AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left errors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#template_literal#Left ` 第三方应用导入失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left contacts AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ ] AST#array_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 导出完整备份 */ AST#method_declaration#Left async exportFullBackup AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ExportProgressCallback 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 ExportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting full backup export...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '准备备份数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left backupData = 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 . createFullBackupData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left onProgress 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.8 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '保存备份文件...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 80 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath = 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 . saveBackupFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left backupData 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '备份完成' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 100 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#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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Full backup export completed: AST#template_substitution#Left $ { AST#expression#Left filePath 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#property_assignment#Left AST#property_name#Left filePath AST#property_name#Right : AST#expression#Left filePath AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length 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#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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Full backup export failed: 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#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 filePath AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 完整备份导出失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 仅导出联系人数据 */ AST#method_declaration#Left async exportContactsOnly AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ExportProgressCallback 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 ExportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting contacts only export...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '处理联系人数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left contactsData = 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 . createContactsOnlyData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left onProgress 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 filePath = 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 . saveContactsFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contactsData 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '导出完成' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 100 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#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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Contacts only export completed: AST#template_substitution#Left $ { AST#expression#Left filePath 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#property_assignment#Left AST#property_name#Left filePath AST#property_name#Right : AST#expression#Left filePath AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length 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#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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Contacts only export failed: 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#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 filePath AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` 联系人导出失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 导出为Excel格式 */ AST#method_declaration#Left async exportToExcel AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ExportProgressCallback 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 ExportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting Excel export...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '创建Excel工作表...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left excelData = 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 . createExcelData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left onProgress 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 filePath = 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 . saveExcelFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left excelData 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left 'Excel导出完成' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 100 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#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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Excel export completed: AST#template_substitution#Left $ { AST#expression#Left filePath 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#property_assignment#Left AST#property_name#Left filePath AST#property_name#Right : AST#expression#Left filePath AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length 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#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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Excel export failed: 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#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 filePath AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` Excel导出失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 导出为CSV格式 */ AST#method_declaration#Left async exportToCSV AST#parameter_list#Left ( AST#parameter#Left contacts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Contact [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onProgress ? : AST#type_annotation#Left AST#primary_type#Left ExportProgressCallback 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 ExportResult 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left 'Starting CSV export...' 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left '生成CSV数据...' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 0 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left csvData = 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 . createCSVData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contacts AST#expression#Right , AST#expression#Left onProgress 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 filePath = 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 . saveCSVFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left csvData 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 onProgress AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left onProgress AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left totalRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left processedRecords AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left currentOperation AST#property_name#Right : AST#expression#Left 'CSV导出完成' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left percentage AST#property_name#Right : AST#expression#Left 100 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#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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` CSV export completed: AST#template_substitution#Left $ { AST#expression#Left filePath 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#property_assignment#Left AST#property_name#Left filePath AST#property_name#Right : AST#expression#Left filePath AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contacts AST#expression#Right . length 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#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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` CSV export failed: 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#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 filePath AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left exportedCount AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left error AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` CSV导出失败: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_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#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 私有辅助方法 /** * 获取系统通讯录(模拟实现) */ AST#method_declaration#Left private async getSystemContacts 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 AST#array_type#Left Contact [ ] 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left AST#new_expression#Left new AST#expression#Left Promise AST#expression#Right AST#new_expression#Right AST#expression#Right AST#await_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#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#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left resolve AST#expression#Right , AST#expression#Left 1000 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#variable_declaration#Left const AST#variable_declarator#Left currentTime = 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 . toISOString 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#return_statement#Left return 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 'sys_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#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RelationType AST#expression#Right . FRIEND AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Gender AST#expression#Right . MALE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left '03-15' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isLunar 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 month AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left day AST#property_name#Right : AST#expression#Left 15 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left age AST#property_name#Right : AST#expression#Left 28 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 phone AST#property_name#Right : AST#expression#Left '13800138001' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'zhangsan@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left intimacyLevel AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left tags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '朋友' AST#expression#Right , AST#expression#Left '系统导入' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '从系统通讯录导入' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isFavorite 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 createdAt AST#property_name#Right : AST#expression#Left currentTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updatedAt AST#property_name#Right : AST#expression#Left currentTime 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 'sys_2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left '李四' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left relation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RelationType AST#expression#Right . COLLEAGUE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left gender AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Gender AST#expression#Right . FEMALE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left birthday AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left date AST#property_name#Right : AST#expression#Left '07-20' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isLunar AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left month AST#property_name#Right : AST#expression#Left 7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left day AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left age AST#property_name#Right : AST#expression#Left 25 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 phone AST#property_name#Right : AST#expression#Left '13800138002' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left email AST#property_name#Right : AST#expression#Left 'lisi@example.com' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left intimacyLevel AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left tags AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '同事' AST#expression#Right , AST#expression#Left '系统导入' AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notes AST#property_name#Right : AST#expression#Left '从系统通讯录导入' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isFavorite 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 createdAt AST#property_name#Right : AST#expression#Left currentTime AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updatedAt AST#property_name#Right : AST#expression#Left currentTime AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 选择导入文件 */ AST#method_declaration#Left private async selectImportFile 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#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#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 documentPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker 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 documentSelectOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSelectOptions 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 maxSelectNumber AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileSuffixFilters AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '.json' AST#expression#Right , AST#expression#Left '.txt' AST#expression#Right , AST#expression#Left '.csv' AST#expression#Right ] AST#array_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 const AST#variable_declarator#Left result = 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 documentPicker 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 documentSelectOptions 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result 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 AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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#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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` File selection failed: 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#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#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 选择Excel文件 */ AST#method_declaration#Left private async selectExcelFile 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#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#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 documentPicker = 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 picker AST#expression#Right AST#new_expression#Right AST#expression#Right . DocumentViewPicker 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 documentSelectOptions : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left picker . DocumentSelectOptions 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 maxSelectNumber AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fileSuffixFilters AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left '.xlsx' AST#expression#Right , AST#expression#Left '.xls' AST#expression#Right ] AST#array_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 const AST#variable_declarator#Left result = 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 documentPicker 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 documentSelectOptions 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#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result 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 AST#subscript_expression#Left AST#expression#Left result AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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#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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Excel file selection failed: 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#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#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 private async readFileContent 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#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 const AST#variable_declarator#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_ONLY 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#variable_declaration#Left const AST#variable_declarator#Left buffer = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 1024 AST#expression#Right * AST#expression#Left 1024 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 // 1MB buffer AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left readLen = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left buffer 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 fs AST#expression#Right . closeSync 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 ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uint8Array = 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 buffer AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left readLen 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 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 AST#object_literal#Left { 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#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 textDecoder AST#expression#Right . decodeToString AST#member_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#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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Read file content failed: 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 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 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#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 /** * 解析文件内容 */ AST#method_declaration#Left private async parseFileContent AST#parameter_list#Left ( 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#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#primary_type#Left AST#array_type#Left Contact [ ] 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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left extension = 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 filePath AST#expression#Right . split 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 . pop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. toLowerCase 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 switch AST#expression#Right AST#argument_list#Left ( AST#expression#Left extension 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#object_literal#Left { AST#ERROR#Left AST#property_name#Left case AST#property_name#Right AST#ERROR#Right AST#property_assignment#Left AST#property_name#Left 'json' AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left return AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . parseJSONContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'csv' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#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 this AST#expression#Right . parseCSVContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'txt' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#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 this AST#expression#Right . parseTXTContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : throw AST#ERROR#Right AST#statement#Left AST#expression_statement#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 '不支持的文件格式' 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#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left catch AST#parameter_list#Left ( AST#parameter#Left error 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 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 'DataImportExportService' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Parse file content failed: 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 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 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#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 DataImportExportService { private static instance: DataImportExportService; private context: common.UIAbilityContext; private constructor(context: common.UIAbilityContext) { this.context = context; } public static getInstance(context: common.UIAbilityContext): DataImportExportService { if (!DataImportExportService.instance) { DataImportExportService.instance = new DataImportExportService(context); } return DataImportExportService.instance; } async importFromSystemContacts(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting system contacts import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在读取系统通讯录...', percentage: 0 }); } const systemContacts = await this.getSystemContacts(); if (onProgress) { onProgress({ totalRecords: systemContacts.length, processedRecords: 0, currentOperation: '开始处理联系人数据...', percentage: 10 }); } const result = await this.processContactsImport(systemContacts, onProgress); hilog.info(0x0000, 'DataImportExportService', `System contacts import completed: ${result.importedCount} imported, ${result.skippedCount} skipped`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `System contacts import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`系统通讯录导入失败: ${error}`], contacts: [] }; } } async importFromFile(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting file import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '选择导入文件...', percentage: 0 }); } const filePath = await this.selectImportFile(); if (!filePath) { return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: ['未选择文件'], contacts: [] }; } if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在读取文件...', percentage: 20 }); } const fileContent = await this.readFileContent(filePath); const parsedContacts = await this.parseFileContent(fileContent, filePath); if (onProgress) { onProgress({ totalRecords: parsedContacts.length, processedRecords: 0, currentOperation: '开始处理联系人数据...', percentage: 40 }); } const result = await this.processContactsImport(parsedContacts, onProgress); hilog.info(0x0000, 'DataImportExportService', `File import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `File import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`文件导入失败: ${error}`], contacts: [] }; } } async importFromExcel(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting Excel import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '选择Excel文件...', percentage: 0 }); } const filePath = await this.selectExcelFile(); if (!filePath) { return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: ['未选择Excel文件'], contacts: [] }; } if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '正在解析Excel文件...', percentage: 20 }); } const excelData = await this.parseExcelFile(filePath); const result = await this.processContactsImport(excelData, onProgress); hilog.info(0x0000, 'DataImportExportService', `Excel import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`Excel导入失败: ${error}`], contacts: [] }; } } async importFromOtherApps(onProgress?: ImportProgressCallback): Promise<ImportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting other apps import...'); if (onProgress) { onProgress({ totalRecords: 0, processedRecords: 0, currentOperation: '检测其他应用数据...', percentage: 0 }); } const otherAppsData = await this.detectOtherAppsData(); if (onProgress) { onProgress({ totalRecords: otherAppsData.length, processedRecords: 0, currentOperation: '开始转换数据格式...', percentage: 30 }); } const result = await this.processContactsImport(otherAppsData, onProgress); hilog.info(0x0000, 'DataImportExportService', `Other apps import completed: ${result.importedCount} imported`); return result; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Other apps import failed: ${error}`); return { success: false, importedCount: 0, skippedCount: 0, errorCount: 1, errors: [`第三方应用导入失败: ${error}`], contacts: [] }; } } async exportFullBackup(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting full backup export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '准备备份数据...', percentage: 0 }); } const backupData = await this.createFullBackupData(contacts, onProgress); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length * 0.8, currentOperation: '保存备份文件...', percentage: 80 }); } const filePath = await this.saveBackupFile(backupData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: '备份完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Full backup export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Full backup export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `完整备份导出失败: ${error}` }; } } async exportContactsOnly(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting contacts only export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '处理联系人数据...', percentage: 0 }); } const contactsData = await this.createContactsOnlyData(contacts, onProgress); const filePath = await this.saveContactsFile(contactsData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: '导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Contacts only export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Contacts only export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `联系人导出失败: ${error}` }; } } async exportToExcel(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting Excel export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '创建Excel工作表...', percentage: 0 }); } const excelData = await this.createExcelData(contacts, onProgress); const filePath = await this.saveExcelFile(excelData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: 'Excel导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `Excel export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `Excel导出失败: ${error}` }; } } async exportToCSV(contacts: Contact[], onProgress?: ExportProgressCallback): Promise<ExportResult> { try { hilog.info(0x0000, 'DataImportExportService', 'Starting CSV export...'); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: 0, currentOperation: '生成CSV数据...', percentage: 0 }); } const csvData = await this.createCSVData(contacts, onProgress); const filePath = await this.saveCSVFile(csvData); if (onProgress) { onProgress({ totalRecords: contacts.length, processedRecords: contacts.length, currentOperation: 'CSV导出完成', percentage: 100 }); } hilog.info(0x0000, 'DataImportExportService', `CSV export completed: ${filePath}`); return { success: true, filePath: filePath, exportedCount: contacts.length }; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `CSV export failed: ${error}`); return { success: false, filePath: '', exportedCount: 0, error: `CSV导出失败: ${error}` }; } } private async getSystemContacts(): Promise<Contact[]> { await new Promise<void>((resolve: () => void) => setTimeout(resolve, 1000)); const currentTime = new Date().toISOString(); return [ { id: 'sys_1', name: '张三', relation: RelationType.FRIEND, gender: Gender.MALE, birthday: { date: '03-15', isLunar: false, month: 3, day: 15, age: 28 }, phone: '13800138001', email: 'zhangsan@example.com', intimacyLevel: 5, tags: ['朋友', '系统导入'], notes: '从系统通讯录导入', isFavorite: false, createdAt: currentTime, updatedAt: currentTime }, { id: 'sys_2', name: '李四', relation: RelationType.COLLEAGUE, gender: Gender.FEMALE, birthday: { date: '07-20', isLunar: true, month: 7, day: 20, age: 25 }, phone: '13800138002', email: 'lisi@example.com', intimacyLevel: 3, tags: ['同事', '系统导入'], notes: '从系统通讯录导入', isFavorite: false, createdAt: currentTime, updatedAt: currentTime } ]; } private async selectImportFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.json', '.txt', '.csv'] }; const result = await documentPicker.select(documentSelectOptions); return result.length > 0 ? result[0] : null; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `File selection failed: ${error}`); return null; } } private async selectExcelFile(): Promise<string | null> { try { const documentPicker = new picker.DocumentViewPicker(); const documentSelectOptions: picker.DocumentSelectOptions = { maxSelectNumber: 1, fileSuffixFilters: ['.xlsx', '.xls'] }; const result = await documentPicker.select(documentSelectOptions); return result.length > 0 ? result[0] : null; } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Excel file selection failed: ${error}`); return null; } } private async readFileContent(filePath: string): Promise<string> { try { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); const readLen = fs.readSync(file.fd, buffer); fs.closeSync(file); const uint8Array = new Uint8Array(buffer, 0, readLen); const textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); return textDecoder.decodeToString(uint8Array); } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Read file content failed: ${error}`); throw new Error(`读取文件失败: ${error}`); } } private async parseFileContent(content: string, filePath: string): Promise<Contact[]> { try { const extension = filePath.split('.').pop()?.toLowerCase(); switch (extension) { case 'json': return this.parseJSONContent(content); case 'csv': return this.parseCSVContent(content); case 'txt': return this.parseTXTContent(content); default: throw new Error('不支持的文件格式'); } } catch (error) { hilog.error(0x0000, 'DataImportExportService', `Parse file content failed: ${error}`); throw new Error(`解析文件内容失败: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L82-L641
1bde3999a4743386c8ddebda4b7fbbbbd4391d12
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
联系人信息摘要
export interface ContactSummary { name: string; age?: number; gender: string; relation: string; occupation?: string; interests?: string[]; personality?: string[]; favoriteFoods?: string[]; notes?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactSummary AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left age ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left gender : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left relation : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left occupation ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left interests ? : 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_member#Right ; AST#type_member#Left personality ? : 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_member#Right ; AST#type_member#Left favoriteFoods ? : 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_member#Right ; AST#type_member#Left notes ? : 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 ContactSummary { name: string; age?: number; gender: string; relation: string; occupation?: string; interests?: string[]; personality?: string[]; favoriteFoods?: string[]; notes?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L42-L52
c148a328fb6435eec91c8a464f8cf3d352ef01d4
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets
arkts
Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller must ensure that left <= right and top <= bottom. @param left The X coordinate of the left side of the rectangle @param top The Y coordinate of the top of the rectangle @param right The X coordinate of the right side of the rectangle @param bottom The Y coordinate of the bottom of the rectangle
constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) { this.left = left == undefined ? 0 : left; this.top = top == undefined ? 0 : top; this.right = right == undefined ? 0 : right; this.bottom = bottom == undefined ? 0 : bottom; if (r != null || r != undefined) { this.left = r.left; this.top = r.top; this.right = r.right; this.bottom = r.bottom; } }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left left ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left top ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left right ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left bottom ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left r ? : AST#type_annotation#Left AST#primary_type#Left MyRect 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 . left AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left left AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left left 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 this AST#expression#Right . top AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left top AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left top 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 this AST#expression#Right . right AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left right AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left 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 this AST#expression#Right . bottom AST#member_expression#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left bottom AST#expression#Right == AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 0 AST#expression#Right : AST#expression#Left bottom 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left r 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 AST#binary_expression#Left AST#expression#Left r AST#expression#Right != AST#expression#Left undefined 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . left AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right . left 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 . top AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right . top 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 . right AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right . right 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 . bottom AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right . bottom 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
constructor(left?: number, top?: number, right?: number, bottom?: number, r?: MyRect) { this.left = left == undefined ? 0 : left; this.top = top == undefined ? 0 : top; this.right = right == undefined ? 0 : right; this.bottom = bottom == undefined ? 0 : bottom; if (r != null || r != undefined) { this.left = r.left; this.top = r.top; this.right = r.right; this.bottom = r.bottom; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/Rect.ets#L41-L52
f6ecf4097a721a013e8c5bee2737a5154f4f574b
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets
arkts
return
抛出
return Promise.reject({ error: efRcpError }); }
AST#method_declaration#Left return AST#ERROR#Left Promise . reject AST#ERROR#Right AST#parameter_list#Left ( AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left error AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : efRcpError } ) ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
return Promise.reject({ error: efRcpError }); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L219-L220
69087ff343dbddaa12d17a053c35376954d737cc
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/AppUtility.ets
arkts
getFirstPartFrom
================== 字符串处理方法 ================== 从指定的中文翻译中获取第一个分号前的部分(包含词性.意思,如: n.食物) @param srcText 源文本 @returns 处理后的文本
private static getFirstPartFrom(srcText: string): string { const strComma: string = STR_COMMA_HALF; const strComma2: string = STR_COMMA_FULL; const strCommaSub: string = STR_COMMA_SUB_HALF; const strCommaSub2: string = STR_COMMA_SUB_FULL; let str: string = srcText; const indexNoFound: number = -1; // (1) 首先按换行符分割出第一行 let index: number = str.indexOf("\n"); if (index !== indexNoFound) { str = str.substring(0, index); } // (2) 查找第二个间隔符之前的部分 index = str.indexOf(strComma, str.indexOf(strComma) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strComma2, str.indexOf(strComma2) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } } // (3) 若太长了,则只查找第一个间隔符之前的部分 let strLength: number = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (10 + 1)) { index = str.indexOf(strComma); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strComma2); if (index !== indexNoFound) { str = str.substring(0, index); } } } // 再次用逗号检查 strLength = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (12 + 1)) { // (4) 查找第二个子间隔符之前的部分 index = str.indexOf(strCommaSub2, str.indexOf(strCommaSub2) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strCommaSub, str.indexOf(strCommaSub) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } } } // (5) 若太长了,则只查找第一个子间隔符之前的部分 strLength = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (12 + 1)) { index = str.indexOf(strCommaSub2); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strCommaSub); if (index !== indexNoFound) { str = str.substring(0, index); } } } return str; }
AST#method_declaration#Left private static getFirstPartFrom AST#parameter_list#Left ( AST#parameter#Left srcText : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left strComma : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left STR_COMMA_HALF 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 strComma2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left STR_COMMA_FULL 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 strCommaSub : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left STR_COMMA_SUB_HALF 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 strCommaSub2 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left STR_COMMA_SUB_FULL 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 str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left srcText 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 indexNoFound : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // (1) 首先按换行符分割出第一行 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left index : 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 str AST#expression#Right . indexOf 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#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 index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 // (2) 查找第二个间隔符之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#block_statement#Right AST#if_statement#Right AST#statement#Right // (3) 若太长了,则只查找第一个间隔符之前的部分 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left strLength : 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 AppUtility AST#expression#Right . getLengthOfStringWithoutKind 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 strLength AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 10 AST#expression#Right + AST#expression#Left 1 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma 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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strComma2 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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#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#assignment_expression#Left strLength = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtility AST#expression#Right . getLengthOfStringWithoutKind 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#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#binary_expression#Left AST#expression#Left strLength AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 12 AST#expression#Right + AST#expression#Left 1 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#block_statement#Left { // (4) 查找第二个子间隔符之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // (5) 若太长了,则只查找第一个子间隔符之前的部分 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left strLength = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtility AST#expression#Right . getLengthOfStringWithoutKind 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#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#binary_expression#Left AST#expression#Left strLength AST#expression#Right > AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 12 AST#expression#Right + AST#expression#Left 1 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub2 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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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 index = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left strCommaSub 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#binary_expression#Left AST#expression#Left index AST#expression#Right !== AST#expression#Left indexNoFound 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 str = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left str AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left index 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#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#return_statement#Left return AST#expression#Left str AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static getFirstPartFrom(srcText: string): string { const strComma: string = STR_COMMA_HALF; const strComma2: string = STR_COMMA_FULL; const strCommaSub: string = STR_COMMA_SUB_HALF; const strCommaSub2: string = STR_COMMA_SUB_FULL; let str: string = srcText; const indexNoFound: number = -1; let index: number = str.indexOf("\n"); if (index !== indexNoFound) { str = str.substring(0, index); } index = str.indexOf(strComma, str.indexOf(strComma) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strComma2, str.indexOf(strComma2) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } } let strLength: number = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (10 + 1)) { index = str.indexOf(strComma); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strComma2); if (index !== indexNoFound) { str = str.substring(0, index); } } } strLength = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (12 + 1)) { index = str.indexOf(strCommaSub2, str.indexOf(strCommaSub2) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strCommaSub, str.indexOf(strCommaSub) + 1); if (index !== indexNoFound) { str = str.substring(0, index); } } } strLength = AppUtility.getLengthOfStringWithoutKind(str); if (strLength > (12 + 1)) { index = str.indexOf(strCommaSub2); if (index !== indexNoFound) { str = str.substring(0, index); } else { index = str.indexOf(strCommaSub); if (index !== indexNoFound) { str = str.substring(0, index); } } } return str; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L172-L242
44c64dd1431a2f70f1f684ba540871475f4f592d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/common/constant/CommonConstant.ets
arkts
Style constants that can be used by all modules
export class CommonConstants { /** * Full width. */ static readonly FULL_WIDTH: string = '100%'; /** * Full height. */ static readonly FULL_HEIGHT: string = '100%'; /** * Normal font weight. */ static readonly FONT_WEIGHT: number = 500; /** * Larger font weight. */ static readonly FONT_WEIGHT_LARGE: number = 700; /** * Width of the content area. */ static readonly MAIN_BOARD_WIDTH: string = '93.3%'; /** * Opacity of text. */ static readonly OPACITY: number = 0.4; /** * Opacity of not. */ static readonly NO_OPACITY: number = 1; /** * Toast Duration. */ static readonly TOAST_TIME: number = 3000; /** * Bottom toast. */ static readonly TOAST_MARGIN_BOTTOM: number = 64; /** * Width of title. */ static readonly TITLE_WIDTH: string = '86.7%'; /** * Radius of bookInfo area. */ static readonly TARGET_BORDER_RADIUS: number = 24; /** * Radius of bookInfo area. */ static readonly IMAGE_BORDER_RADIUS: number = 12; /** * Margin left of book item. */ static readonly TARGET_MARGIN_LEFT: string = '5%'; /** * Width of slider. */ static readonly STROKE_WIDTH: number = 4.8; /** * Width of dialog. */ static readonly DIALOG_WIDTH: string = '90.3%'; /** * Radius of dialog. */ static readonly DIALOG_BORDER_RADIUS: number = 32; /** * Button width of dialog. */ static readonly DIALOG_OPERATION_WIDTH: string = '70%'; /** * Button height of dialog. */ static readonly DIALOG_OPERATION_HEIGHT: string = '10%'; /** * Button height of dialog. */ static readonly DIALOG_INPUT_HEIGHT: string = '40%'; /** * Input margin of dialog. */ static readonly DIALOG_INPUT_MARGIN: string = '6%'; /** * Horizontal offset of dialog. */ static readonly DIALOG_OFFSET_X: number = 0; /** * The smallest value of slider. */ static readonly SLIDER_MIN_VALUE: number = 0; /** * The maximum value of slider. */ static readonly SLIDER_MAX_VALUE: number = 100; /** * Step of slider. */ static readonly SLIDER_STEP: number = 1; /** * Width of slider. */ static readonly SLIDER_WIDTH: string = '90%'; /** * Height of slider. */ static readonly SLIDER_HEIGHT: string = '20%'; /** * Height of slider button. */ static readonly SLIDER_BUTTON_HEIGHT: string = '21%'; /** * Margin top of slider button. */ static readonly SLIDER_BUTTON_MARGIN: string = '4%'; /** * Margin top of slider button. */ static readonly SLIDER_INNER_WIDTH: string = '90%'; /** * Width of checkbox. */ static readonly CHECKBOX_WIDTH: number = 20; /** * Max of line. */ static readonly MAX_LINES: number = 2; /** * Height of list. */ static readonly LIST_HEIGHT: string = '80%'; /** * Height of list board. */ static readonly LIST_BOARD_HEIGHT: string = '67%'; /** * list space. */ static readonly LIST_SPACE: number = 12; /** * Width of task item. */ static readonly TASK_NAME_WIDTH: string = '30%'; /** * Radius of list. */ static readonly LIST_RADIUS: number = 24; /** * Default progress value. */ static readonly DEFAULT_PROGRESS_VALUE: string = '-'; /** * Current month plus one. */ static readonly PLUS_ONE: number = 1; /** * The fraction or number of seconds is less than 10. */ static readonly TEN: number = 10; /** * One task of data. */ static readonly ONE_TASK: number = 1; /** * animation duration. */ static readonly DURATION: number = 300; /** * default click index. */ static readonly DEFAULT_CLICK_INDEX: number = -1; /** * default SliderChangeMode. */ static readonly DEFAULT_SLIDER_MODE: number = -1; /** * click SliderChangeMode. */ static readonly CLICK_SLIDER_MODE: number = 3; /** * x-axis transition animation. */ static readonly TRANSITION_ANIMATION_X: number = 1; /** * y-axis transition animation. */ static readonly TRANSITION_ANIMATION_Y: number = 0; }
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full width. */ AST#property_declaration#Left static readonly FULL_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Full height. */ AST#property_declaration#Left static readonly FULL_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right /** * Normal font weight. */ AST#property_declaration#Left static readonly FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right /** * Larger font weight. */ AST#property_declaration#Left static readonly FONT_WEIGHT_LARGE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 700 AST#expression#Right ; AST#property_declaration#Right /** * Width of the content area. */ AST#property_declaration#Left static readonly MAIN_BOARD_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '93.3%' AST#expression#Right ; AST#property_declaration#Right /** * Opacity of text. */ AST#property_declaration#Left static readonly OPACITY : 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 /** * Opacity of not. */ AST#property_declaration#Left static readonly NO_OPACITY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * Toast Duration. */ AST#property_declaration#Left static readonly TOAST_TIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3000 AST#expression#Right ; AST#property_declaration#Right /** * Bottom toast. */ AST#property_declaration#Left static readonly TOAST_MARGIN_BOTTOM : 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#property_declaration#Right /** * Width of title. */ AST#property_declaration#Left static readonly TITLE_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '86.7%' AST#expression#Right ; AST#property_declaration#Right /** * Radius of bookInfo area. */ AST#property_declaration#Left static readonly TARGET_BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right /** * Radius of bookInfo area. */ AST#property_declaration#Left static readonly IMAGE_BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right /** * Margin left of book item. */ AST#property_declaration#Left static readonly TARGET_MARGIN_LEFT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '5%' AST#expression#Right ; AST#property_declaration#Right /** * Width of slider. */ AST#property_declaration#Left static readonly STROKE_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 4.8 AST#expression#Right ; AST#property_declaration#Right /** * Width of dialog. */ AST#property_declaration#Left static readonly DIALOG_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90.3%' AST#expression#Right ; AST#property_declaration#Right /** * Radius of dialog. */ AST#property_declaration#Left static readonly DIALOG_BORDER_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 32 AST#expression#Right ; AST#property_declaration#Right /** * Button width of dialog. */ AST#property_declaration#Left static readonly DIALOG_OPERATION_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '70%' AST#expression#Right ; AST#property_declaration#Right /** * Button height of dialog. */ AST#property_declaration#Left static readonly DIALOG_OPERATION_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '10%' AST#expression#Right ; AST#property_declaration#Right /** * Button height of dialog. */ AST#property_declaration#Left static readonly DIALOG_INPUT_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '40%' AST#expression#Right ; AST#property_declaration#Right /** * Input margin of dialog. */ AST#property_declaration#Left static readonly DIALOG_INPUT_MARGIN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '6%' AST#expression#Right ; AST#property_declaration#Right /** * Horizontal offset of dialog. */ AST#property_declaration#Left static readonly DIALOG_OFFSET_X : 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 /** * The smallest value of slider. */ AST#property_declaration#Left static readonly SLIDER_MIN_VALUE : 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 /** * The maximum value of slider. */ AST#property_declaration#Left static readonly SLIDER_MAX_VALUE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right ; AST#property_declaration#Right /** * Step of slider. */ AST#property_declaration#Left static readonly SLIDER_STEP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * Width of slider. */ AST#property_declaration#Left static readonly SLIDER_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /** * Height of slider. */ AST#property_declaration#Left static readonly SLIDER_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '20%' AST#expression#Right ; AST#property_declaration#Right /** * Height of slider button. */ AST#property_declaration#Left static readonly SLIDER_BUTTON_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '21%' AST#expression#Right ; AST#property_declaration#Right /** * Margin top of slider button. */ AST#property_declaration#Left static readonly SLIDER_BUTTON_MARGIN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '4%' AST#expression#Right ; AST#property_declaration#Right /** * Margin top of slider button. */ AST#property_declaration#Left static readonly SLIDER_INNER_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '90%' AST#expression#Right ; AST#property_declaration#Right /** * Width of checkbox. */ AST#property_declaration#Left static readonly CHECKBOX_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right ; AST#property_declaration#Right /** * Max of line. */ AST#property_declaration#Left static readonly MAX_LINES : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right ; AST#property_declaration#Right /** * Height of list. */ AST#property_declaration#Left static readonly LIST_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '80%' AST#expression#Right ; AST#property_declaration#Right /** * Height of list board. */ AST#property_declaration#Left static readonly LIST_BOARD_HEIGHT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '67%' AST#expression#Right ; AST#property_declaration#Right /** * list space. */ AST#property_declaration#Left static readonly LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 12 AST#expression#Right ; AST#property_declaration#Right /** * Width of task item. */ AST#property_declaration#Left static readonly TASK_NAME_WIDTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '30%' AST#expression#Right ; AST#property_declaration#Right /** * Radius of list. */ AST#property_declaration#Left static readonly LIST_RADIUS : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right ; AST#property_declaration#Right /** * Default progress value. */ AST#property_declaration#Left static readonly DEFAULT_PROGRESS_VALUE : 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 /** * Current month plus one. */ AST#property_declaration#Left static readonly PLUS_ONE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * The fraction or number of seconds is less than 10. */ AST#property_declaration#Left static readonly TEN : 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#property_declaration#Right /** * One task of data. */ AST#property_declaration#Left static readonly ONE_TASK : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * animation duration. */ AST#property_declaration#Left static readonly DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right ; AST#property_declaration#Right /** * default click index. */ AST#property_declaration#Left static readonly DEFAULT_CLICK_INDEX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * default SliderChangeMode. */ AST#property_declaration#Left static readonly DEFAULT_SLIDER_MODE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * click SliderChangeMode. */ AST#property_declaration#Left static readonly CLICK_SLIDER_MODE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right /** * x-axis transition animation. */ AST#property_declaration#Left static readonly TRANSITION_ANIMATION_X : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right /** * y-axis transition animation. */ AST#property_declaration#Left static readonly TRANSITION_ANIMATION_Y : 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class CommonConstants { static readonly FULL_WIDTH: string = '100%'; static readonly FULL_HEIGHT: string = '100%'; static readonly FONT_WEIGHT: number = 500; static readonly FONT_WEIGHT_LARGE: number = 700; static readonly MAIN_BOARD_WIDTH: string = '93.3%'; static readonly OPACITY: number = 0.4; static readonly NO_OPACITY: number = 1; static readonly TOAST_TIME: number = 3000; static readonly TOAST_MARGIN_BOTTOM: number = 64; static readonly TITLE_WIDTH: string = '86.7%'; static readonly TARGET_BORDER_RADIUS: number = 24; static readonly IMAGE_BORDER_RADIUS: number = 12; static readonly TARGET_MARGIN_LEFT: string = '5%'; static readonly STROKE_WIDTH: number = 4.8; static readonly DIALOG_WIDTH: string = '90.3%'; static readonly DIALOG_BORDER_RADIUS: number = 32; static readonly DIALOG_OPERATION_WIDTH: string = '70%'; static readonly DIALOG_OPERATION_HEIGHT: string = '10%'; static readonly DIALOG_INPUT_HEIGHT: string = '40%'; static readonly DIALOG_INPUT_MARGIN: string = '6%'; static readonly DIALOG_OFFSET_X: number = 0; static readonly SLIDER_MIN_VALUE: number = 0; static readonly SLIDER_MAX_VALUE: number = 100; static readonly SLIDER_STEP: number = 1; static readonly SLIDER_WIDTH: string = '90%'; static readonly SLIDER_HEIGHT: string = '20%'; static readonly SLIDER_BUTTON_HEIGHT: string = '21%'; static readonly SLIDER_BUTTON_MARGIN: string = '4%'; static readonly SLIDER_INNER_WIDTH: string = '90%'; static readonly CHECKBOX_WIDTH: number = 20; static readonly MAX_LINES: number = 2; static readonly LIST_HEIGHT: string = '80%'; static readonly LIST_BOARD_HEIGHT: string = '67%'; static readonly LIST_SPACE: number = 12; static readonly TASK_NAME_WIDTH: string = '30%'; static readonly LIST_RADIUS: number = 24; static readonly DEFAULT_PROGRESS_VALUE: string = '-'; static readonly PLUS_ONE: number = 1; static readonly TEN: number = 10; static readonly ONE_TASK: number = 1; static readonly DURATION: number = 300; static readonly DEFAULT_CLICK_INDEX: number = -1; static readonly DEFAULT_SLIDER_MODE: number = -1; static readonly CLICK_SLIDER_MODE: number = 3; static readonly TRANSITION_ANIMATION_X: number = 1; static readonly TRANSITION_ANIMATION_Y: number = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/common/constant/CommonConstant.ets#L19-L250
cfd72a89b96996946078ba8f563763523e20d79c
gitee