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
conrad_sheeran/TickAuth
8ef852e12999d15cf70394cdab82d08ac5843143
common/uicomponent/Index.ets
arkts
CustomDialog_Warning
Copyright (c) 2024 Yang He TickAuth 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 { CustomDialog_Warning } from './src/main/ets/pages/Warning'
AST#export_declaration#Left export { CustomDialog_Warning } from './src/main/ets/pages/Warning' AST#export_declaration#Right
export { CustomDialog_Warning } from './src/main/ets/pages/Warning'
https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/common/uicomponent/Index.ets#L18-L18
e101dcc4722b80dfe7f5f7b2eed9412ed3ee70b2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/managers/StorageManager.ets
arkts
initialize
初始化存储管理器 @param context 应用上下文
static async initialize(context: common.UIAbilityContext): Promise<boolean> { try { this.context = context; // 初始化默认存储 const defaultPrefs = await dataPreferences.getPreferences(context, AppConstants.STORAGE_NAME); this.preferences.set(AppConstants.STORAGE_NAME, defaultPrefs); // 初始化安全存储 const securePrefs = await dataPreferences.getPreferences(context, AppConstants.SECURE_STORAGE_NAME); this.preferences.set(AppConstants.SECURE_STORAGE_NAME, securePrefs); this.isInitialized = true; this.logInfo('存储管理器初始化成功'); return true; } catch (error) { this.logError('存储管理器初始化失败', error); return false; } }
AST#method_declaration#Left static async initialize 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 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#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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultPrefs = 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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . STORAGE_NAME 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#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . STORAGE_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left defaultPrefs 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 securePrefs = 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 dataPreferences AST#expression#Right AST#await_expression#Right AST#expression#Right . getPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . SECURE_STORAGE_NAME 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#member_expression#Left AST#expression#Left this AST#expression#Right . preferences AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AppConstants AST#expression#Right . SECURE_STORAGE_NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left securePrefs 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 . isInitialized AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logInfo 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#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '存储管理器初始化失败' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 async initialize(context: common.UIAbilityContext): Promise<boolean> { try { this.context = context; const defaultPrefs = await dataPreferences.getPreferences(context, AppConstants.STORAGE_NAME); this.preferences.set(AppConstants.STORAGE_NAME, defaultPrefs); const securePrefs = await dataPreferences.getPreferences(context, AppConstants.SECURE_STORAGE_NAME); this.preferences.set(AppConstants.SECURE_STORAGE_NAME, securePrefs); this.isInitialized = true; this.logInfo('存储管理器初始化成功'); return true; } catch (error) { this.logError('存储管理器初始化失败', error); return false; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/managers/StorageManager.ets#L43-L62
5bc61c59abbe094e69ce1415cf5a9b8873155e40
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/StringUtils.ets
arkts
strToBuffer
字符串转ArrayBuffer @param str @returns
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { let buf = buffer.from(src, encoding); return buf.buffer }
AST#method_declaration#Left static strToBuffer 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#Left encoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'utf-8' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left buf = 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 src AST#expression#Right , AST#expression#Left encoding 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 buf AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { let buf = buffer.from(src, encoding); return buf.buffer }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L251-L254
8efd4ececd026de66d44f56bbf462022ed41d703
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Callback for OnLoadIntercept @typedef { function } OnLoadIntercept Function. @param { OnLoadInterceptEvent } event - the load intercept event when the resources loading is intercepted. @returns { boolean } True if the load is intercepted else false. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export type OnLoadInterceptCallback = (event: OnLoadInterceptEvent) => boolean;
AST#export_declaration#Left export AST#type_declaration#Left type OnLoadInterceptCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnLoadInterceptEvent 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#function_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type OnLoadInterceptCallback = (event: OnLoadInterceptEvent) => boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L513-L513
b58c3c65087ec5bfddd117dcd7f4c043548ecbca
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getFavourite
获取收藏列表 @param includeItemTypes @returns
public getFavourite(includeItemTypes?: Array<FinItemType>): Promise<Array<FinItem>> { return this.requireApi().getFavourite(includeItemTypes) }
AST#method_declaration#Left public getFavourite AST#parameter_list#Left ( AST#parameter#Left includeItemTypes ? : 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 FinItemType 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 AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left FinItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 this AST#expression#Right . requireApi AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFavourite AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left includeItemTypes AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getFavourite(includeItemTypes?: Array<FinItemType>): Promise<Array<FinItem>> { return this.requireApi().getFavourite(includeItemTypes) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L134-L136
0b36c33ea56affebbd973f04ee5fd4126b6c1358
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets
arkts
defaultDeleteBuilder
删除按钮 @param item: 删除的列表项
@Builder defaultDeleteBuilder(item: Object) { Image($r("app.media.list_exchange_icon_delete")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .margin({ right: $r('app.integer.list_exchange_delete_icon_margin_right') }) .interpolation(ImageInterpolation.High)// 抗锯齿 .id('delete_button') .onClick(() => { this.listExchangeCtrl.deleteItem(item); }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right defaultDeleteBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.list_exchange_icon_delete" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.list_exchange_icon_size' 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.integer.list_exchange_icon_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover 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 right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.list_exchange_delete_icon_margin_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . interpolation ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageInterpolation AST#expression#Right . High AST#member_expression#Right AST#expression#Right ) // 抗锯齿 AST#modifier_chain_expression#Left . id ( AST#expression#Left 'delete_button' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listExchangeCtrl AST#member_expression#Right AST#expression#Right . deleteItem 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#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder defaultDeleteBuilder(item: Object) { Image($r("app.media.list_exchange_icon_delete")) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .objectFit(ImageFit.Cover) .margin({ right: $r('app.integer.list_exchange_delete_icon_margin_right') }) .interpolation(ImageInterpolation.High) .id('delete_button') .onClick(() => { this.listExchangeCtrl.deleteItem(item); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L106-L118
563e8666d8a43e1477e801d27d1fabbe8bac2e00
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Form/FormHost/entry/src/main/ets/pages/Index.ets
arkts
getAllBundleFormsInfo
将所有卡片信息存入formHapRecordMap中。
getAllBundleFormsInfo() { this.formCardHashMap.clear(); this.showFormPicker = false; let formHapRecordMap: HashMap<string, formInfo.FormInfo[]> = new HashMap(); this.formInfoRecord = []; formHost.getAllFormsInfo().then((formList: Array<formInfo.FormInfo>) => { console.log('getALlFormsInfo size:' + formList.length) for (let formItemInfo of formList) { let formBundleName = formItemInfo.bundleName; if (formHapRecordMap.hasKey(formBundleName)) { formHapRecordMap.get(formBundleName).push(formItemInfo) } else { let formInfoList: formInfo.FormInfo[] = [formItemInfo]; formHapRecordMap.set(formBundleName, formInfoList); } } for (let formBundle of formHapRecordMap.keys()) { let bundleFormInfo: TextCascadePickerRangeContent = { text: formBundle, children: [] } let bundleFormList: formInfo.FormInfo[] = formHapRecordMap.get(formBundle); bundleFormList.forEach((formItemInfo) => { let dimensionName = formHostSample.FORM_DIMENSIONS_MAP[formItemInfo.defaultDimension - 1]; bundleFormInfo.children?.push({ text: formItemInfo.name + '#' + dimensionName }); this.formCardHashMap.set(formBundle + "#" + formItemInfo.name + '#' + dimensionName, formItemInfo); }) this.formInfoRecord.push(bundleFormInfo); } this.formCardHashMap.forEach((formItem: formInfo.FormInfo) => { console.info(`formCardHashmap: ${JSON.stringify(formItem)}`); }) this.showFormPicker = true; }) }
AST#method_declaration#Left getAllBundleFormsInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . formCardHashMap AST#member_expression#Right AST#expression#Right . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . showFormPicker AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left formHapRecordMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HashMap 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 AST#qualified_type#Left formInfo . FormInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left [ ] AST#ERROR#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#new_expression#Left new AST#expression#Left HashMap 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 this AST#expression#Right . formInfoRecord 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#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 formHost AST#expression#Right . getAllFormsInfo 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 formList : 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 AST#qualified_type#Left formInfo . FormInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'getALlFormsInfo size:' AST#expression#Right + AST#expression#Left formList AST#expression#Right AST#binary_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 AST#statement#Left AST#for_statement#Left for ( let formItemInfo of AST#expression#Left formList AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left formBundleName = AST#expression#Left AST#member_expression#Left AST#expression#Left formItemInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formHapRecordMap AST#expression#Right . hasKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formBundleName 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formHapRecordMap AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formBundleName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formItemInfo 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#variable_declaration#Left let AST#variable_declarator#Left formInfoList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left formInfo AST#ERROR#Left . FormInfo AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left formItemInfo AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formHapRecordMap AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formBundleName AST#expression#Right , AST#expression#Left formInfoList AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let formBundle of AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formHapRecordMap AST#expression#Right . keys AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleFormInfo : AST#type_annotation#Left AST#primary_type#Left TextCascadePickerRangeContent AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left formBundle AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left children 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#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleFormList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left formInfo AST#ERROR#Left . FormInfo AST#ERROR#Right [ ] AST#array_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 formHapRecordMap AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left formBundle 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 bundleFormList 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 formItemInfo AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dimensionName = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formHostSample AST#expression#Right . FORM_DIMENSIONS_MAP AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formItemInfo AST#expression#Right . defaultDimension AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#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 bundleFormInfo AST#expression#Right . children AST#member_expression#Right AST#expression#Right ?. push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left formItemInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right + AST#expression#Left '#' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left dimensionName 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#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 . formCardHashMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#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 formBundle AST#expression#Right + AST#expression#Left "#" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left formItemInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right + AST#expression#Left '#' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left dimensionName AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left formItemInfo 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . formInfoRecord AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleFormInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#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 . formCardHashMap 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 formItem : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left formInfo . FormInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` formCardHashmap: 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 formItem AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showFormPicker 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#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getAllBundleFormsInfo() { this.formCardHashMap.clear(); this.showFormPicker = false; let formHapRecordMap: HashMap<string, formInfo.FormInfo[]> = new HashMap(); this.formInfoRecord = []; formHost.getAllFormsInfo().then((formList: Array<formInfo.FormInfo>) => { console.log('getALlFormsInfo size:' + formList.length) for (let formItemInfo of formList) { let formBundleName = formItemInfo.bundleName; if (formHapRecordMap.hasKey(formBundleName)) { formHapRecordMap.get(formBundleName).push(formItemInfo) } else { let formInfoList: formInfo.FormInfo[] = [formItemInfo]; formHapRecordMap.set(formBundleName, formInfoList); } } for (let formBundle of formHapRecordMap.keys()) { let bundleFormInfo: TextCascadePickerRangeContent = { text: formBundle, children: [] } let bundleFormList: formInfo.FormInfo[] = formHapRecordMap.get(formBundle); bundleFormList.forEach((formItemInfo) => { let dimensionName = formHostSample.FORM_DIMENSIONS_MAP[formItemInfo.defaultDimension - 1]; bundleFormInfo.children?.push({ text: formItemInfo.name + '#' + dimensionName }); this.formCardHashMap.set(formBundle + "#" + formItemInfo.name + '#' + dimensionName, formItemInfo); }) this.formInfoRecord.push(bundleFormInfo); } this.formCardHashMap.forEach((formItem: formInfo.FormInfo) => { console.info(`formCardHashmap: ${JSON.stringify(formItem)}`); }) this.showFormPicker = true; }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Form/FormHost/entry/src/main/ets/pages/Index.ets#L178-L212
e6f6d674ae6594704843c569e3da5df1807167e8
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/TransitionAnimation/entry/src/main/ets/pages/page/BottomTransition.ets
arkts
pageTransition
页面转场通过全局transition方法进行配置转场参数
pageTransition() { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) // 页面退场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) }
AST#method_declaration#Left pageTransition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 页面入场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left 600 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Smooth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 页面退场组件:SlideEffect.Bottom 设置到入场时表示从下边滑入,出场时表示滑出到下边。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionExit ( AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left 600 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left curve : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Smooth AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
pageTransition() { PageTransitionEnter({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) PageTransitionExit({ duration: 600, curve: Curve.Smooth }) .slide(SlideEffect.Bottom) }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/TransitionAnimation/entry/src/main/ets/pages/page/BottomTransition.ets#L33-L42
840de684e197df4f3aabf1beafe714ad62253177
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceBetween
纵向两端分布 + 水平居中
@ComponentV2 export struct ColumnSpaceBetween { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Param sizeValue: SizeOptions | undefined = undefined; /** * 内边距 */ @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; /** * 外边距 */ @Param marginValue: Margin | Length | LocalizedMargin | undefined = undefined; /** * 是否填充最大宽高 */ @Param fillMaxSize: boolean = false; /** * 背景颜色 */ @Param bgColor: ResourceColor | undefined = undefined; /** * 点击事件 */ @Param onTap: ((event: ClickEvent) => void) | undefined = undefined; /** * 内容构建函数 */ @BuilderParam content: CustomBuilder; /** * 渲染布局 * @returns {void} 无返回值 * @example * ColumnSpaceBetween() { Text("A"); Text("B"); } */ build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, fillMaxSize: this.fillMaxSize, bgColor: this.bgColor, onTap: this.onTap, content: this.content }); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceBetween AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ColumnOptions AST#primary_type#Right | AST#primary_type#Left ColumnOptionsV2 AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 宽度 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right widthValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 高度 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right heightValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 尺寸(对应官方 size 属性) */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right sizeValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left SizeOptions AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 内边距 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right paddingValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedPadding AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 外边距 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right marginValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Margin AST#primary_type#Right | AST#primary_type#Left Length AST#primary_type#Right | AST#primary_type#Left LocalizedMargin AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 是否填充最大宽高 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right fillMaxSize : 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 @ Param AST#decorator#Right bgColor : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 点击事件 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ClickEvent 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#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right /** * 内容构建函数 */ AST#property_declaration#Left AST#decorator#Left @ BuilderParam AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left CustomBuilder AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 渲染布局 * @returns {void} 无返回值 * @example * ColumnSpaceBetween() { Text("A"); Text("B"); } */ AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . options AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left widthValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . widthValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left sizeValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left paddingValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paddingValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left marginValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . marginValue AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fillMaxSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onTap : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onTap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct ColumnSpaceBetween { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding | Length | LocalizedPadding | undefined = undefined; @Param marginValue: Margin | Length | LocalizedMargin | undefined = undefined; @Param fillMaxSize: boolean = false; @Param bgColor: ResourceColor | undefined = undefined; @Param onTap: ((event: ClickEvent) => void) | undefined = undefined; @BuilderParam content: CustomBuilder; build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, fillMaxSize: this.fillMaxSize, bgColor: this.bgColor, onTap: this.onTap, content: this.content }); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L385-L460
2c51f1a091da2874bb7464d61775ef08eb24f9fb
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
clear
清除所有数据
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to clear preferences: ${businessError.message}`); throw new Error(businessError.message); } }
AST#method_declaration#Left async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 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 clear preferences: 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 clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to clear preferences: ${businessError.message}`); throw new Error(businessError.message); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L266-L276
afb4d96d832f40317cd235b62969e68b2383a1cf
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/widget/ToolBarComponent.ets
arkts
底部工具栏动作接口
export interface ToolbarActions { /** * 颜色选择回调接口 * @param color 16进制字符串颜色 * @param rgbColor rgb颜色模型 */ onPickColor: (color: string, rgbColor: RgbColor) => void; /** * 旋转回调 * @param angle 旋转角度 */ onRotate: (angle: number) => void; /** * 选择的尺寸回调 * @param size 大小 */ onPickSize: (size: number) => void; /** * 画笔粗细选择回调 * @param size 画笔粗细 */ onPickBrushSize: (size: number) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolbarActions AST#object_type#Left { /** * 颜色选择回调接口 * @param color 16进制字符串颜色 * @param rgbColor rgb颜色模型 */ AST#type_member#Left onPickColor : AST#type_annotation#Left AST#function_type#Left 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#Left rgbColor : AST#type_annotation#Left AST#primary_type#Left RgbColor 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#type_member#Right ; /** * 旋转回调 * @param angle 旋转角度 */ AST#type_member#Left onRotate : AST#type_annotation#Left AST#function_type#Left 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#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#type_member#Right ; /** * 选择的尺寸回调 * @param size 大小 */ AST#type_member#Left onPickSize : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left size : 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#type_member#Right ; /** * 画笔粗细选择回调 * @param size 画笔粗细 */ AST#type_member#Left onPickBrushSize : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left size : 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#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ToolbarActions { onPickColor: (color: string, rgbColor: RgbColor) => void; onRotate: (angle: number) => void; onPickSize: (size: number) => void; onPickBrushSize: (size: number) => void; }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/widget/ToolBarComponent.ets#L27-L49
d2b1c24c33009c573b6466582ef62926941ebfea
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets
arkts
searchClassificationSelection
搜索添加分类选项
@Builder searchClassificationSelection() { Column() { Column() { Text($r('app.string.search_component_search_classify_fixed_words')) .fontColor($r('app.color.search_classify_fixed_words_color')) } .width('100%') .alignItems(HorizontalAlign.Start) .margin({ bottom: $r('app.integer.search_component_classify_description_margin') }) Grid() { // TODO:知识点:使用ForEach加载分类搜索列表数据 ForEach(this.searchClassifyData, (item: string, index: number) => { GridItem() { Text(item) .fontColor(this.classifyIndex === index ? Color.White : Color.Black) .opacity(this.classifyIndex === index ? 1 : 0.8) } .height($r('app.integer.search_component_classify_category_item_height')) .width($r('app.integer.search_component_classify_category_item_weight')) .backgroundColor(this.classifyIndex === index ? $r('app.color.search_classify_category_chosen_color') : $r('app.color.search_classify_category_not_chosen_color')) .borderRadius($r('app.integer.search_component_classify_category_border_radius')) .onClick(() => { this.classifyIndex = this.classifyIndex === index ? -1 : index; this.categoryName = this.classifyIndex === index ? item : ''; this.searchFunc(this.searchInput, this.categoryName); }) }, (item: string) => item.toString()) } .height($r('app.integer.search_component_classify_category_height')) .width('100%') .columnsTemplate('1fr 1fr 1fr') .rowsGap($r('app.integer.search_component_classify_category_rows_gap')) .columnsGap($r('app.integer.search_component_classify_category_columns_gap')) } .width('100%') .padding($r('app.integer.search_component_classify_category_padding')) .border({ width: { bottom: $r('app.integer.search_component_classify_category_split_line') }, color: { bottom: $r('app.color.search_classify_split_line_color') } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right searchClassificationSelection AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.search_component_search_classify_fixed_words' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.search_classify_fixed_words_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_description_margin' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Grid ( ) AST#container_content_body#Left { // TODO:知识点:使用ForEach加载分类搜索列表数据 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 . searchClassifyData 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 string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left item AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( 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 . classifyIndex 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 Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( 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 . classifyIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0.8 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_item_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_item_weight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyIndex 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.search_classify_category_chosen_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.search_classify_category_not_chosen_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_border_radius' AST#expression#Right ) AST#resource_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 . classifyIndex AST#member_expression#Right = 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 . classifyIndex 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#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right : AST#expression#Left index 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 . categoryName AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . classifyIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right AST#ERROR#Left : '' ; this AST#ERROR#Right . searchFunc 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 . searchInput AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . categoryName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#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 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . columnsTemplate ( AST#expression#Left '1fr 1fr 1fr' AST#expression#Right ) AST#modifier_chain_expression#Left . rowsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_rows_gap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . columnsGap ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_columns_gap' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.search_component_classify_category_split_line' AST#expression#Right ) AST#resource_expression#Right 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 color AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.search_classify_split_line_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#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 searchClassificationSelection() { Column() { Column() { Text($r('app.string.search_component_search_classify_fixed_words')) .fontColor($r('app.color.search_classify_fixed_words_color')) } .width('100%') .alignItems(HorizontalAlign.Start) .margin({ bottom: $r('app.integer.search_component_classify_description_margin') }) Grid() { ForEach(this.searchClassifyData, (item: string, index: number) => { GridItem() { Text(item) .fontColor(this.classifyIndex === index ? Color.White : Color.Black) .opacity(this.classifyIndex === index ? 1 : 0.8) } .height($r('app.integer.search_component_classify_category_item_height')) .width($r('app.integer.search_component_classify_category_item_weight')) .backgroundColor(this.classifyIndex === index ? $r('app.color.search_classify_category_chosen_color') : $r('app.color.search_classify_category_not_chosen_color')) .borderRadius($r('app.integer.search_component_classify_category_border_radius')) .onClick(() => { this.classifyIndex = this.classifyIndex === index ? -1 : index; this.categoryName = this.classifyIndex === index ? item : ''; this.searchFunc(this.searchInput, this.categoryName); }) }, (item: string) => item.toString()) } .height($r('app.integer.search_component_classify_category_height')) .width('100%') .columnsTemplate('1fr 1fr 1fr') .rowsGap($r('app.integer.search_component_classify_category_rows_gap')) .columnsGap($r('app.integer.search_component_classify_category_columns_gap')) } .width('100%') .padding($r('app.integer.search_component_classify_category_padding')) .border({ width: { bottom: $r('app.integer.search_component_classify_category_split_line') }, color: { bottom: $r('app.color.search_classify_split_line_color') } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/searchcomponent/src/main/ets/components/mainpage/SearchComponent.ets#L175-L218
b72332635428b803c934d079fbdacef296860378
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/AddCityPage.ets
arkts
构建页面内容。
build() { Column() { BackContainer({ header: "添加城市" }); List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) { ForEach(WorldClockViewModel.mainCities, (city: CityItem) => { ListItem() { Column() { Text(`${city.city},${city.country}`) .fontSize($r('app.float.font_size_M')); Text(`GMT${CityItem.formatUTCOffset(city.UTCOffset)}`) .fontColor($r('app.color.grey_text')) .fontSize($r('app.float.font_size_S')); } .alignItems(HorizontalAlign.Start); } .onClick(() => { if (this.viewModel.cities.some(cityItem => CityItem.equals(cityItem, city))) { promptAction.showToast({ message: '该城市已添加' }); return; } this.viewModel.addCity(city); router.back(); }); }); } .padding({ left: DimensionUtil.getVp($r('app.float.title_horizon_margin')), right: DimensionUtil.getVp($r('app.float.title_horizon_margin')) }); }.width(CommonConstants.FULL_LENGTH); }
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#ui_custom_component_statement#Left BackContainer ( AST#component_parameters#Left { AST#component_parameter#Left header : AST#expression#Left "添加城市" AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Scroller 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#component_parameter#Right , AST#component_parameter#Left space : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getVp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.city_list_space' AST#expression#Right ) AST#resource_expression#Right 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left WorldClockViewModel AST#expression#Right . mainCities AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left city : AST#type_annotation#Left AST#primary_type#Left CityItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . city AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . country AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.font_size_M' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` GMT AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CityItem AST#expression#Right . formatUTCOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . UTCOffset 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#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.grey_text' 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.font_size_S' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . cities AST#member_expression#Right AST#expression#Right . some AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left cityItem => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CityItem AST#expression#Right . equals AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cityItem AST#expression#Right , AST#expression#Left city 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#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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left '该城市已添加' 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewModel AST#member_expression#Right AST#expression#Right . addCity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left city AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getVp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.title_horizon_margin' AST#expression#Right ) AST#resource_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 right AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DimensionUtil AST#expression#Right . getVp AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.title_horizon_margin' AST#expression#Right ) AST#resource_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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_LENGTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { BackContainer({ header: "添加城市" }); List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) { ForEach(WorldClockViewModel.mainCities, (city: CityItem) => { ListItem() { Column() { Text(`${city.city},${city.country}`) .fontSize($r('app.float.font_size_M')); Text(`GMT${CityItem.formatUTCOffset(city.UTCOffset)}`) .fontColor($r('app.color.grey_text')) .fontSize($r('app.float.font_size_S')); } .alignItems(HorizontalAlign.Start); } .onClick(() => { if (this.viewModel.cities.some(cityItem => CityItem.equals(cityItem, city))) { promptAction.showToast({ message: '该城市已添加' }); return; } this.viewModel.addCity(city); router.back(); }); }); } .padding({ left: DimensionUtil.getVp($r('app.float.title_horizon_margin')), right: DimensionUtil.getVp($r('app.float.title_horizon_margin')) }); }.width(CommonConstants.FULL_LENGTH); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/AddCityPage.ets#L32-L67
514394ce6fb4d8a8c321e93d42604ecaaa1547ff
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets
arkts
Generic categorical data, second menu data
export const UNIVERSAL_CATEGORIES: SecondLevelCategory[] = [ { title: $r('app.string.common_events'), childNodes: COMMON_EVENTS }, { title: $r('app.string.common_properties'), childNodes: GRAPHIC_TRANSFORMATION }, { title: $r('app.string.gesture_process'), childNodes: GESTURE } ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left UNIVERSAL_CATEGORIES : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SecondLevelCategory [ ] 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.common_events' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left childNodes AST#property_name#Right : AST#expression#Left COMMON_EVENTS 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.common_properties' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left childNodes AST#property_name#Right : AST#expression#Left GRAPHIC_TRANSFORMATION 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.gesture_process' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left childNodes AST#property_name#Right : AST#expression#Left GESTURE AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const UNIVERSAL_CATEGORIES: SecondLevelCategory[] = [ { title: $r('app.string.common_events'), childNodes: COMMON_EVENTS }, { title: $r('app.string.common_properties'), childNodes: GRAPHIC_TRANSFORMATION }, { title: $r('app.string.gesture_process'), childNodes: GESTURE } ];
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/universal/UniversialData.ets#L263-L268
571890cafa5fb5ddd7e1d10ac3eda28a55a7d031
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareFile
分享任意文件类型 @param filePath - 文件路径 @param title - 分享标题(可选) @param summary - 分享描述(可选) @param customUtd - 自定义UTD类型(可选)
static shareFile( filePath: string, title?: string, summary?: string, customUtd?: string ): void { // 转换文件路径为URI格式 const uri = fileUri.getUriFromPath(filePath); // 自动检测文件类型(基于扩展名) const extension = filePath.split('.').pop() || ''; const detectedUtd = utd.getUniformDataTypeByFilenameExtension( '.' + extension, utd.UniformDataType.FILE // 默认类型 ); // 创建分享数据 const data = new systemShare.SharedData({ utd: customUtd || detectedUtd, // 优先使用自定义类型 uri: uri, title: title || `分享${extension.toUpperCase()}文件` // 动态标题 }); // 添加文件记录 data.addRecord({ utd: customUtd || detectedUtd, uri: uri }); // 添加描述文本(如果存在) if (summary) { data.addRecord({ utd: utd.UniformDataType.PLAIN_TEXT, content: summary }); } // 显示分享面板 ShareUtils.showSharePanel(data); }
AST#method_declaration#Left static shareFile 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#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 summary ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left customUtd ? : 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 { // 转换文件路径为URI格式 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 fileUri AST#expression#Right . getUriFromPath 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 extension = 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#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 || 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 detectedUtd = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . getUniformDataTypeByFilenameExtension AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '.' AST#expression#Right + AST#expression#Left extension AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . FILE 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 data = 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 systemShare AST#expression#Right AST#new_expression#Right AST#expression#Right . SharedData 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 utd AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left customUtd AST#expression#Right || AST#expression#Left detectedUtd AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , // 优先使用自定义类型 AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left title AST#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 extension AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right 文件 ` AST#template_literal#Right 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#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 data AST#expression#Right . addRecord 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 utd AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left customUtd AST#expression#Right || AST#expression#Left detectedUtd AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left uri AST#property_name#Right : AST#expression#Left uri 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#if_statement#Left if ( AST#expression#Left summary 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 data AST#expression#Right . addRecord 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 utd AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left utd AST#expression#Right . UniformDataType AST#member_expression#Right AST#expression#Right . PLAIN_TEXT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left summary 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 ShareUtils AST#expression#Right . showSharePanel 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#method_declaration#Right
static shareFile( filePath: string, title?: string, summary?: string, customUtd?: string ): void { const uri = fileUri.getUriFromPath(filePath); const extension = filePath.split('.').pop() || ''; const detectedUtd = utd.getUniformDataTypeByFilenameExtension( '.' + extension, utd.UniformDataType.FILE ); const data = new systemShare.SharedData({ utd: customUtd || detectedUtd, uri: uri, title: title || `分享${extension.toUpperCase()}文件` }); data.addRecord({ utd: customUtd || detectedUtd, uri: uri }); if (summary) { data.addRecord({ utd: utd.UniformDataType.PLAIN_TEXT, content: summary }); } ShareUtils.showSharePanel(data); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L87-L126
09be98c8abb0d028421534ddd6f3e7f546dbd9ce
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
isNotificationEnabled
查询通知是否授权
static async isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); //查询通知是否授权。 }
AST#method_declaration#Left static async isNotificationEnabled 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationManager AST#expression#Right . isNotificationEnabled 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 isNotificationEnabled(): Promise<boolean> { return notificationManager.isNotificationEnabled(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L58-L60
2941edf029b3b3538d85dfe6eecb8e10cc5e80c1
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param key 给定秘钥规格密钥 @param iv iv偏移量字符串 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @returns
static async encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { //转换key let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建加密器 let cipher = crypto.createCipher(symEncryptName); //初始化加密 await cipher.init(mode, symKey, CryptoUtil.genIvParamsSpec(iv, keyName)); //封装加密所需数据 let encode = new util.TextEncoder(); //开始加密 let updateOutput = await cipher.doFinal({ data: encode.encodeInto(str) }); //转换字符串 let result = StrAndUintUtil.unitArray2String(updateOutput.data); //返回 return OutDTO.OKByDataRow<string>(symAlgName + '-CBC加密成功~', result); }
AST#method_declaration#Left static async encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symEncryptName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyName : 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 AST#generic_type#Left OutDTO 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //转换key AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKey = 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 CryptoUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . convertKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right , AST#expression#Left symAlgName AST#expression#Right , AST#expression#Left keyName 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 mode = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . CryptoMode AST#member_expression#Right AST#expression#Right . ENCRYPT_MODE 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 cipher = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createCipher AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symEncryptName 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#await_expression#Left await AST#expression#Left cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . init AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left mode AST#expression#Right , AST#expression#Left symKey AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoUtil AST#expression#Right . genIvParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left iv AST#expression#Right , AST#expression#Left keyName 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#variable_declaration#Left let AST#variable_declarator#Left encode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . TextEncoder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //开始加密 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateOutput = 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 cipher AST#expression#Right AST#await_expression#Right AST#expression#Right . doFinal 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 data AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left encode AST#expression#Right . encodeInto 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#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#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StrAndUintUtil AST#expression#Right . unitArray2String AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left updateOutput AST#expression#Right . data 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OutDTO AST#expression#Right . OKByDataRow AST#member_expression#Right AST#expression#Right 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#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left symAlgName AST#expression#Right + AST#expression#Left '-CBC加密成功~' AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async encodeCBC(str: string, key: string, iv: string, symAlgName: string, symEncryptName: string, keyName: number): Promise<OutDTO<string>> { let symKey = await CryptoUtil.convertKeyFromStr(key, symAlgName, keyName); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto.createCipher(symEncryptName); await cipher.init(mode, symKey, CryptoUtil.genIvParamsSpec(iv, keyName)); let encode = new util.TextEncoder(); let updateOutput = await cipher.doFinal({ data: encode.encodeInto(str) }); let result = StrAndUintUtil.unitArray2String(updateOutput.data); return OutDTO.OKByDataRow<string>(symAlgName + '-CBC加密成功~', result); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoUtil.ets#L124-L141
c81f2dace6b3a2a484d6b3a017b52cd91a273b7b
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
消息工具函数类 提供批量操作、过滤、分组等实用功能 所有方法都是静态方法,无需实例化
export class MessageUtils { // ========== 批量操作 ========== /** * 批量序列化消息为二进制 * * @param messages 消息数组 * @returns 二进制数据数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const binaries = MessageUtils.toBinaryBatch(people) * ``` */ static toBinaryBatch<T extends Message>(messages: T[]): Uint8Array[] { return messages.map(m => m.toBinary()) } /** * 批量转换消息为 JSON * * @param messages 消息数组 * @returns JSON 对象数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const jsonArray = MessageUtils.toJsonBatch(people) * ``` */ static toJsonBatch<T extends Message>(messages: T[]): Record<string, Object>[] { return messages.map(m => m.toJson()) } /** * 批量克隆消息 * * @param messages 消息数组 * @returns 克隆后的消息数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const clonedPeople = MessageUtils.cloneBatch(people) * ``` */ static cloneBatch<T extends Message>(messages: T[]): T[] { return messages.map(m => m.clone() as T) } // ========== 合并操作 ========== /** * 深度合并多个消息(后面的覆盖前面的) * * 合并语义(Protobuf 标准): * - 标量字段:后面的覆盖前面的 * - repeated 字段:追加(不是替换!) * - 嵌套消息:递归合并 * * @param messages 消息数组 * @returns 合并后的消息,如果数组为空则返回 null * * 使用示例: * ```typescript * const base = Person.create({ name: 'Alice', age: 30 }) * const update1 = Person.create({ age: 31 }) * const update2 = Person.create({ emails: ['alice@example.com'] }) * const merged = MessageUtils.mergeAll([base, update1, update2]) * // merged: { name: 'Alice', age: 31, emails: ['alice@example.com'] } * ``` */ static mergeAll<T extends Message>(messages: T[]): T | null { if (messages.length === 0) { return null } const result = messages[0].clone() as T for (let i = 1; i < messages.length; i++) { result.mergeFrom(messages[i]) } return result } // ========== 验证和过滤 ========== /** * 过滤有效消息 * * @param messages 消息数组 * @returns 只包含有效消息的数组 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const validPeople = MessageUtils.filterValid(people) * // validPeople: [person1, person3] * ``` */ static filterValid<T extends Message>(messages: T[]): T[] { return messages.filter(m => m.isValid()) } /** * 过滤无效消息 * * @param messages 消息数组 * @returns 只包含无效消息的数组 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalidPeople = MessageUtils.filterInvalid(people) * // invalidPeople: [invalidPerson] * ``` */ static filterInvalid<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isValid()) } /** * 过滤非空消息 * * @param messages 消息数组 * @returns 只包含非空消息的数组 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const nonEmptyPeople = MessageUtils.filterNonEmpty(people) * // nonEmptyPeople: [person1, person3] * ``` */ static filterNonEmpty<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isEmpty()) } // ========== 查找操作 ========== /** * 查找第一个无效消息 * * @param messages 消息数组 * @returns 第一个无效消息,如果都有效则返回 null * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalid = MessageUtils.findInvalid(people) * if (invalid !== null) { * console.error('Found invalid message:', invalid.validate()) * } * ``` */ static findInvalid<T extends Message>(messages: T[]): T | null { const found = messages.find(m => !m.isValid()) return found !== undefined ? found : null } /** * 查找第一个有效消息 * * @param messages 消息数组 * @returns 第一个有效消息,如果都无效则返回 null * * 使用示例: * ```typescript * const people = [invalidPerson1, validPerson, invalidPerson2] * const valid = MessageUtils.findValid(people) * ``` */ static findValid<T extends Message>(messages: T[]): T | null { const found = messages.find(m => m.isValid()) return found !== undefined ? found : null } /** * 查找第一个空消息 * * @param messages 消息数组 * @returns 第一个空消息,如果都非空则返回 null * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const empty = MessageUtils.findEmpty(people) * ``` */ static findEmpty<T extends Message>(messages: T[]): T | null { const found = messages.find(m => m.isEmpty()) return found !== undefined ? found : null } // ========== 判断操作 ========== /** * 判断所有消息是否都有效 * * @param messages 消息数组 * @returns true 如果所有消息都有效 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * if (MessageUtils.allValid(people)) { * console.log('All messages are valid') * } * ``` */ static allValid<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isValid()) } /** * 判断是否存在无效消息 * * @param messages 消息数组 * @returns true 如果存在至少一个无效消息 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * if (MessageUtils.hasInvalid(people)) { * console.warn('Found invalid messages') * } * ``` */ static hasInvalid<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isValid()) } /** * 判断所有消息是否都为空 * * @param messages 消息数组 * @returns true 如果所有消息都为空 * * 使用示例: * ```typescript * const people = [emptyPerson1, emptyPerson2] * if (MessageUtils.allEmpty(people)) { * console.log('All messages are empty') * } * ``` */ static allEmpty<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isEmpty()) } /** * 判断是否存在非空消息 * * @param messages 消息数组 * @returns true 如果存在至少一个非空消息 * * 使用示例: * ```typescript * const people = [emptyPerson, person1, emptyPerson2] * if (MessageUtils.hasNonEmpty(people)) { * console.log('Found non-empty messages') * } * ``` */ static hasNonEmpty<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isEmpty()) } // ========== 分组操作 ========== // groupBy 和 countBy 被移除,因为 ArkTS 不支持动态索引访问和 Keyof 泛型索引 // ========== 统计操作 ========== /** * 统计有效消息数量 * * @param messages 消息数组 * @returns 有效消息的数量 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const validCount = MessageUtils.countValid(people) * // validCount: 2 * ``` */ static countValid<T extends Message>(messages: T[]): number { return messages.filter(m => m.isValid()).length } /** * 统计无效消息数量 * * @param messages 消息数组 * @returns 无效消息的数量 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalidCount = MessageUtils.countInvalid(people) * // invalidCount: 1 * ``` */ static countInvalid<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isValid()).length } /** * 统计空消息数量 * * @param messages 消息数组 * @returns 空消息的数量 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const emptyCount = MessageUtils.countEmpty(people) * // emptyCount: 1 * ``` */ static countEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => m.isEmpty()).length } /** * 统计非空消息数量 * * @param messages 消息数组 * @returns 非空消息的数量 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const nonEmptyCount = MessageUtils.countNonEmpty(people) * // nonEmptyCount: 2 * ``` */ static countNonEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isEmpty()).length } // ========== 转换操作 ========== // pluck 被移除,因为 ArkTS 不支持动态索引访问 /** * 去重(基于二进制比较) * * @param messages 消息数组 * @returns 去重后的消息数组 * * 使用示例: * ```typescript * const people = [person1, person2, person1Clone, person3] * const uniquePeople = MessageUtils.unique(people) * // uniquePeople: [person1, person2, person3] * ``` */ static unique<T extends Message>(messages: T[]): T[] { const seen = new Set<string>() const result: T[] = [] for (const msg of messages) { // 使用二进制数据作为唯一标识 try { const binary = msg.toBinary(true) const key = MessageUtils.binaryToString(binary) if (!seen.has(key)) { seen.add(key) result.push(msg) } } catch (e) { // 如果序列化失败,直接添加(避免丢失数据) result.push(msg) } } return result } /** * 辅助方法:将 Uint8Array 转换为字符串(用于 Set 比较) */ private static binaryToString(binary: Uint8Array): string { let result = '' for (let i = 0; i < binary.length; i++) { result += String.fromCharCode(binary[i]) } return result } }
AST#export_declaration#Left export AST#class_declaration#Left class MessageUtils AST#class_body#Left { // ========== 批量操作 ========== /** * 批量序列化消息为二进制 * * @param messages 消息数组 * @returns 二进制数据数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const binaries = MessageUtils.toBinaryBatch(people) * ``` */ AST#method_declaration#Left static toBinaryBatch AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Uint8Array [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . toBinary 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#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 /** * 批量转换消息为 JSON * * @param messages 消息数组 * @returns JSON 对象数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const jsonArray = MessageUtils.toJsonBatch(people) * ``` */ AST#method_declaration#Left static toJsonBatch AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ERROR#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 Object AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ ] AST#tuple_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 messages AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . toJson 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#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 /** * 批量克隆消息 * * @param messages 消息数组 * @returns 克隆后的消息数组 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * const clonedPeople = MessageUtils.cloneBatch(people) * ``` */ AST#method_declaration#Left static cloneBatch AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . clone 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 T AST#primary_type#Right AST#type_annotation#Right AST#as_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#method_declaration#Right // ========== 合并操作 ========== /** * 深度合并多个消息(后面的覆盖前面的) * * 合并语义(Protobuf 标准): * - 标量字段:后面的覆盖前面的 * - repeated 字段:追加(不是替换!) * - 嵌套消息:递归合并 * * @param messages 消息数组 * @returns 合并后的消息,如果数组为空则返回 null * * 使用示例: * ```typescript * const base = Person.create({ name: 'Alice', age: 30 }) * const update1 = Person.create({ age: 31 }) * const update2 = Person.create({ emails: ['alice@example.com'] }) * const merged = MessageUtils.mergeAll([base, update1, update2]) * // merged: { name: 'Alice', age: 31, emails: ['alice@example.com'] } * ``` */ AST#method_declaration#Left static mergeAll AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages 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#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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = 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 messages AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . clone 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 T 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messages AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . mergeFrom AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left messages AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ========== 验证和过滤 ========== /** * 过滤有效消息 * * @param messages 消息数组 * @returns 只包含有效消息的数组 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const validPeople = MessageUtils.filterValid(people) * // validPeople: [person1, person3] * ``` */ AST#method_declaration#Left static filterValid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isValid 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#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 /** * 过滤无效消息 * * @param messages 消息数组 * @returns 只包含无效消息的数组 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalidPeople = MessageUtils.filterInvalid(people) * // invalidPeople: [invalidPerson] * ``` */ AST#method_declaration#Left static filterInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid 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#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 /** * 过滤非空消息 * * @param messages 消息数组 * @returns 只包含非空消息的数组 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const nonEmptyPeople = MessageUtils.filterNonEmpty(people) * // nonEmptyPeople: [person1, person3] * ``` */ AST#method_declaration#Left static filterNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ========== 查找操作 ========== /** * 查找第一个无效消息 * * @param messages 消息数组 * @returns 第一个无效消息,如果都有效则返回 null * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalid = MessageUtils.findInvalid(people) * if (invalid !== null) { * console.error('Found invalid message:', invalid.validate()) * } * ``` */ AST#ERROR#Left static findInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left found = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right return AST#expression#Left AST#binary_expression#Left AST#expression#Left found AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? found : AST#primary_type#Left null AST#primary_type#Right } AST#ERROR#Right /** * 查找第一个有效消息 * * @param messages 消息数组 * @returns 第一个有效消息,如果都无效则返回 null * * 使用示例: * ```typescript * const people = [invalidPerson1, validPerson, invalidPerson2] * const valid = MessageUtils.findValid(people) * ``` */ AST#ERROR#Left static findValid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left found = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isValid 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right return AST#expression#Left AST#binary_expression#Left AST#expression#Left found AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? found : AST#primary_type#Left null AST#primary_type#Right } AST#ERROR#Right /** * 查找第一个空消息 * * @param messages 消息数组 * @returns 第一个空消息,如果都非空则返回 null * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const empty = MessageUtils.findEmpty(people) * ``` */ AST#ERROR#Left static findEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left found = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . find AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 return AST#expression#Left AST#binary_expression#Left AST#expression#Left found AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? found : AST#primary_type#Left null AST#primary_type#Right } AST#ERROR#Right // ========== 判断操作 ========== /** * 判断所有消息是否都有效 * * @param messages 消息数组 * @returns true 如果所有消息都有效 * * 使用示例: * ```typescript * const people = [person1, person2, person3] * if (MessageUtils.allValid(people)) { * console.log('All messages are valid') * } * ``` */ AST#method_declaration#Left static allValid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . every AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isValid 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#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 /** * 判断是否存在无效消息 * * @param messages 消息数组 * @returns true 如果存在至少一个无效消息 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * if (MessageUtils.hasInvalid(people)) { * console.warn('Found invalid messages') * } * ``` */ AST#method_declaration#Left static hasInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . some AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid 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#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 /** * 判断所有消息是否都为空 * * @param messages 消息数组 * @returns true 如果所有消息都为空 * * 使用示例: * ```typescript * const people = [emptyPerson1, emptyPerson2] * if (MessageUtils.allEmpty(people)) { * console.log('All messages are empty') * } * ``` */ AST#method_declaration#Left static allEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . every AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 判断是否存在非空消息 * * @param messages 消息数组 * @returns true 如果存在至少一个非空消息 * * 使用示例: * ```typescript * const people = [emptyPerson, person1, emptyPerson2] * if (MessageUtils.hasNonEmpty(people)) { * console.log('Found non-empty messages') * } * ``` */ AST#method_declaration#Left static hasNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . some AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ========== 分组操作 ========== // groupBy 和 countBy 被移除,因为 ArkTS 不支持动态索引访问和 Keyof 泛型索引 // ========== 统计操作 ========== /** * 统计有效消息数量 * * @param messages 消息数组 * @returns 有效消息的数量 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const validCount = MessageUtils.countValid(people) * // validCount: 2 * ``` */ AST#method_declaration#Left static countValid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isValid 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#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 统计无效消息数量 * * @param messages 消息数组 * @returns 无效消息的数量 * * 使用示例: * ```typescript * const people = [person1, invalidPerson, person3] * const invalidCount = MessageUtils.countInvalid(people) * // invalidCount: 1 * ``` */ AST#method_declaration#Left static countInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isValid 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#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 统计空消息数量 * * @param messages 消息数组 * @returns 空消息的数量 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const emptyCount = MessageUtils.countEmpty(people) * // emptyCount: 1 * ``` */ AST#method_declaration#Left static countEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left m AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 统计非空消息数量 * * @param messages 消息数组 * @returns 非空消息的数量 * * 使用示例: * ```typescript * const people = [person1, emptyPerson, person3] * const nonEmptyCount = MessageUtils.countNonEmpty(people) * // nonEmptyCount: 2 * ``` */ AST#method_declaration#Left static countNonEmpty AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messages AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left m => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left m AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // ========== 转换操作 ========== // pluck 被移除,因为 ArkTS 不支持动态索引访问 /** * 去重(基于二进制比较) * * @param messages 消息数组 * @returns 去重后的消息数组 * * 使用示例: * ```typescript * const people = [person1, person2, person1Clone, person3] * const uniquePeople = MessageUtils.unique(people) * // uniquePeople: [person1, person2, person3] * ``` */ AST#method_declaration#Left static unique AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left seen = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Set AST#expression#Right AST#new_expression#Right AST#expression#Right 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#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 result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( const msg of AST#expression#Left messages AST#expression#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 binary = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left msg AST#expression#Right . toBinary AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left key = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left MessageUtils AST#expression#Right . binaryToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left binary 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 seen 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 seen AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#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 result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#block_statement#Right AST#if_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 result AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#block_statement#Right AST#catch_clause#Right AST#try_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 result AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 辅助方法:将 Uint8Array 转换为字符串(用于 Set 比较) */ AST#method_declaration#Left private static binaryToString AST#parameter_list#Left ( AST#parameter#Left binary : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 binary AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left result += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left String AST#expression#Right . fromCharCode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left binary AST#expression#Right [ AST#expression#Left i AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left result AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class MessageUtils { static toBinaryBatch<T extends Message>(messages: T[]): Uint8Array[] { return messages.map(m => m.toBinary()) } static toJsonBatch<T extends Message>(messages: T[]): Record<string, Object>[] { return messages.map(m => m.toJson()) } static cloneBatch<T extends Message>(messages: T[]): T[] { return messages.map(m => m.clone() as T) } static mergeAll<T extends Message>(messages: T[]): T | null { if (messages.length === 0) { return null } const result = messages[0].clone() as T for (let i = 1; i < messages.length; i++) { result.mergeFrom(messages[i]) } return result } static filterValid<T extends Message>(messages: T[]): T[] { return messages.filter(m => m.isValid()) } static filterInvalid<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isValid()) } static filterNonEmpty<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isEmpty()) } static findInvalid<T extends Message>(messages: T[]): T | null { const found = messages.find(m => !m.isValid()) return found !== undefined ? found : null } static findValid<T extends Message>(messages: T[]): T | null { const found = messages.find(m => m.isValid()) return found !== undefined ? found : null } static findEmpty<T extends Message>(messages: T[]): T | null { const found = messages.find(m => m.isEmpty()) return found !== undefined ? found : null } static allValid<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isValid()) } static hasInvalid<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isValid()) } static allEmpty<T extends Message>(messages: T[]): boolean { return messages.every(m => m.isEmpty()) } static hasNonEmpty<T extends Message>(messages: T[]): boolean { return messages.some(m => !m.isEmpty()) } static countValid<T extends Message>(messages: T[]): number { return messages.filter(m => m.isValid()).length } static countInvalid<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isValid()).length } static countEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => m.isEmpty()).length } static countNonEmpty<T extends Message>(messages: T[]): number { return messages.filter(m => !m.isEmpty()).length } static unique<T extends Message>(messages: T[]): T[] { const seen = new Set<string>() const result: T[] = [] for (const msg of messages) { try { const binary = msg.toBinary(true) const key = MessageUtils.binaryToString(binary) if (!seen.has(key)) { seen.add(key) result.push(msg) } } catch (e) { result.push(msg) } } return result } private static binaryToString(binary: Uint8Array): string { let result = '' for (let i = 0; i < binary.length; i++) { result += String.fromCharCode(binary[i]) } return result } }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L26-L418
459ebfc6d8b72fd504e8197df44683c426873909
github
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/modalwindow/src/main/ets/model/OtherWaysToLogin.ets
arkts
OtherWaysToLogin
其他账号登录:主要提供短信验证码登录方式,以及其他三方应用登录方式
@Component export struct OtherWaysToLogin { // 发送验证码按钮的颜色 @State buttonColor: ResourceColor = Color.Grey; // 发送验证码按钮的内容 @State buttonContent: ResourceStr = $r('app.string.modalwindow_verify'); // 手机号是否可用 phoneNumberAvailable: boolean = false; // 可发送验证码的倒计时秒数 countdownSeconds: number = 0; // 是否勾选阅读并同意服务协议及个人信息处理规则 isAgree: boolean = false; loginIcons: Resource[] = [$r('app.media.app_logo1'), $r('app.media.app_logo2'), $r('app.media.app_logo3')] build() { Column({ space: SPACE_TWENTY }) { Column({ space: SPACE_TEN }) { Row({ space: SPACE_TEN }) { Image($r('app.media.phone')).width($r('app.integer.modalwindow_user_image_height')) .borderRadius($r('app.integer.modalwindow_border_radius_mid')) Text($r('app.string.modalwindow_phone_login')).fontSize($r('app.integer.modalwindow_font_size_mid')) } .width($r('app.string.modalwindow_size_full')) Text($r('app.string.modalwindow_new')) .width($r('app.string.modalwindow_size_full')) } .width($r('app.string.modalwindow_size_full')) .alignItems(HorizontalAlign.Start) Row() { Text($r('app.string.modalwindow_86')) Image($r('app.media.arrow_right')) .size({ width: $r('app.integer.modalwindow_arrow_right_height'), height: $r('app.integer.modalwindow_arrow_right_height') }) .margin($r('app.integer.modalwindow_margin_default')) TextInput({ placeholder: $r('app.string.modalwindow_input_phone_number') }) .inputFilter('[0-9]')// 正则表达式,输入的是数字0-9则允许显示,不是则被过滤 .backgroundColor(Color.Transparent) .caretColor(Color.Grey) .width($r('app.string.modalwindow_size_full')) .maxLength(PHONE_NUMBER_LENGTH)// 设置最大输入字符数 // 当输入字符数为11位时,发送验证码按钮变为蓝色,否则置灰 .onChange((value: string) => { if (value.length === PHONE_NUMBER_LENGTH) { this.phoneNumberAvailable = true; this.buttonColor = Color.Blue; } else { this.phoneNumberAvailable = false; this.buttonColor = Color.Grey; } }) } Button(this.buttonContent) .type(ButtonType.Normal) .border({ radius: $r('app.integer.modalwindow_border_radius') }) .width($r('app.string.modalwindow_size_full')) .backgroundColor(this.buttonColor) .id('send_button_id') .onClick(() => { if (this.countdownSeconds > 0) { // 处于可再次发送的读秒倒计时状态下,点击按钮不响应 return; } // 输入输入字符数为11位,并同意服务协议及个人信息处理规则,才能发送验证码 if (!this.phoneNumberAvailable) { promptAction.showToast({ message: $r('app.string.modalwindow_message_right_phone_number') }); } else if (!this.isAgree) { promptAction.showToast({ message: $r('app.string.modalwindow_message_read_agreement') }); } else { // 点击发送短信验证码按钮后,按钮置灰,开始读秒倒计时,按钮内容改变 promptAction.showToast({ message: $r('app.string.modalwindow_message_verify_code_send') }); this.buttonColor = Color.Grey; this.countdownSeconds = COUNTDOWN_SECONDS; const timerId = setInterval(() => { this.countdownSeconds--; if (this.countdownSeconds <= 0) { // 计时结束,根据手机号位数是否正确,重置按钮状态 this.buttonContent = $r('app.string.modalwindow_verify'); clearInterval(timerId); this.buttonColor = this.phoneNumberAvailable ? Color.Blue : Color.Grey; return; } this.buttonContent = this.countdownSeconds + SEND_AGAIN_IN_SECONDS; }, 1000) } }) Row() { Checkbox({ name: 'agreement' })// $$运算符为系统内置组件提供TS变量的引用,使得TS变量和系统内置组件的内部状态保持同步 .id('other_agreement') .select($$this.isAgree) ReadAgreement() } .width($r('app.string.modalwindow_size_full')) .justifyContent(FlexAlign.Start) Blank() // 在容器主轴方向上自动填充容器空余部分 // // 其他三方应用登录方式 // List({ space: SPACE_TWENTY }) { // // 性能知识点:此处在List中排列组件,列表项确定、数量较少,且需要一次性加载,因此使用ForEach。在列表项多的情况下,推荐使用LazyForEach // ForEach(this.loginIcons, (item: Resource) => { // ListItem() { // Image(item) // .width($r('app.integer.modalwindow_other_ways_icon_height')) // .borderRadius($r('app.integer.modalwindow_other_ways_border_radius')) // .onClick(() => { // // 调用Toast显示三方应用授权登录提示 // promptAction.showToast({ message: $r('app.string.modalwindow_message_third_party_authorization') }); // }) // } // }) // } // .listDirection(Axis.Horizontal) } .width($r('app.string.modalwindow_size_full')) .height($r('app.string.modalwindow_size_full')) .backgroundColor(Color.White) .padding({ bottom: $r('app.integer.modalwindow_padding_mid'), top: $r('app.integer.modalwindow_padding_to_top') }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct OtherWaysToLogin AST#component_body#Left { // 发送验证码按钮的颜色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonColor : 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 . Grey AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 发送验证码按钮的内容 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right buttonContent : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_verify' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right // 手机号是否可用 AST#property_declaration#Left phoneNumberAvailable : 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 countdownSeconds : 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 isAgree : 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 loginIcons : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_logo1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_logo2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_logo3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left SPACE_TWENTY AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left SPACE_TEN AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left SPACE_TEN 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.media.phone' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_user_image_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_border_radius_mid' 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#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.modalwindow_phone_login' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_font_size_mid' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_new' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_86' AST#expression#Right ) AST#resource_expression#Right AST#expression#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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.arrow_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_arrow_right_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_arrow_right_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_margin_default' 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_input_phone_number' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . inputFilter ( AST#expression#Left '[0-9]' AST#expression#Right ) // 正则表达式,输入的是数字0-9则允许显示,不是则被过滤 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . caretColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLength ( AST#expression#Left PHONE_NUMBER_LENGTH AST#expression#Right ) // 设置最大输入字符数 // 当输入字符数为11位时,发送验证码按钮变为蓝色,否则置灰 AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left PHONE_NUMBER_LENGTH 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 . phoneNumberAvailable AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue 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 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 . phoneNumberAvailable AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonContent AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_border_radius' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'send_button_id' AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdownSeconds 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 // 输入输入字符数为11位,并同意服务协议及个人信息处理规则,才能发送验证码 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 . phoneNumberAvailable 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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_message_right_phone_number' AST#expression#Right ) AST#resource_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 else 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 . isAgree 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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_message_read_agreement' AST#expression#Right ) AST#resource_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 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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_message_verify_code_send' AST#expression#Right ) AST#resource_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey 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 . countdownSeconds AST#member_expression#Right = AST#expression#Left COUNTDOWN_SECONDS AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timerId = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdownSeconds AST#member_expression#Right AST#expression#Right -- AST#update_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 . countdownSeconds 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buttonContent AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_verify' AST#expression#Right ) AST#resource_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 clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left timerId 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 . buttonColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . phoneNumberAvailable AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Grey 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#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 . buttonContent AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . countdownSeconds AST#member_expression#Right AST#expression#Right + AST#expression#Left SEND_AGAIN_IN_SECONDS 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#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 1000 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right } AST#block_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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Checkbox ( AST#component_parameters#Left { AST#component_parameter#Left name : AST#expression#Left 'agreement' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right // $$运算符为系统内置组件提供TS变量的引用,使得TS变量和系统内置组件的内部状态保持同步 AST#modifier_chain_expression#Left . id ( AST#expression#Left 'other_agreement' AST#expression#Right ) AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . isAgree AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ReadAgreement ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.modalwindow_size_full' 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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 在容器主轴方向上自动填充容器空余部分 // // 其他三方应用登录方式 // List({ space: SPACE_TWENTY }) { // // 性能知识点:此处在List中排列组件,列表项确定、数量较少,且需要一次性加载,因此使用ForEach。在列表项多的情况下,推荐使用LazyForEach // ForEach(this.loginIcons, (item: Resource) => { // ListItem() { // Image(item) // .width($r('app.integer.modalwindow_other_ways_icon_height')) // .borderRadius($r('app.integer.modalwindow_other_ways_border_radius')) // .onClick(() => { // // 调用Toast显示三方应用授权登录提示 // promptAction.showToast({ message: $r('app.string.modalwindow_message_third_party_authorization') }); // }) // } // }) // } // .listDirection(Axis.Horizontal) } 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.modalwindow_size_full' 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.modalwindow_size_full' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_padding_mid' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.modalwindow_padding_to_top' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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 OtherWaysToLogin { @State buttonColor: ResourceColor = Color.Grey; @State buttonContent: ResourceStr = $r('app.string.modalwindow_verify'); phoneNumberAvailable: boolean = false; countdownSeconds: number = 0; isAgree: boolean = false; loginIcons: Resource[] = [$r('app.media.app_logo1'), $r('app.media.app_logo2'), $r('app.media.app_logo3')] build() { Column({ space: SPACE_TWENTY }) { Column({ space: SPACE_TEN }) { Row({ space: SPACE_TEN }) { Image($r('app.media.phone')).width($r('app.integer.modalwindow_user_image_height')) .borderRadius($r('app.integer.modalwindow_border_radius_mid')) Text($r('app.string.modalwindow_phone_login')).fontSize($r('app.integer.modalwindow_font_size_mid')) } .width($r('app.string.modalwindow_size_full')) Text($r('app.string.modalwindow_new')) .width($r('app.string.modalwindow_size_full')) } .width($r('app.string.modalwindow_size_full')) .alignItems(HorizontalAlign.Start) Row() { Text($r('app.string.modalwindow_86')) Image($r('app.media.arrow_right')) .size({ width: $r('app.integer.modalwindow_arrow_right_height'), height: $r('app.integer.modalwindow_arrow_right_height') }) .margin($r('app.integer.modalwindow_margin_default')) TextInput({ placeholder: $r('app.string.modalwindow_input_phone_number') }) .inputFilter('[0-9]') .backgroundColor(Color.Transparent) .caretColor(Color.Grey) .width($r('app.string.modalwindow_size_full')) .maxLength(PHONE_NUMBER_LENGTH) .onChange((value: string) => { if (value.length === PHONE_NUMBER_LENGTH) { this.phoneNumberAvailable = true; this.buttonColor = Color.Blue; } else { this.phoneNumberAvailable = false; this.buttonColor = Color.Grey; } }) } Button(this.buttonContent) .type(ButtonType.Normal) .border({ radius: $r('app.integer.modalwindow_border_radius') }) .width($r('app.string.modalwindow_size_full')) .backgroundColor(this.buttonColor) .id('send_button_id') .onClick(() => { if (this.countdownSeconds > 0) { return; } if (!this.phoneNumberAvailable) { promptAction.showToast({ message: $r('app.string.modalwindow_message_right_phone_number') }); } else if (!this.isAgree) { promptAction.showToast({ message: $r('app.string.modalwindow_message_read_agreement') }); } else { promptAction.showToast({ message: $r('app.string.modalwindow_message_verify_code_send') }); this.buttonColor = Color.Grey; this.countdownSeconds = COUNTDOWN_SECONDS; const timerId = setInterval(() => { this.countdownSeconds--; if (this.countdownSeconds <= 0) { this.buttonContent = $r('app.string.modalwindow_verify'); clearInterval(timerId); this.buttonColor = this.phoneNumberAvailable ? Color.Blue : Color.Grey; return; } this.buttonContent = this.countdownSeconds + SEND_AGAIN_IN_SECONDS; }, 1000) } }) Row() { Checkbox({ name: 'agreement' }) .id('other_agreement') .select($$this.isAgree) ReadAgreement() } .width($r('app.string.modalwindow_size_full')) .justifyContent(FlexAlign.Start) Blank() } .width($r('app.string.modalwindow_size_full')) .height($r('app.string.modalwindow_size_full')) .backgroundColor(Color.White) .padding({ bottom: $r('app.integer.modalwindow_padding_mid'), top: $r('app.integer.modalwindow_padding_to_top') }) } }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/modalwindow/src/main/ets/model/OtherWaysToLogin.ets#L27-L150
bf15702d78bf924e00b9bfee68cfefb200553343
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Unlink (delete) a file. @param file_name A string, the path of the file.
export function sandbox_unlink(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlink(full_file_directory).catch((err: BusinessError) => { console.error(`[sandbox_unlink] Caught error: ${err.code}, ${err.name}, ${err.message}`); }); } catch (e) { console.error('[storage_tools][sandbox_unlink] [' + file_name + ']' + e); return false; } return true; }
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_unlink AST#parameter_list#Left ( AST#parameter#Left file_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDir ? : 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 filesDir : 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 AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left context_filesDir AST#expression#Right || AST#expression#Left meowContext AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir 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 full_file_directory = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left filesDir AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left file_name 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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . unlink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left full_file_directory 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#template_literal#Left ` [sandbox_unlink] Caught error: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . name AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left 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#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 . error AST#member_expression#Right AST#expression#Right AST#argument_list#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 '[storage_tools][sandbox_unlink] [' AST#expression#Right + AST#expression#Left file_name AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ']' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 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#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#function_declaration#Right AST#export_declaration#Right
export function sandbox_unlink(file_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; let full_file_directory = filesDir + '/' + file_name; try { fs.unlink(full_file_directory).catch((err: BusinessError) => { console.error(`[sandbox_unlink] Caught error: ${err.code}, ${err.name}, ${err.message}`); }); } catch (e) { console.error('[storage_tools][sandbox_unlink] [' + file_name + ']' + e); return false; } return true; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L340-L352
872082ad3ff2b04b44245654780d37a1ff602ed5
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/FoldersList.ets
arkts
pageTransition
页面跳转动画。
public pageTransition(): void { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); }
AST#method_declaration#Left public pageTransition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionEnter ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left RouteType AST#expression#Right . None AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left duration : AST#expression#Left 400 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Left AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PageTransitionExit ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left RouteType AST#expression#Right . None AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left duration : AST#expression#Left 400 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . slide ( AST#expression#Left AST#member_expression#Left AST#expression#Left SlideEffect AST#expression#Right . Left AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
public pageTransition(): void { PageTransitionEnter({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); PageTransitionExit({ type: RouteType.None, duration: 400 }) .slide(SlideEffect.Left); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/FoldersList.ets#L121-L126
891e9325eeb6f29e58720b332fdf5422df11cab6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets
arkts
modifyAllData
改变数组数据 @param data:新数组
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
AST#method_declaration#Left public modifyAllData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WaterFlowModule [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#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 . dataArray AST#member_expression#Right = AST#expression#Left data 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 this AST#expression#Right . notifyDataReload 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
public modifyAllData(data: WaterFlowModule[]): void { this.dataArray = data; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragtoswitchpictures/src/main/ets/components/datasource/DragToSwitchPicturesDataSource.ets#L262-L265
3e44965ad3b7f37fd21c229b2ef00b34158ea326
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/model/Constants.ets
arkts
通用常量
export default class Constants { // 扩展后标题继续下拉阈值 public static readonly CONTINUE_PULL_THRESHOLD: number = 90; // 图标下拉的最大距离 public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; // 标题下拉的最大距离 public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; // 标题缩放的最大值 public static readonly TITLE_SCALE_MAX_VALUE: number = 1.2; // 标题缩放的默认值 public static readonly TITLE_SCALE_DEFAULT_VALUE: number = 1; // 设置笔记图片宽高比 public static readonly ANIMATE_DURATION_DRAG: number = 120; // 设置笔记图片宽高比 public static readonly ANIMATE_DURATION_BACK: number = 300; // 设置搜索框与各笔记布局间隔 public static readonly SEARCH_MEMO_SPACE: number = 12; // 初始坐标位置 public static readonly INIT_COORDINATE: number = 0; // 设置下拉时时的平移效果的距离 public static readonly TRANSLATE_Y: number = -50; // 设置最大text组件显示行数 public static readonly MAX_TEXT_LINES: number = 1; // 设置各笔记布局间隔 public static readonly MEMO_COL_SPACE: number = 5; // 设置笔记图片宽高比 public static readonly MEMO_IMAGE_ASPECT_RATIO: number = 1; // 标题常规高度 public static readonly NORMAL_TITLE_HEIGHT: number = 80; // 标题扩展高度 public static readonly EXPAND_TITLE_HEIGHT: number = 100; // 100% public static readonly ONE_HUNDRED_PERCENT: string = "100%"; // 标题padding public static readonly TITLE_LAYOUT_PADDING: number = 25; // 标题内容 public static readonly MEMO_TITLE: string = "All notes"; // 子标题内容 public static readonly MEMO_SUB_TITLE: string = "8 notes"; // 标题字体大小 public static readonly TITLE_FONT_SIZE: number = 25; // 子标题字体大小 public static readonly SUB_TITLE_FONT_SIZE: number = 16; // 标题背景色 public static readonly BACKGROUND_COLOR: string = "0xeaf0ef"; // 动效时长 public static readonly ANIMATION_DURATION: number = 120; }
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 扩展后标题继续下拉阈值 AST#property_declaration#Left public static readonly CONTINUE_PULL_THRESHOLD : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 90 AST#expression#Right ; AST#property_declaration#Right // 图标下拉的最大距离 AST#property_declaration#Left public static readonly MENU_DOWN_Y_MAX_VALUE : 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 public static readonly TITLE_DOWN_Y_MAX_VALUE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right // 标题缩放的最大值 AST#property_declaration#Left public static readonly TITLE_SCALE_MAX_VALUE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.2 AST#expression#Right ; AST#property_declaration#Right // 标题缩放的默认值 AST#property_declaration#Left public static readonly TITLE_SCALE_DEFAULT_VALUE : 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 public static readonly ANIMATE_DURATION_DRAG : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#expression#Right ; AST#property_declaration#Right // 设置笔记图片宽高比 AST#property_declaration#Left public static readonly ANIMATE_DURATION_BACK : 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 // 设置搜索框与各笔记布局间隔 AST#property_declaration#Left public static readonly SEARCH_MEMO_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 // 初始坐标位置 AST#property_declaration#Left public static readonly INIT_COORDINATE : 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 public static readonly TRANSLATE_Y : 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 50 AST#expression#Right AST#unary_expression#Right AST#expression#Right ; AST#property_declaration#Right // 设置最大text组件显示行数 AST#property_declaration#Left public static readonly MAX_TEXT_LINES : 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 public static readonly MEMO_COL_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_declaration#Right // 设置笔记图片宽高比 AST#property_declaration#Left public static readonly MEMO_IMAGE_ASPECT_RATIO : 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 public static readonly NORMAL_TITLE_HEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#Right ; AST#property_declaration#Right // 标题扩展高度 AST#property_declaration#Left public static readonly EXPAND_TITLE_HEIGHT : 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 // 100% AST#property_declaration#Left public static readonly ONE_HUNDRED_PERCENT : 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 // 标题padding AST#property_declaration#Left public static readonly TITLE_LAYOUT_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right ; AST#property_declaration#Right // 标题内容 AST#property_declaration#Left public static readonly MEMO_TITLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "All notes" AST#expression#Right ; AST#property_declaration#Right // 子标题内容 AST#property_declaration#Left public static readonly MEMO_SUB_TITLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "8 notes" AST#expression#Right ; AST#property_declaration#Right // 标题字体大小 AST#property_declaration#Left public static readonly TITLE_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 25 AST#expression#Right ; AST#property_declaration#Right // 子标题字体大小 AST#property_declaration#Left public static readonly SUB_TITLE_FONT_SIZE : 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 public static readonly BACKGROUND_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "0xeaf0ef" AST#expression#Right ; AST#property_declaration#Right // 动效时长 AST#property_declaration#Left public static readonly ANIMATION_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class Constants { public static readonly CONTINUE_PULL_THRESHOLD: number = 90; public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; public static readonly TITLE_SCALE_MAX_VALUE: number = 1.2; public static readonly TITLE_SCALE_DEFAULT_VALUE: number = 1; public static readonly ANIMATE_DURATION_DRAG: number = 120; public static readonly ANIMATE_DURATION_BACK: number = 300; public static readonly SEARCH_MEMO_SPACE: number = 12; public static readonly INIT_COORDINATE: number = 0; public static readonly TRANSLATE_Y: number = -50; public static readonly MAX_TEXT_LINES: number = 1; public static readonly MEMO_COL_SPACE: number = 5; public static readonly MEMO_IMAGE_ASPECT_RATIO: number = 1; public static readonly NORMAL_TITLE_HEIGHT: number = 80; public static readonly EXPAND_TITLE_HEIGHT: number = 100; public static readonly ONE_HUNDRED_PERCENT: string = "100%"; public static readonly TITLE_LAYOUT_PADDING: number = 25; public static readonly MEMO_TITLE: string = "All notes"; public static readonly MEMO_SUB_TITLE: string = "8 notes"; public static readonly TITLE_FONT_SIZE: number = 25; public static readonly SUB_TITLE_FONT_SIZE: number = 16; public static readonly BACKGROUND_COLOR: string = "0xeaf0ef"; public static readonly ANIMATION_DURATION: number = 120; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/model/Constants.ets#L19-L66
656cc838a6dedbd5f13581180dd813767d323a8e
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/Index.ets
arkts
DeleteButton
删除按钮
@Builder DeleteButton(entry: CommandEntryViewModel) { Row() { Button() { Image($r("app.media.trash")) .objectFit(ImageFit.Cover) .width(StyleConstants.SIXTY_PERCENT) .height(StyleConstants.SIXTY_PERCENT) } .backgroundColor($r("app.color.delete_button_color")) .type(ButtonType.Circle) .width(StyleConstants.INDEX_SWIPE_BUTTON_SIZE) .height(StyleConstants.INDEX_SWIPE_BUTTON_SIZE) .onClick(() => { this.listViewModel.deleteCommandEntry(entry.toCommandEntry()); }) } .margin({ left: StyleConstants.THREE_PERCENT }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteButton AST#parameter_list#Left ( AST#parameter#Left entry : AST#type_annotation#Left AST#primary_type#Left CommandEntryViewModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 "app.media.trash" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . SIXTY_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . SIXTY_PERCENT 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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.delete_button_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . INDEX_SWIPE_BUTTON_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . INDEX_SWIPE_BUTTON_SIZE 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listViewModel AST#member_expression#Right AST#expression#Right . deleteCommandEntry 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 entry AST#expression#Right . toCommandEntry 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . THREE_PERCENT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder DeleteButton(entry: CommandEntryViewModel) { Row() { Button() { Image($r("app.media.trash")) .objectFit(ImageFit.Cover) .width(StyleConstants.SIXTY_PERCENT) .height(StyleConstants.SIXTY_PERCENT) } .backgroundColor($r("app.color.delete_button_color")) .type(ButtonType.Circle) .width(StyleConstants.INDEX_SWIPE_BUTTON_SIZE) .height(StyleConstants.INDEX_SWIPE_BUTTON_SIZE) .onClick(() => { this.listViewModel.deleteCommandEntry(entry.toCommandEntry()); }) } .margin({ left: StyleConstants.THREE_PERCENT }) }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/Index.ets#L222-L242
8cdf07773bfdbb272423dd106814b0e488b214f6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets
arkts
LimitedHeightBottomDialogComponent
功能描述: 本示例介绍了如何实现一个限制高度的底部弹窗,以购物应用的“我的”页面来呈现。当给一个底部弹窗的可滚动区域设置最大高度后, 如果弹窗内部视图的高度超过了这个最大高度,弹窗可滚动区域的高度就是这个最大高度,视图内容不会展示完全,需要滚动查看; 如果弹窗内部视图的高度没有超过这个最大高度,弹窗可滚动区域高度就是视图的高度,视图内容展示完全。 推荐场景: 需要出现底部弹窗 核心组件: LimitedHeightBottomDialog 实现步骤: 1. 创建一个限制高度的底部弹窗,这个弹窗内部视图和可滚动区域的最大高度可以通过外部传入。 2. 创建常用设置底部弹窗的视图和安全设置底部弹窗的视图。 3. 创建常用设置底部弹窗的CustomDialogController和创建安全设置底部弹窗的CustomDialogController,传入需要的参数。 4. 调用常用设置底部弹窗的CustomDialogController或安全设置底部弹窗的CustomDialogController的open方法,让弹窗展示出来。
@Component export struct LimitedHeightBottomDialogComponent { popPage: (() => void) | undefined = undefined; private firstSectionActionItems: ActionItem[] = [{ id: '0', title: $r('app.string.limited_height_bottom_dialog_my_order'), subTitle: '' }, { id: '1', title: $r('app.string.limited_height_bottom_dialog_my_collect'), subTitle: '' }, { id: '2', title: $r('app.string.limited_height_bottom_dialog_footprint'), subTitle: '' }, { id: '3', title: $r('app.string.limited_height_bottom_dialog_coupon'), subTitle: '' }] private secondSectionActionItems: ActionItem[] = [{ id: '4', title: $r('app.string.limited_height_bottom_dialog_common_setting'), subTitle: $r('app.string.limited_height_bottom_dialog_see_reached_the_limit_height_bottom_dialog') }, { id: '5', title: $r('app.string.limited_height_bottom_dialog_security_setting'), subTitle: $r('app.string.limited_height_bottom_dialog_see_not_reached_the_limit_height_bottom_dialog') }, { id: '6', title: $r('app.string.limited_height_bottom_dialog_feedback'), subTitle: '' }, { id: '7', title: $r('app.string.limited_height_bottom_dialog_about'), subTitle: '' }] // 常用设置底部弹窗是否显示标记,与LimitedHeightBottomDialog中的showFlag双向绑定,用于底部弹窗出现与消失时的动效处理 @State commonSettingDialogShowFlag: Visibility = Visibility.Visible; // 安全设置底部弹窗是否显示标记,与LimitedHeightBottomDialog中的showFlag双向绑定,用于底部弹窗出现与消失时的动效处理 @State securitySettingDialogShowFlag: Visibility = Visibility.Visible; // 常用设置底部弹窗的CustomDialogController commonSettingDialogController: CustomDialogController = new CustomDialogController({ builder: LimitedHeightBottomDialog({ title: $r('app.string.limited_height_bottom_dialog_common_setting'), maxScrollHeight: DIALOG_MAX_SCROLL_HEIGHT, wrapBuilder: wrapBuilder(createCommonSettingView), showFlag: this.commonSettingDialogShowFlag }), alignment: DialogAlignment.Bottom, width: $r('app.string.limited_height_bottom_dialog_full_width'), customStyle: true, // customStyle需要设置为true,否则底部弹窗出现的动效会有问题 autoCancel: true, onWillDismiss: () => { // 修改点击弹窗外部区域和返回操作时弹窗消失的方式,这里的处理会有一个动效。不加这个处理方式的话,弹窗会以默认的方式消失 this.commonSettingDialogShowFlag = Visibility.Hidden; } }); // 安全设置底部弹窗的CustomDialogController securitySettingDialogController: CustomDialogController = new CustomDialogController({ builder: LimitedHeightBottomDialog({ title: $r('app.string.limited_height_bottom_dialog_security_setting'), maxScrollHeight: DIALOG_MAX_SCROLL_HEIGHT, wrapBuilder: wrapBuilder(createSecuritySettingView), showFlag: this.securitySettingDialogShowFlag }), alignment: DialogAlignment.Bottom, width: $r('app.string.limited_height_bottom_dialog_full_width'), customStyle: true, autoCancel: true, onWillDismiss: () => { this.securitySettingDialogShowFlag = Visibility.Hidden; } }); // 操作项点击处理 private onClickItem = (id: string) => { switch (id) { case '4': // 这里需要将commonSettingDialogShowFlag设置为Visibility.Visible,否则可能无法显示弹窗, // 因为在弹窗关闭的时候将commonSettingDialogShowFlag设置为了Visibility.Hidden this.commonSettingDialogShowFlag = Visibility.Visible; // 弹出常用设置底部弹窗 this.commonSettingDialogController.open(); break; case '5': // 这里需要将securitySettingDialogShowFlag设置为Visibility.Visible,否则可能无法显示弹窗, // 因为在弹窗关闭的时候将securitySettingDialogShowFlag设置为了Visibility.Hidden this.securitySettingDialogShowFlag = Visibility.Visible; // 弹出安全设置底部弹窗 this.securitySettingDialogController.open(); break; default: promptAction.showToast({ message: $r('app.string.limited_height_bottom_dialog_toast_tips') }); break; } };
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LimitedHeightBottomDialogComponent AST#component_body#Left { AST#property_declaration#Left popPage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( 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#parenthesized_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private firstSectionActionItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '0' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_my_order' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '1' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_my_collect' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' 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 '2' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_footprint' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' 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 '3' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_coupon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private secondSectionActionItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ActionItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '4' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_common_setting' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_see_reached_the_limit_height_bottom_dialog' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '5' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_security_setting' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_see_not_reached_the_limit_height_bottom_dialog' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left '6' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_feedback' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' 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 '7' AST#expression#Right AST#property_assignment#Right , 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.limited_height_bottom_dialog_about' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left subTitle AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right // 常用设置底部弹窗是否显示标记,与LimitedHeightBottomDialog中的showFlag双向绑定,用于底部弹窗出现与消失时的动效处理 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right commonSettingDialogShowFlag : AST#type_annotation#Left AST#primary_type#Left Visibility AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 安全设置底部弹窗是否显示标记,与LimitedHeightBottomDialog中的showFlag双向绑定,用于底部弹窗出现与消失时的动效处理 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right securitySettingDialogShowFlag : AST#type_annotation#Left AST#primary_type#Left Visibility AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 常用设置底部弹窗的CustomDialogController AST#property_declaration#Left commonSettingDialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController 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 CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left LimitedHeightBottomDialog AST#expression#Right AST#argument_list#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.limited_height_bottom_dialog_common_setting' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxScrollHeight AST#property_name#Right : AST#expression#Left DIALOG_MAX_SCROLL_HEIGHT AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wrapBuilder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left createCommonSettingView 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 showFlag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commonSettingDialogShowFlag 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customStyle AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , // customStyle需要设置为true,否则底部弹窗出现的动效会有问题 AST#property_assignment#Left AST#property_name#Left autoCancel 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 onWillDismiss AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 修改点击弹窗外部区域和返回操作时弹窗消失的方式,这里的处理会有一个动效。不加这个处理方式的话,弹窗会以默认的方式消失 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commonSettingDialogShowFlag AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Hidden 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 安全设置底部弹窗的CustomDialogController AST#property_declaration#Left securitySettingDialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController 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 CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left LimitedHeightBottomDialog AST#expression#Right AST#argument_list#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.limited_height_bottom_dialog_security_setting' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxScrollHeight AST#property_name#Right : AST#expression#Left DIALOG_MAX_SCROLL_HEIGHT AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wrapBuilder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left createSecuritySettingView 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 showFlag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . securitySettingDialogShowFlag 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.limited_height_bottom_dialog_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customStyle 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 autoCancel 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 onWillDismiss AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . securitySettingDialogShowFlag AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Hidden 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 操作项点击处理 AST#property_declaration#Left private onClickItem AST#ERROR#Left = AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => { AST#property_name#Left switch AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left id AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { 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 '4' AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : // 这里需要将commonSettingDialogShowFlag设置为Visibility.Visible,否则可能无法显示弹窗, // 因为在弹窗关闭的时候将commonSettingDialogShowFlag设置为了Visibility.Hidden AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . commonSettingDialogShowFlag AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 弹出常用设置底部弹窗 AST#method_declaration#Left this AST#ERROR#Left . commonSett in gDialogController . open AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left case AST#ERROR#Left '5' AST#ERROR#Right : // 这里需要将securitySettingDialogShowFlag设置为Visibility.Visible,否则可能无法显示弹窗, // 因为在弹窗关闭的时候将securitySettingDialogShowFlag设置为了Visibility.Hidden AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . securitySettingDialogShowFlag AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 弹出安全设置底部弹窗 AST#method_declaration#Left this AST#ERROR#Left . securitySett in gDialogController . open AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right AST#property_declaration#Left default AST#ERROR#Left : AST#ERROR#Left AST#qualified_type#Left promptAction . showToast AST#qualified_type#Right ( { message : $r AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'app.string.limited_height_bottom_dialog_toast_tips' AST#ERROR#Right ) AST#parameter_list#Right } ) AST#ERROR#Right ; AST#property_declaration#Right AST#property_declaration#Left break ; AST#property_declaration#Right } AST#component_body#Right AST#ERROR#Left } AST#ERROR#Right ; AST#decorated_export_declaration#Right
@Component export struct LimitedHeightBottomDialogComponent { popPage: (() => void) | undefined = undefined; private firstSectionActionItems: ActionItem[] = [{ id: '0', title: $r('app.string.limited_height_bottom_dialog_my_order'), subTitle: '' }, { id: '1', title: $r('app.string.limited_height_bottom_dialog_my_collect'), subTitle: '' }, { id: '2', title: $r('app.string.limited_height_bottom_dialog_footprint'), subTitle: '' }, { id: '3', title: $r('app.string.limited_height_bottom_dialog_coupon'), subTitle: '' }] private secondSectionActionItems: ActionItem[] = [{ id: '4', title: $r('app.string.limited_height_bottom_dialog_common_setting'), subTitle: $r('app.string.limited_height_bottom_dialog_see_reached_the_limit_height_bottom_dialog') }, { id: '5', title: $r('app.string.limited_height_bottom_dialog_security_setting'), subTitle: $r('app.string.limited_height_bottom_dialog_see_not_reached_the_limit_height_bottom_dialog') }, { id: '6', title: $r('app.string.limited_height_bottom_dialog_feedback'), subTitle: '' }, { id: '7', title: $r('app.string.limited_height_bottom_dialog_about'), subTitle: '' }] @State commonSettingDialogShowFlag: Visibility = Visibility.Visible; @State securitySettingDialogShowFlag: Visibility = Visibility.Visible; commonSettingDialogController: CustomDialogController = new CustomDialogController({ builder: LimitedHeightBottomDialog({ title: $r('app.string.limited_height_bottom_dialog_common_setting'), maxScrollHeight: DIALOG_MAX_SCROLL_HEIGHT, wrapBuilder: wrapBuilder(createCommonSettingView), showFlag: this.commonSettingDialogShowFlag }), alignment: DialogAlignment.Bottom, width: $r('app.string.limited_height_bottom_dialog_full_width'), customStyle: true, autoCancel: true, onWillDismiss: () => { this.commonSettingDialogShowFlag = Visibility.Hidden; } }); securitySettingDialogController: CustomDialogController = new CustomDialogController({ builder: LimitedHeightBottomDialog({ title: $r('app.string.limited_height_bottom_dialog_security_setting'), maxScrollHeight: DIALOG_MAX_SCROLL_HEIGHT, wrapBuilder: wrapBuilder(createSecuritySettingView), showFlag: this.securitySettingDialogShowFlag }), alignment: DialogAlignment.Bottom, width: $r('app.string.limited_height_bottom_dialog_full_width'), customStyle: true, autoCancel: true, onWillDismiss: () => { this.securitySettingDialogShowFlag = Visibility.Hidden; } }); private onClickItem = (id: string) => { switch (id) { case '4': this.commonSettingDialogShowFlag = Visibility.Visible; this.commonSettingDialogController.open(); break; case '5': this.securitySettingDialogShowFlag = Visibility.Visible; this.securitySettingDialogController.open(); break; default: promptAction.showToast({ message: $r('app.string.limited_height_bottom_dialog_toast_tips') }); break; } };
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/view/LimitedHeightBottomDialogComponent.ets#L57-L138
b6839b114505c7a9d3811ee63ff3950f1c0a251c
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/conditional_stmt/conditional_if_001_T.ets
arkts
Introduction 条件语句-if
export function conditional_if_001_T(taint_src : string) { if (true) { taint.Sink(taint_src) } else {} }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_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#if_statement#Left if ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#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 taint AST#expression#Right . Sink AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src 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#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function conditional_if_001_T(taint_src : string) { if (true) { taint.Sink(taint_src) } else {} }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_001_T.ets#L6-L10
d0b50bbe3791e6b8812a92f9528431fbab008d01
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_004_F.ets
arkts
Introduction 参数传递-参数位置
export function argument_passing_002_F(taint_src : string) { f(taint_src,"_"); }
AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left f AST#expression#Right AST#argument_list#Left ( AST#expression#Left taint_src 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#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function argument_passing_002_F(taint_src : string) { f(taint_src,"_"); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/context_sensitive/argument_value_passing/argument_passing_004_F.ets#L6-L8
51978d61c78a27d1354c229b9437a1b6f8150d53
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DatabaseService.ets
arkts
init
初始化数据库
async init(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: Constants.DB_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); // 检查并执行数据库迁移 await this.checkAndMigrateDatabase(); console.info(`[DatabaseService] Database initialized, version: ${Constants.DB_VERSION}`); } catch (error) { console.error('Failed to initialize database:', error); } }
AST#method_declaration#Left async init 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 void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left config : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig 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 name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DB_NAME AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left securityLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left relationalStore AST#expression#Right . SecurityLevel AST#member_expression#Right AST#expression#Right . S1 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rdbStore AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left relationalStore AST#expression#Right AST#await_expression#Right AST#expression#Right . getRdbStore AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left config 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 AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . checkAndMigrateDatabase 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [DatabaseService] Database initialized, version: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DB_VERSION 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#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 'Failed to initialize database:' AST#expression#Right , AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async init(context: Context): Promise<void> { try { const config: relationalStore.StoreConfig = { name: Constants.DB_NAME, securityLevel: relationalStore.SecurityLevel.S1 }; this.rdbStore = await relationalStore.getRdbStore(context, config); await this.checkAndMigrateDatabase(); console.info(`[DatabaseService] Database initialized, version: ${Constants.DB_VERSION}`); } catch (error) { console.error('Failed to initialize database:', error); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L49-L65
2b53e75f114ca415e037becefa1ba05f62880b7e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/TextPrompts.ets
arkts
TextPopupExample
[Start text_popup]
@Entry @Component export struct TextPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions') .margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePopup; }) .bindPopup(this.handlePopup, { message: 'This is a popup with PopupOptions', }) }.width('100%').padding({ top: 5 }) } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.TextPopup_title')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct TextPopupExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right handlePopup : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'PopupOptions' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handlePopup AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . handlePopup AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . bindPopup ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . handlePopup AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left 'This is a popup with PopupOptions' AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#f1f2f3' AST#expression#Right ) AST#modifier_chain_expression#Left . title ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.TextPopup_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Entry @Component export struct TextPopupExample { @State handlePopup: boolean = false; build() { NavDestination() { Column({ space: 12 }) { Column() { Button('PopupOptions') .margin({ top: 300 }) .onClick(() => { this.handlePopup = !this.handlePopup; }) .bindPopup(this.handlePopup, { message: 'This is a popup with PopupOptions', }) }.width('100%').padding({ top: 5 }) } .width('100%') .height('100%') .padding({ left: 12, right: 12 }) } .backgroundColor('#f1f2f3') .title($r('app.string.TextPopup_title')) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/popup/TextPrompts.ets#L17-L45
cdc04079771d8a645d8a9c47a933050ef0fbc42e
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
PickerController
The class for PickerController @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
@Observed export declare class PickerController { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setData(dataType: DataType, data: Object): void; /** * Add data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 21 */ addData(dataType: DataType, data: Object): void; /** * Delete data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 21 */ deleteData(dataType: DataType, data: Object): void; /** * Set max select count to picker component, include max_total_count, max_photo_count and max_video_count. * * @param { MaxSelected } maxSelected - max select count data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setMaxSelected(maxSelected: MaxSelected): void; /** * Set photo browser item to picker component. * * @param { string } uri - specify image uri for photo browsing * @param { PhotoBrowserRange } photoBrowserRange - photo browser slide range * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void; /** * Exit photo browser. * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ exitPhotoBrowser(): void; /** * Sets whether other elements on the photo browser page are visible. * * @param { Array<PhotoBrowserUIElement> } elements - other elements on the photo browser page * @param { boolean } isVisible - visible or not * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void; /** * Display the photo after edit. * * @param { string } originalUri - Original uri * @param { string } newUri - New uri after replacement * @param { AsyncCallback<void> } callback - Returns void * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 15 */ replacePhotoPickerPreview(originalUri: string, newUri: string, callback: AsyncCallback<void>): void; /** * Save the photo assets of uris. * * @param { Array<string> } trustedUris - Uris need to be saved * @param { AsyncCallback<Array<string>> } callback - Returns the uri list * @param { Array<PhotoCreationConfig> } [configs] - Photo asset creation configs * @param { SaveMode } [saveMode] - Mode of save * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 15 */ saveTrustedPhotoAssets(trustedUris: Array<string>, callback: AsyncCallback<Array<string>>, configs?: Array<photoAccessHelper.PhotoCreationConfig>, saveMode?: SaveMode): void; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class PickerController AST#class_body#Left { /** * Set data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setData AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object 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#method_declaration#Right /** * Add data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 21 */ AST#method_declaration#Left addData AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object 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#method_declaration#Right /** * Delete data to picker component * * @param { DataType } dataType - data type * @param { Object } data - data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 21 */ AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left dataType : AST#type_annotation#Left AST#primary_type#Left DataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Object 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#method_declaration#Right /** * Set max select count to picker component, include max_total_count, max_photo_count and max_video_count. * * @param { MaxSelected } maxSelected - max select count data * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setMaxSelected AST#parameter_list#Left ( AST#parameter#Left maxSelected : AST#type_annotation#Left AST#primary_type#Left MaxSelected 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#method_declaration#Right /** * Set photo browser item to picker component. * * @param { string } uri - specify image uri for photo browsing * @param { PhotoBrowserRange } photoBrowserRange - photo browser slide range * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ AST#method_declaration#Left setPhotoBrowserItem AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left photoBrowserRange ? : AST#type_annotation#Left AST#primary_type#Left PhotoBrowserRange 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#method_declaration#Right /** * Exit photo browser. * * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ AST#method_declaration#Left exitPhotoBrowser 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#method_declaration#Right /** * Sets whether other elements on the photo browser page are visible. * * @param { Array<PhotoBrowserUIElement> } elements - other elements on the photo browser page * @param { boolean } isVisible - visible or not * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 13 */ AST#method_declaration#Left setPhotoBrowserUIElementVisibility AST#parameter_list#Left ( AST#parameter#Left elements : 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 PhotoBrowserUIElement 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 isVisible : 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#method_declaration#Right /** * Display the photo after edit. * * @param { string } originalUri - Original uri * @param { string } newUri - New uri after replacement * @param { AsyncCallback<void> } callback - Returns void * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 15 */ AST#method_declaration#Left replacePhotoPickerPreview AST#parameter_list#Left ( AST#parameter#Left originalUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AsyncCallback 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#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right /** * Save the photo assets of uris. * * @param { Array<string> } trustedUris - Uris need to be saved * @param { AsyncCallback<Array<string>> } callback - Returns the uri list * @param { Array<PhotoCreationConfig> } [configs] - Photo asset creation configs * @param { SaveMode } [saveMode] - Mode of save * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 15 */ AST#method_declaration#Left saveTrustedPhotoAssets AST#parameter_list#Left ( AST#parameter#Left trustedUris : 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 callback : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AsyncCallback AST#type_arguments#Left < 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#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left configs ? : 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 AST#qualified_type#Left photoAccessHelper . PhotoCreationConfig AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left saveMode ? : AST#type_annotation#Left AST#primary_type#Left SaveMode 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#method_declaration#Right } AST#class_body#Right AST#decorated_export_declaration#Right
@Observed export declare class PickerController { setData(dataType: DataType, data: Object): void; addData(dataType: DataType, data: Object): void; deleteData(dataType: DataType, data: Object): void; setMaxSelected(maxSelected: MaxSelected): void; setPhotoBrowserItem(uri: string, photoBrowserRange?: PhotoBrowserRange): void; exitPhotoBrowser(): void; setPhotoBrowserUIElementVisibility(elements: Array<PhotoBrowserUIElement>, isVisible: boolean): void; replacePhotoPickerPreview(originalUri: string, newUri: string, callback: AsyncCallback<void>): void; saveTrustedPhotoAssets(trustedUris: Array<string>, callback: AsyncCallback<Array<string>>, configs?: Array<photoAccessHelper.PhotoCreationConfig>, saveMode?: SaveMode): void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L225-L326
5d0801e128ad08f45f8105cc94df5f0c9cf90ab2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets
arkts
XComponentVideo
视频渲染页面
@Builder XComponentVideo() { Stack(this.player.isLoading ? { alignContent: Alignment.Center } : { alignContent: Alignment.Bottom }) { /** * 视频播放组件 * url:视频源(本案例仅支持使用在线视频) */ XComponentView({ url: this.url }) /** * 音量面板,掉起系统面板将面板通过定位隐藏,使用自定义图标 * volumeLevel:通过音量面板设置设备音量 * volumeParameter:设置音量面板的自定义参数 */ // TODO:知识点:音量面板详情可参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V13/ohos-multimedia-avvolumepanel-V13。 AVVolumePanel({ volumeLevel: this.volume, volumeParameter: { position: { x: POSITION_X, y: POSITION_Y } } }) // 开发者可自定义播放组件 if (this.player.isLoading) { // 加载页面 Column() { // TODO: 知识点:创建加载进展组件,除支持通用属性外,还支持设置加载进度条前景色和设置动画显示或者不显示。 LoadingProgress() .color(Color.White) .width($r('app.integer.pip_window_loading_progress_width')) .height($r('app.integer.pip_window_loading_progress_width')) Text($r('app.string.pip_window_loading_progress')) .fontSize($r('app.integer.pip_window_loading_progress_text')) .fontColor(Color.White) } .justifyContent(FlexAlign.Center) .zIndex(2) } else { // 视频进度条 this.ProgressBar() } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right XComponentVideo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#ERROR#Left Stack ( this AST#ERROR#Right AST#modifier_chain_expression#Left . player AST#modifier_chain_expression#Left . isLoading AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right ? { alignContent AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Alignment . Center AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left } : AST#ERROR#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left alignContent AST#expression#Right AST#expression_statement#Right AST#ERROR#Left : AST#ERROR#Left AST#qualified_type#Left Alignment . Bottom AST#qualified_type#Right } ) { /** * 视频播放组件 * url:视频源(本案例仅支持使用在线视频) */ X Component View AST#ERROR#Right ( AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . url AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left ) /** * 音量面板,掉起系统面板将面板通过定位隐藏,使用自定义图标 * volumeLevel:通过音量面板设置设备音量 * volumeParameter:设置音量面板的自定义参数 */ // TODO:知识点:音量面板详情可参考:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V13/ohos-multimedia-avvolumepanel-V13。 AVVolumePanel AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left volumeLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . volume AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left volumeParameter AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left position AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left POSITION_X AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left POSITION_Y AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . player AST#member_expression#Right AST#expression#Right . isLoading AST#member_expression#Right AST#expression#Right ) { // 加载页面 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // TODO: 知识点:创建加载进展组件,除支持通用属性外,还支持设置加载进度条前景色和设置动画显示或者不显示。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_loading_progress_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_loading_progress_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.pip_window_loading_progress' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.pip_window_loading_progress_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . zIndex ( AST#expression#Left 2 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { // 视频进度条 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . ProgressBar 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
@Builder XComponentVideo() { Stack(this.player.isLoading ? { alignContent: Alignment.Center } : { alignContent: Alignment.Bottom }) { XComponentView({ url: this.url }) AVVolumePanel({ volumeLevel: this.volume, volumeParameter: { position: { x: POSITION_X, y: POSITION_Y } } }) if (this.player.isLoading) { Column() { LoadingProgress() .color(Color.White) .width($r('app.integer.pip_window_loading_progress_width')) .height($r('app.integer.pip_window_loading_progress_width')) Text($r('app.string.pip_window_loading_progress')) .fontSize($r('app.integer.pip_window_loading_progress_text')) .fontColor(Color.White) } .justifyContent(FlexAlign.Center) .zIndex(2) } else { this.ProgressBar() } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets#L179-L227
25f8b1f91d591b083c12bc1abc67f977b6f58185
gitee
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/util/IOUtils.ets
arkts
getPixelMapFromResource
从resource中取出pixelMap @param resource 指定资源 @returns pixelMap
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> { // 通过资源管理器获取资源的字节数组 const array = await getContext().resourceManager.getMediaContent(resource); // 利用字节数组创建图像源并从中创建 PixelMap return await image.createImageSource(array.buffer).createPixelMap(); }
AST#method_declaration#Left public static async getPixelMapFromResource 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 AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 通过资源管理器获取资源的字节数组 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left array = 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 AST#await_expression#Left await AST#expression#Left getContext AST#expression#Right AST#await_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getMediaContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resource AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 利用字节数组创建图像源并从中创建 PixelMap AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left image AST#expression#Right AST#await_expression#Right AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left array AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public static async getPixelMapFromResource(resource: Resource): Promise<image.PixelMap> { const array = await getContext().resourceManager.getMediaContent(resource); return await image.createImageSource(array.buffer).createPixelMap(); }
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/IOUtils.ets#L18-L24
db616a69ebeb8045b461942b2ee64547af0f1e0c
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/utils/DateUtil.ets
arkts
日历日期项接口
export interface CalendarDay { day: number isCurrentMonth: boolean date: Date }
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarDay AST#object_type#Left { AST#type_member#Left day : 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 isCurrentMonth : 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 date : AST#type_annotation#Left AST#primary_type#Left Date 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 CalendarDay { day: number isCurrentMonth: boolean date: Date }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/utils/DateUtil.ets#L2-L6
9bf2a7886809ee66824cc2ef71ef4e0bb95fe192
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
aboutToDisappear
Call back when the NodeContainer corresponding to the controller is Disappear.
aboutToDisappear(): void { console.info('aboutToDisappear'); }
AST#method_declaration#Left aboutToDisappear 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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'aboutToDisappear' 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(): void { console.info('aboutToDisappear'); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets#L74-L76
449ec76117fad05b117ee3dce02ee3d7c51ddbab
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMultiPictureUI/entry/src/main/ets/view/PreviewList.ets
arkts
PreviewList
图片预览列表
@Component export struct PreviewList { build() { Column() { Text('图片预览列表') .fontSize('24fp') } .height('47vp') .borderColor(Color.Black) .borderWidth('2vp') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PreviewList 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 Text ( AST#expression#Left '图片预览列表' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left '24fp' 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 . height ( AST#expression#Left '47vp' AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left '2vp' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct PreviewList { build() { Column() { Text('图片预览列表') .fontSize('24fp') } .height('47vp') .borderColor(Color.Black) .borderWidth('2vp') } }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/view/PreviewList.ets#L4-L16
475e66f7ec0f6c1a27d68865fa7845400628d60a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/router/AppRouter.ets
arkts
goContactEdit
跳转到联系人编辑页面 @param contactId 联系人ID
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId } : {}; const options: RouteOptions = { params }; await this.push(path, options); }
AST#method_declaration#Left async goContactEdit AST#parameter_list#Left ( AST#parameter#Left contactId ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left path = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left contactId AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left RoutePaths AST#expression#Right . CONTACT_EDIT AST#member_expression#Right AST#expression#Right : AST#expression#Left RoutePaths AST#expression#Right AST#conditional_expression#Right AST#expression#Right . CONTACT_ADD AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left RouteParams AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#conditional_expression#Left AST#expression#Left contactId AST#expression#Right ? AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left contactId AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right : AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right 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 const AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left RouteOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left params AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId } : {}; const options: RouteOptions = { params }; await this.push(path, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L277-L283
fd33022b8d5e28fc42a6544d59cccb5f0e572959
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets
arkts
【系统】单选弹窗代理
export class SelectBuilderProxy extends BaseModalBuilderProxy<ISelectDialogOptions, SelectDialog> { constructor(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext) { super(uiContext) this.builderOptions.title = title; this.builderOptions.confirm = confirm; this.builderOptions.radioContent = radioContent; } create(options: ISelectDialogOptions) { return new SelectDialog(options); } /** * 弹窗内容 * @param content * @returns */ content(content: ResourceStr) { this.builderOptions.content = content return this; } /** * 默认选中索引 * @param selectedIndex * @returns */ selectedIndex(selectedIndex: number) { this.builderOptions.selectedIndex = selectedIndex return this; } /** * 确认按钮 * @param confirm * @returns */ confirm(confirm: ButtonOptions) { this.builderOptions.confirm = confirm return this; } /** * Radio集合 * @param radioContent * @returns */ radioContent(radioContent: Array<SheetInfo>) { this.builderOptions.radioContent = radioContent return this; } }
AST#export_declaration#Left export AST#class_declaration#Left class SelectBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseModalBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left SelectDialog 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#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( 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 confirm : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left radioContent : 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 SheetInfo 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 uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext 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 super AST#expression#Right AST#argument_list#Left ( AST#expression#Left uiContext 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left confirm AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . radioContent AST#member_expression#Right = AST#expression#Left radioContent 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 create AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ISelectDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SelectDialog AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 弹窗内容 * @param content * @returns */ AST#method_declaration#Left content AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 默认选中索引 * @param selectedIndex * @returns */ AST#method_declaration#Left selectedIndex AST#parameter_list#Left ( AST#parameter#Left selectedIndex : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . selectedIndex AST#member_expression#Right = AST#expression#Left selectedIndex 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 this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 确认按钮 * @param confirm * @returns */ AST#method_declaration#Left confirm AST#parameter_list#Left ( AST#parameter#Left confirm : AST#type_annotation#Left AST#primary_type#Left ButtonOptions 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . confirm AST#member_expression#Right = AST#expression#Left confirm 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 this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Radio集合 * @param radioContent * @returns */ AST#method_declaration#Left radioContent AST#parameter_list#Left ( AST#parameter#Left radioContent : 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 SheetInfo AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . radioContent AST#member_expression#Right = AST#expression#Left radioContent 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 this AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class SelectBuilderProxy extends BaseModalBuilderProxy<ISelectDialogOptions, SelectDialog> { constructor(title: ResourceStr, confirm: ButtonOptions, radioContent: Array<SheetInfo>, uiContext?: UIContext) { super(uiContext) this.builderOptions.title = title; this.builderOptions.confirm = confirm; this.builderOptions.radioContent = radioContent; } create(options: ISelectDialogOptions) { return new SelectDialog(options); } content(content: ResourceStr) { this.builderOptions.content = content return this; } selectedIndex(selectedIndex: number) { this.builderOptions.selectedIndex = selectedIndex return this; } confirm(confirm: ButtonOptions) { this.builderOptions.confirm = confirm return this; } radioContent(radioContent: Array<SheetInfo>) { this.builderOptions.radioContent = radioContent return this; } }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/SelectBuilderProxy.ets#L9-L60
97a9337b31c9f459bbb886c4e050ebddd0a3bd2d
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/utils/GestureUtils.ets
arkts
shouldTriggerSwipe
判断是否应该触发滑动 @param state - 手势状态 @param threshold - 滑动阈值 @returns 是否应该滑动
static shouldTriggerSwipe(state: GestureState, threshold: number): boolean { const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY); return distance >= threshold; }
AST#method_declaration#Left static shouldTriggerSwipe AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left GestureState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left threshold : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left distance : 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 Math AST#expression#Right . sqrt 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#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 state AST#expression#Right . deltaX AST#member_expression#Right AST#expression#Right * AST#expression#Left state AST#expression#Right AST#binary_expression#Right AST#expression#Right . deltaX AST#member_expression#Right AST#expression#Right + AST#expression#Left state AST#expression#Right AST#binary_expression#Right AST#expression#Right . deltaY AST#member_expression#Right AST#expression#Right * AST#expression#Left state AST#expression#Right AST#binary_expression#Right AST#expression#Right . deltaY 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#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left distance AST#expression#Right >= AST#expression#Left threshold 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
static shouldTriggerSwipe(state: GestureState, threshold: number): boolean { const distance: number = Math.sqrt(state.deltaX * state.deltaX + state.deltaY * state.deltaY); return distance >= threshold; }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L88-L91
471fe28b1dd031b96c984be42f5a1b772362bc5f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/StateManagementPage.ets
arkts
构建状态管理示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_state_management_title"), viewModel: this.vm }) { this.StateManagementContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.demo_state_management_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_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 . StateManagementContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { AppNavDestination({ title: $r("app.string.demo_state_management_title"), viewModel: this.vm }) { this.StateManagementContent(); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/StateManagementPage.ets#L24-L31
e614ee5b7a454538f306ed1b90c5bbe4a03afb34
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
getStatisticsData
获取完整统计数据
async getStatisticsData(): Promise<StatisticsData> { try { const results = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); const overview = results[0]; const birthday = results[1]; const greeting = results[2]; const usage = results[3]; const trend = results[4]; return { overview, birthday, greeting, usage, trend }; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get statistics data: ${error}`); throw new Error(`Failed to get statistics data: ${error}`); } }
AST#method_declaration#Left async getStatisticsData 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 StatisticsData 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 results = 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 Promise AST#expression#Right AST#await_expression#Right AST#expression#Right . all AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getOverviewStats 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 this AST#expression#Right . getBirthdayStats 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 this AST#expression#Right . getGreetingStats 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 this AST#expression#Right . getUsageStats 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 this AST#expression#Right . getTrendStats AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right 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#variable_declaration#Left const AST#variable_declarator#Left overview = AST#expression#Left AST#subscript_expression#Left AST#expression#Left results AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left birthday = AST#expression#Left AST#subscript_expression#Left AST#expression#Left results AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left greeting = AST#expression#Left AST#subscript_expression#Left AST#expression#Left results AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left usage = AST#expression#Left AST#subscript_expression#Left AST#expression#Left results AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left trend = AST#expression#Left AST#subscript_expression#Left AST#expression#Left results AST#expression#Right [ AST#expression#Left 4 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#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left overview AST#property_assignment#Right , AST#property_assignment#Left birthday AST#property_assignment#Right , AST#property_assignment#Left greeting AST#property_assignment#Right , AST#property_assignment#Left usage AST#property_assignment#Right , AST#property_assignment#Left trend 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 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 get statistics data: 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 ` Failed to get statistics data: 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
async getStatisticsData(): Promise<StatisticsData> { try { const results = await Promise.all([ this.getOverviewStats(), this.getBirthdayStats(), this.getGreetingStats(), this.getUsageStats(), this.getTrendStats() ]); const overview = results[0]; const birthday = results[1]; const greeting = results[2]; const usage = results[3]; const trend = results[4]; return { overview, birthday, greeting, usage, trend }; } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get statistics data: ${error}`); throw new Error(`Failed to get statistics data: ${error}`); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L344-L371
b2ad8ce2b264e1bac55a1b58b4c8b3eab18594a5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
请求公共传参
export class commonParams { /** * 基础请求前缀地址 */ baseURL?: string; /** * 请求路径 必填 */ url: string = ''; /** * 当次请求需要设置的请求头 */ headers?: Record<string, string>; /** * 当次请求需要设置的cookies */ cookies?: Record<string, string>; /** * 当次请求需要设置的loading文本 */ loadingTxt?: string; /** * 当次请求的临时开启或关闭Loading控制(1.0.6+) */ loading?: boolean; /** * Loading窗口的背景颜色(1.0.7+) */ loadingColor?: string; }
AST#export_declaration#Left export AST#class_declaration#Left class commonParams AST#class_body#Left { /** * 基础请求前缀地址 */ AST#property_declaration#Left baseURL ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 请求路径 必填 */ AST#property_declaration#Left url : 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 headers ? : 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 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#property_declaration#Right /** * 当次请求需要设置的cookies */ AST#property_declaration#Left cookies ? : 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 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#property_declaration#Right /** * 当次请求需要设置的loading文本 */ AST#property_declaration#Left loadingTxt ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 当次请求的临时开启或关闭Loading控制(1.0.6+) */ AST#property_declaration#Left loading ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * Loading窗口的背景颜色(1.0.7+) */ AST#property_declaration#Left loadingColor ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class commonParams { baseURL?: string; url: string = ''; headers?: Record<string, string>; cookies?: Record<string, string>; loadingTxt?: string; loading?: boolean; loadingColor?: string; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L235-L264
4b33d25994f5884dac0626ebd11e630591b8eafe
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets
arkts
initWantAgentNotificationRequest
init wantAgent NotificationRequest @param notificationContent @param notificationWantAgent @return return the created NotificationRequest
initWantAgentNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationWantAgent: WantAgent): notificationManager.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, // 通知id,默认为1 content: notificationContent, wantAgent: notificationWantAgent }; }
AST#method_declaration#Left initWantAgentNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationWantAgent : AST#type_annotation#Left AST#primary_type#Left WantAgent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . CONTENT_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 通知id,默认为1 AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left notificationContent AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left wantAgent AST#property_name#Right : AST#expression#Left notificationWantAgent AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
initWantAgentNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationWantAgent: WantAgent): notificationManager.NotificationRequest { return { slotType: notification.SlotType.CONTENT_INFORMATION, id: 1, content: notificationContent, wantAgent: notificationWantAgent }; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets#L42-L49
b0fc1d9f451da9ad0ad4d0821432901dab15e42e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/pages/ZoomChangeColumnPage.ets
arkts
getSize
[StartExclude quick_start]
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } setItemSizeArray(): void { for (let i: number = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
AST#method_declaration#Left getSize 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#variable_declaration#Left let AST#variable_declarator#Left ret : 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 Math AST#expression#Right . floor 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . random 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 . maxSize 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#return_statement#Left return AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ret AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . minSize AST#member_expression#Right AST#expression#Right ? AST#ERROR#Left ret : AST#ERROR#Left AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . minSize AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ) ; } setItemSizeArray 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 { for AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left let AST#ERROR#Left i AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#update_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left ; i AST#ERROR#Right < AST#expression#Left 100 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ; i AST#ERROR#Right ++ AST#update_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#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 . itemWidthArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSize 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#ERROR#Right ; AST#return_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 . itemHeightArray AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSize 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#method_declaration#Right
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } setItemSizeArray(): void { for (let i: number = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/ZoomChangeColumnPage.ets#L75-L84
b506de20f1ba1f715e0068663c1b25d5bedec41c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
表示商品模型的类型,是嵌套类的首层 @class
export class FistGoodsModel { itemList: SecondGoodsItemList; constructor(itemList: SecondGoodsItemList) { this.itemList = itemList; } }
AST#export_declaration#Left export AST#class_declaration#Left class FistGoodsModel AST#class_body#Left { AST#property_declaration#Left itemList : AST#type_annotation#Left AST#primary_type#Left SecondGoodsItemList AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left itemList : AST#type_annotation#Left AST#primary_type#Left SecondGoodsItemList 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 . itemList AST#member_expression#Right = AST#expression#Left itemList 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 FistGoodsModel { itemList: SecondGoodsItemList; constructor(itemList: SecondGoodsItemList) { this.itemList = itemList; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L50-L56
14319d0cb62f01855af40d92730a4619ca6a87f8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/ui/src/main/ets/component/navdestination/AppNavDestination.ets
arkts
getSafeAreaPadding
获取安全区内边距 @returns {Padding} 安全区内边距
private getSafeAreaPadding(): Padding { return { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, bottom: this.windowSafeAreaState.bottomInset, right: this.windowSafeAreaState.rightInset }; }
AST#method_declaration#Left private getSafeAreaPadding AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Padding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . leftInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . bottomInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . windowSafeAreaState AST#member_expression#Right AST#expression#Right . rightInset AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private getSafeAreaPadding(): Padding { return { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, bottom: this.windowSafeAreaState.bottomInset, right: this.windowSafeAreaState.rightInset }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/src/main/ets/component/navdestination/AppNavDestination.ets#L145-L152
8dee193c389a2b2e88f77072c88b09bb405f25a2
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
gpu_transform/index.ets
arkts
GPUImage3x3TextureSamplingFilter
Copyright (C) 2021 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter'
AST#export_declaration#Left export { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter' AST#export_declaration#Right
export { GPUImage3x3TextureSamplingFilter } from './src/main/ets/gpu/filter/GPUImage3x3TextureSamplingFilter'
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/gpu_transform/index.ets#L16-L16
0c956cd89ed327babcf7ed4d3500734f39dda6db
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
customPlugin/library/src/main/ets/components/MainPage.ets
arkts
MainPage
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@Preview @Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) }.height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'Hello World' AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Preview @Component export struct MainPage { @State message: string = 'Hello World'; build() { Row() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) }.height('100%') } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/customPlugin/library/src/main/ets/components/MainPage.ets#L16-L28
f04da6ffd7968f77bc651c9dcd387ace69e9c130
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/pages/MorePage.ets
arkts
LoadingContent
导入时显示 阻止用户操作
@Builder LoadingContent() { Stack() { Column() .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}) Column() { Progress({ value: 0, total: 100, type: ProgressType.Ring }) .width(StyleConstants.PROGRESS_WIDTH) .color(Color.Blue) .style({ strokeWidth: StyleConstants.PROGRESS_STROKE_WIDTH, status: ProgressStatus.LOADING }) Text($r("app.string.Index_processing")) .margin({ top: StyleConstants.MARGIN_TWENTY }) .fontSize(StyleConstants.PROGRESS_TEXT_FONT_SIZE) } .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) .onClick(() => { }) } .onClick(() => { }) .onAppear(() => { Logger.debug(this.LOG_TAG, "Blocking stack loaded!"); }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right LoadingContent 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 Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.transparent" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . blur ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . BLUE_LEVEL 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left total : AST#expression#Left 100 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressType AST#expression#Right . Ring AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . PROGRESS_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . style ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left strokeWidth AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . PROGRESS_STROKE_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left status AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ProgressStatus AST#expression#Right . LOADING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.Index_processing" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . MARGIN_TWENTY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . PROGRESS_TEXT_FONT_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left StyleConstants AST#expression#Right . FULL_PERCENT AST#member_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 . onClick ( 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( 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#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug 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 . LOG_TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left "Blocking stack loaded!" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder LoadingContent() { Stack() { Column() .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .backgroundColor($r("app.color.transparent")) .blur(StyleConstants.BLUE_LEVEL) .onClick(() => {}) Column() { Progress({ value: 0, total: 100, type: ProgressType.Ring }) .width(StyleConstants.PROGRESS_WIDTH) .color(Color.Blue) .style({ strokeWidth: StyleConstants.PROGRESS_STROKE_WIDTH, status: ProgressStatus.LOADING }) Text($r("app.string.Index_processing")) .margin({ top: StyleConstants.MARGIN_TWENTY }) .fontSize(StyleConstants.PROGRESS_TEXT_FONT_SIZE) } .width(StyleConstants.FULL_PERCENT) .height(StyleConstants.FULL_PERCENT) .justifyContent(FlexAlign.Center) .onClick(() => { }) } .onClick(() => { }) .onAppear(() => { Logger.debug(this.LOG_TAG, "Blocking stack loaded!"); }) }
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/pages/MorePage.ets#L166-L200
194ee5711b2551342b8a0b21ee4f9a8c551648fa
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getVersionName
获取应用版本名。
static getVersionName(): string { return AppUtil.getBundleInfoSync().versionName; }
AST#method_declaration#Left static getVersionName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getBundleInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . versionName AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getVersionName(): string { return AppUtil.getBundleInfoSync().versionName; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L521-L523
d4b13f80233949fe1308619dd5d7ac1420f4aaf0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
arkts
英式发音
export const pronUs = "item3";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left pronUs = AST#expression#Left "item3" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const pronUs = "item3";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L24-L24
8ef822deb4363d580d30034b23cbb0c814e1e5c4
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets
arkts
showAlert
根据参数创建窗口 @param options @returns
static async showAlert(options?: efAlertOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { //当前窗口的编码 let winName = 'efDialog' + RandomUtil.randomNumber(1000, 1000000); //创建存储 let efStorage = new LocalStorage(); //存储 efStorage.setOrCreate('efDialogName', winName); //创建窗口 let windowClass = await window.createWindow({ name: winName, windowType: window.WindowType.TYPE_DIALOG, ctx: ctx }); //将窗口缓存 WinDialogUtil.cacheWindowMap.set(winName, windowClass); //更新属性 if (options) { if (!options.title) { options.title = '温馨提示'; } if (!options.okText) { options.okText = "确定"; } if (!options.cancelText) { options.cancelText = "取消"; } if (options.isAutoClose == undefined) { options.isAutoClose = true; } //存储数据 efStorage.setOrCreate('efAlertOptions', options); } await windowClass.loadContentByName('efAlert', efStorage); //获取屏幕四大角 let d = display.getDefaultDisplaySync(); //设置窗口大小 await windowClass.resize(d.width, d.height); // 设置窗口背景颜色 windowClass.setWindowBackgroundColor('#88000000'); //显示窗口 await windowClass.showWindow(); } catch (exception) { ToastUtil.showToast('创建窗口失败,原因为:' + JSON.stringify(exception)); } }
AST#method_declaration#Left static async showAlert AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left efAlertOptions 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#variable_declaration#Left let AST#variable_declarator#Left ctx = 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { //当前窗口的编码 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left winName = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'efDialog' AST#expression#Right + AST#expression#Left RandomUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . randomNumber AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1000 AST#expression#Right , AST#expression#Left 1000000 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 efStorage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left LocalStorage AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 efStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'efDialogName' AST#expression#Right , AST#expression#Left winName 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 windowClass = 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 window AST#expression#Right AST#await_expression#Right AST#expression#Right . createWindow 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 name AST#property_name#Right : AST#expression#Left winName AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left windowType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . WindowType AST#member_expression#Right AST#expression#Right . TYPE_DIALOG AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ctx AST#property_name#Right : AST#expression#Left ctx AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //将窗口缓存 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WinDialogUtil AST#expression#Right . cacheWindowMap AST#member_expression#Right AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left winName AST#expression#Right , AST#expression#Left windowClass 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 options 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#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . title 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 options AST#expression#Right . title AST#member_expression#Right = AST#expression#Left '温馨提示' AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . okText 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 options AST#expression#Right . okText AST#member_expression#Right = AST#expression#Left "确定" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . cancelText 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 options AST#expression#Right . cancelText AST#member_expression#Right = AST#expression#Left "取消" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . isAutoClose 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . isAutoClose AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //存储数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left efStorage AST#expression#Right . setOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'efAlertOptions' AST#expression#Right , AST#expression#Left options 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#await_expression#Left await AST#expression#Left windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . loadContentByName AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'efAlert' AST#expression#Right , AST#expression#Left efStorage 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 d = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getDefaultDisplaySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //设置窗口大小 AST#statement#Left AST#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 windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . resize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left d AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left d AST#expression#Right . height 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 windowClass AST#expression#Right . setWindowBackgroundColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '#88000000' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //显示窗口 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left windowClass AST#expression#Right AST#await_expression#Right AST#expression#Right . showWindow 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 ( exception ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ToastUtil AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '创建窗口失败,原因为:' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left exception AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async showAlert(options?: efAlertOptions): Promise<void> { let ctx = getContext() as common.UIAbilityContext; try { let winName = 'efDialog' + RandomUtil.randomNumber(1000, 1000000); let efStorage = new LocalStorage(); efStorage.setOrCreate('efDialogName', winName); let windowClass = await window.createWindow({ name: winName, windowType: window.WindowType.TYPE_DIALOG, ctx: ctx }); WinDialogUtil.cacheWindowMap.set(winName, windowClass); if (options) { if (!options.title) { options.title = '温馨提示'; } if (!options.okText) { options.okText = "确定"; } if (!options.cancelText) { options.cancelText = "取消"; } if (options.isAutoClose == undefined) { options.isAutoClose = true; } 数据 efStorage.setOrCreate('efAlertOptions', options); } await windowClass.loadContentByName('efAlert', efStorage); let d = display.getDefaultDisplaySync(); await windowClass.resize(d.width, d.height); windowClass.setWindowBackgroundColor('#88000000'); await windowClass.showWindow(); } catch (exception) { ToastUtil.showToast('创建窗口失败,原因为:' + JSON.stringify(exception)); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/WinDialogUtil.ets#L45-L91
2e75e75f7645d07bc9be7e4e2b793cae9949ae22
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
init
提供一个异步初始化方法
public async init(): Promise<void> { // 等待 preferences 初始化完成 await this.initPreferences(); if (this.currentPlanId != null) { this.plan = await PlanManager.getPlanByPlanId(this.currentPlanId); } }
AST#method_declaration#Left public async init 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#builder_function_body#Left { // 等待 preferences 初始化完成 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 . initPreferences AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentPlanId 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . plan AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left PlanManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getPlanByPlanId 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 . currentPlanId 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
public async init(): Promise<void> { await this.initPreferences(); if (this.currentPlanId != null) { this.plan = await PlanManager.getPlanByPlanId(this.currentPlanId); } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L92-L99
89848eb72f156527e1d71c0dfdad85a25788577c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsDetailPage.ets
arkts
GoodsDetailLargeLayout
大屏商品详情布局(左右等分) @returns {void} 无返回值
@Builder private GoodsDetailLargeLayout(): void { RowStartTop({ fillMaxSize: true }) { ColumnStart({ widthValue: P50, heightValue: P100 }) { GoodsBanner({ bannerList: this.vm.data?.goodsInfo?.pics ?? [], autoPlay: false, loop: false, imageFit: ImageFit.Cover, useSquareRatio: false }); } ColumnStart({ widthValue: P50, heightValue: P100 }) { Blank().height(this.windowSafeAreaState.topInset ?? 0); this.GoodsDetailList(false); GoodsDetailBottomBar({ onBuyNowClick: (): void => this.vm.showSpecModal(), onAddToCartClick: (): void => this.vm.showSpecModal() }); } } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private GoodsDetailLargeLayout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RowStartTop ( AST#component_parameters#Left { AST#component_parameter#Left fillMaxSize : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P50 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left GoodsBanner ( AST#component_parameters#Left { AST#component_parameter#Left bannerList : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right ?. goodsInfo AST#member_expression#Right AST#expression#Right ?. pics 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#component_parameter#Right , AST#component_parameter#Left autoPlay : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left loop : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left imageFit : AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left useSquareRatio : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left widthValue : AST#expression#Left P50 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left heightValue : AST#expression#Left P100 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( 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 . windowSafeAreaState AST#member_expression#Right AST#expression#Right . topInset AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#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 . GoodsDetailList 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#ui_custom_component_statement#Left GoodsDetailBottomBar ( AST#component_parameters#Left { AST#component_parameter#Left onBuyNowClick : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . showSpecModal 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_parameter#Left onAddToCartClick : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . showSpecModal 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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private GoodsDetailLargeLayout(): void { RowStartTop({ fillMaxSize: true }) { ColumnStart({ widthValue: P50, heightValue: P100 }) { GoodsBanner({ bannerList: this.vm.data?.goodsInfo?.pics ?? [], autoPlay: false, loop: false, imageFit: ImageFit.Cover, useSquareRatio: false }); } ColumnStart({ widthValue: P50, heightValue: P100 }) { Blank().height(this.windowSafeAreaState.topInset ?? 0); this.GoodsDetailList(false); GoodsDetailBottomBar({ onBuyNowClick: (): void => this.vm.showSpecModal(), onAddToCartClick: (): void => this.vm.showSpecModal() }); } } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsDetailPage.ets#L120-L142
13f424a178b5ac3864e6cd0f8dbca2029a87b82c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets
arkts
createCigenWordFromRs
============================================================ ResultSet -> CigenWord ============================================================
private createCigenWordFromRs(rs: relationalStore.ResultSet): CigenWord { const word = new CigenWord(); word.idx = rs.getLong(rs.getColumnIndex('CWord_idx')); word.cid = rs.getLong(rs.getColumnIndex('CWord_cid')); word.vid = rs.getLong(rs.getColumnIndex('Cgcz_vid')); word.titleEn = ResultSetTool.decodeString(rs, 'CWord_titleEn'); word.mnemonic = ResultSetTool.decodeString(rs, 'CWord_mnemonic'); word.desc = ResultSetTool.decodeString(rs, 'Cgcz_desc'); return word; }
AST#method_declaration#Left private createCigenWordFromRs AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CigenWord AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left word = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CigenWord 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 word AST#expression#Right . idx AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong 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 rs AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'CWord_idx' 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#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 word AST#expression#Right . cid AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong 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 rs AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'CWord_cid' 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#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 word AST#expression#Right . vid AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong 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 rs AST#expression#Right . getColumnIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Cgcz_vid' 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#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 word AST#expression#Right . titleEn AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResultSetTool AST#expression#Right . decodeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right , AST#expression#Left 'CWord_titleEn' 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 word AST#expression#Right . mnemonic AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResultSetTool AST#expression#Right . decodeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right , AST#expression#Left 'CWord_mnemonic' 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 word AST#expression#Right . desc AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ResultSetTool AST#expression#Right . decodeString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rs AST#expression#Right , AST#expression#Left 'Cgcz_desc' 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#return_statement#Left return AST#expression#Left word AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private createCigenWordFromRs(rs: relationalStore.ResultSet): CigenWord { const word = new CigenWord(); word.idx = rs.getLong(rs.getColumnIndex('CWord_idx')); word.cid = rs.getLong(rs.getColumnIndex('CWord_cid')); word.vid = rs.getLong(rs.getColumnIndex('Cgcz_vid')); word.titleEn = ResultSetTool.decodeString(rs, 'CWord_titleEn'); word.mnemonic = ResultSetTool.decodeString(rs, 'CWord_mnemonic'); word.desc = ResultSetTool.decodeString(rs, 'Cgcz_desc'); return word; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/cigen/CigenWordDbAccess.ets#L169-L180
9c24669290a36a3d763a2f9376b2e5909585ee4f
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getWeekDates
获取本周的日期数组 @returns 本周7天的日期数组
static getWeekDates(): Date[] { const weekStart = DateUtils.getWeekStart(); const dates: Date[] = []; for (let i = 0; i < 7; i++) { const date = new Date(weekStart); date.setDate(weekStart.getDate() + i); dates.push(date); } return dates; }
AST#method_declaration#Left static getWeekDates AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Date [ ] AST#array_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 weekStart = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtils AST#expression#Right . getWeekStart 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 dates : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Date [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 7 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#variable_declaration#Left const AST#variable_declarator#Left date = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left weekStart 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 date AST#expression#Right . setDate 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 weekStart AST#expression#Right . getDate 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 i AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dates AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left date AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left dates AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getWeekDates(): Date[] { const weekStart = DateUtils.getWeekStart(); const dates: Date[] = []; for (let i = 0; i < 7; i++) { const date = new Date(weekStart); date.setDate(weekStart.getDate() + i); dates.push(date); } return dates; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DateUtils.ets#L161-L172
66342490a8b73707e1f849d43a4342c4f660a161
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Global Data Exports everything, ALL USER DATA.
export async function export_everything() { bunch_of_settings.save_to_disk(); // sandbox_save('kv_store.json.browsercatstore.txt', await export_json_kv_store()); sandbox_unlink_sync('kv_store.json.browsercatstore.txt'); sandbox_unlink_sync('profile.zip'); sandbox_rmdir_sync('temp'); let inFile = meowContext().filesDir; let outFile = meowContext().filesDir + '/profile.zip'; let options: zlib.Options = { level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY }; try { zlib.compressFile(inFile, outFile, options).then((data: void) => { console.info('compressFile success. data: ' + JSON.stringify(data)); // SAVE document_save_from_path(outFile, 'profile.zip.browsercatprofile').then(() => { // sandbox_unlink_sync('settings.json.browsercatsettings.txt'); // sandbox_unlink_sync('profile.zip'); AppStorage.set('compressing_output_profile', false); }) }).catch((errData: BusinessError) => { console.error(`errData is errCode:${errData.code} message:${errData.message}`); }) } catch (errData) { let code = (errData as BusinessError).code; let message = (errData as BusinessError).message; console.error(`errData is errCode:${code} message:${message}`); } }
AST#export_declaration#Left export AST#function_declaration#Left async function export_everything 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 bunch_of_settings AST#expression#Right . save_to_disk 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 // sandbox_save('kv_store.json.browsercatstore.txt', await export_json_kv_store()); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_unlink_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'kv_store.json.browsercatstore.txt' 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 sandbox_unlink_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'profile.zip' 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 sandbox_rmdir_sync AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'temp' 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 inFile = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir 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 outFile = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left meowContext AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . filesDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/profile.zip' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left zlib . Options 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 level AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left zlib AST#expression#Right . CompressLevel AST#member_expression#Right AST#expression#Right . COMPRESS_LEVEL_DEFAULT_COMPRESSION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left memLevel AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left zlib AST#expression#Right . MemLevel AST#member_expression#Right AST#expression#Right . MEM_LEVEL_DEFAULT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left strategy AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left zlib AST#expression#Right . CompressStrategy AST#member_expression#Right AST#expression#Right . COMPRESS_STRATEGY_DEFAULT_STRATEGY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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#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 zlib AST#expression#Right . compressFile AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left inFile AST#expression#Right , AST#expression#Left outFile AST#expression#Right , AST#expression#Left options 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 data : AST#type_annotation#Left AST#primary_type#Left void 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 . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'compressFile success. data: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data 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 // SAVE 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 document_save_from_path AST#expression#Right AST#argument_list#Left ( AST#expression#Left outFile AST#expression#Right , AST#expression#Left 'profile.zip.browsercatprofile' 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 { // sandbox_unlink_sync('settings.json.browsercatsettings.txt'); // sandbox_unlink_sync('profile.zip'); AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'compressing_output_profile' AST#expression#Right , 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 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 . 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 errData : 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#template_literal#Left ` errData is errCode: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left errData 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 errData 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#catch_clause#Left catch ( errData ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left code = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left errData AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left errData AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 ` errData is errCode: AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right message: AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export async function export_everything() { bunch_of_settings.save_to_disk(); sandbox_unlink_sync('kv_store.json.browsercatstore.txt'); sandbox_unlink_sync('profile.zip'); sandbox_rmdir_sync('temp'); let inFile = meowContext().filesDir; let outFile = meowContext().filesDir + '/profile.zip'; let options: zlib.Options = { level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY }; try { zlib.compressFile(inFile, outFile, options).then((data: void) => { console.info('compressFile success. data: ' + JSON.stringify(data)); document_save_from_path(outFile, 'profile.zip.browsercatprofile').then(() => { AppStorage.set('compressing_output_profile', false); }) }).catch((errData: BusinessError) => { console.error(`errData is errCode:${errData.code} message:${errData.message}`); }) } catch (errData) { let code = (errData as BusinessError).code; let message = (errData as BusinessError).message; console.error(`errData is errCode:${code} message:${message}`); } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L822-L856
4a618dd8ff1a94b0c0417294424bd24ea2bcf4da
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets
arkts
HistoryItem
获取当前页面的上下文
@Component export default struct HistoryItem { // 下载历史的数据 @ObjectLink fileInfo: downloadFilesData; // 文件名称 @State fileName: string = ''; // 待下载任务数量 @Link downloadCount: number; // 下载历史列表 @Link historyArray: downloadFilesData[]; // 下载列表 @Link downloadFileArray: downloadFilesData[]; // 文件下载状态 @State fileStatus: number = -1; aboutToAppear(): void { // 从下载链接获取文件名 this.fileName = getFileNameFromUrl(this.fileInfo.url); // 获取文件下载状态 this.fileStatus = this.fileInfo.fileStatus; } build() { Row() { RelativeContainer() { Image($r('app.media.multiple_files_download_file')) .height($r('app.integer.multiple_files_download_image_size_fifty')) .width($r('app.integer.multiple_files_download_image_size_fifty')) .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, left: { anchor: '__container__', align: HorizontalAlign.Start } }) .id('fileImage') // 文件名文本 Text(this.fileName) .fontSize($r('app.integer.multiple_files_download_text_font_size_fourteen')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_padding_twenty') }) .alignRules({ left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .decoration({ type: this.fileStatus === 1 ? TextDecorationType.None : TextDecorationType.LineThrough }) .id('fileName') // 已下载文本 Text(this.fileStatus === 1 ? $r('app.string.multiple_files_download_history_text_downloaded') : '') .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .fontColor($r('app.color.multiple_files_download_text_font_color')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_padding_twenty') }) .alignRules({ top: { anchor: 'fileName', align: VerticalAlign.Bottom }, left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .id(this.fileName + 'state') // 下载完成时间 Text(this.fileStatus === 1 ? formatTime(this.fileInfo.downloadTime, 'YYYY/MM/DD HH:mm') : '') .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .fontColor($r('app.color.multiple_files_download_text_font_color')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_margin_left_sixty') }) .alignRules({ top: { anchor: 'fileName', align: VerticalAlign.Bottom }, left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .id('downloadTime') // 删除按钮 Button($r('app.string.multiple_files_download_history_button_del'), { type: ButtonType.Normal, stateEffect: true }) .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .padding({ top: $r('app.integer.multiple_files_download_padding_zero'), left: $r('app.integer.multiple_files_download_padding_five'), bottom: $r('app.integer.multiple_files_download_padding_zero'), right: $r('app.integer.multiple_files_download_padding_five') }) .height($r('app.integer.multiple_files_download_height_twenty_six')) .borderRadius($r('app.integer.multiple_files_download_borderRadius_eight')) .enabled(this.fileStatus === 1 ? true : false) .opacity(this.fileStatus === 1 ? 1 : 0.7) .backgroundColor($r('app.color.multiple_files_download_del_bgc')) .alignRules({ bottom: { anchor: 'fileImage', align: VerticalAlign.Bottom }, right: { anchor: '__container__', align: HorizontalAlign.End } }) .margin({ bottom: 10 }) .onClick(() => { let filePath = getContext(this).cacheDir + '/' + this.fileName; // TODO:知识点:删除该条数据应用文件路径 fs.unlink(filePath).then(() => { // 文件状态变为已删除 this.fileStatus = 3; this.fileInfo.fileStatus = this.fileStatus; promptAction.showToast({ message: $r('app.string.multiple_files_download_history_toast_text_del'), duration: 2000, bottom: '50%', }) }).catch((error: BusinessError) => { logger.error('remove file failed with error:' + error); }); emitter.emit({ eventId: 0, priority: 0 }, { data: { isDel: true } }) }) .id(this.fileName + 'delete') } } .width($r('app.string.multiple_files_download_list_width')) .height($r('app.string.multiple_files_download_relative_container_height')) .id(this.fileName) .onClick(() => { // 获取应用文件路径 const cacheDir = context.cacheDir; const filePath: string = `${cacheDir}/${this.fileName}`; // TODO:知识点:使用fs.access判断目录是否已经存在。 fs.access(filePath).then((res: boolean) => { if (!res) { // 文件已删除,弹窗提示是否重新下载 AlertDialog.show({ message: `${this.fileName}文件不存在,是否重新下载?`, alignment: DialogAlignment.Center, // 弹窗在竖直方向上的对齐方式。 autoCancel: false, // 点击遮罩层时,是否关闭弹窗。默认值:true primaryButton: { value: $r('app.string.multiple_files_download_history_button_text_cancel'), fontColor: $r('app.color.multiple_files_download_text_color'), action: () => { logger.info('已取消'); } }, secondaryButton: { value: $r('app.string.multiple_files_download_history_button_text_confirm'), fontColor: $r('app.color.multiple_files_download_del_bgc'), action: () => { // 更改该条数据下载状态 this.fileStatus = 0; this.fileInfo.fileStatus = this.fileStatus; // 该条数据加入下载列表数组中 this.downloadFileArray.push(this.fileInfo); // 下载历史列表删除该条数据 this.historyArray = this.historyArray.filter((item: downloadFilesData) => { return item.id !== this.fileInfo.id; }); // 更新待下载任务数量 this.downloadCount = this.downloadFileArray.length; } }, cornerRadius: $r('app.integer.multiple_files_download_borderRadius_twelve'), // 弹窗边框弧度 width: $r('app.string.multiple_files_download_list_height'), // 弹窗宽度 cancel: () => { logger.info('点击关闭按钮'); } }); } else { // 文件已下载到本地,弹窗提示文件已存在 promptAction.showToast({ message: $r('app.string.multiple_files_download_history_toast_text_exist'), duration: 1000, bottom: '50%', }) } }).catch((err: BusinessError) => { logger.error(TAG, `access failed with error message: ${err.message}, error code: ${err.code}`); }); }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HistoryItem AST#component_body#Left { // 下载历史的数据 AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right fileInfo : AST#type_annotation#Left AST#primary_type#Left downloadFilesData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 文件名称 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fileName : 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 @ Link AST#decorator#Right downloadCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 下载历史列表 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right historyArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left downloadFilesData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 下载列表 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right downloadFileArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left downloadFilesData [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 文件下载状态 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fileStatus : 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 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left getFileNameFromUrl 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 . fileInfo AST#member_expression#Right AST#expression#Right . url 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileInfo AST#member_expression#Right AST#expression#Right . fileStatus AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.multiple_files_download_file' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_image_size_fifty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_image_size_fifty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right 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 left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'fileImage' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 文件名文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_text_font_size_fourteen' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_margin_top_seven' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileImage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . decoration ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : 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 . fileStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left TextDecorationType AST#expression#Right . None AST#member_expression#Right AST#expression#Right : AST#expression#Left TextDecorationType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . LineThrough AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'fileName' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 已下载文本 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_text_downloaded' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_text_font_size_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_files_download_text_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_margin_top_seven' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_twenty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileName' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right 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 left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileImage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right + AST#expression#Left 'state' AST#expression#Right AST#binary_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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left formatTime 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 . fileInfo AST#member_expression#Right AST#expression#Right . downloadTime AST#member_expression#Right AST#expression#Right , AST#expression#Left 'YYYY/MM/DD HH:mm' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left '' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_text_font_size_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_files_download_text_font_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_margin_top_seven' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_margin_left_sixty' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileName' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right 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 left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileImage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'downloadTime' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 删除按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#ERROR#Left AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_button_del' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#ERROR#Right AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left stateEffect : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_text_font_size_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_zero' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_zero' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_padding_five' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_height_twenty_six' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_borderRadius_eight' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( 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 . fileStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( 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 . fileStatus AST#member_expression#Right AST#expression#Right === AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left 1 AST#expression#Right : AST#expression#Left 0.7 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_files_download_del_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left 'fileImage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right 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 right AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . End AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filePath = 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#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 . cacheDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#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 fs AST#expression#Right . unlink 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 . 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus AST#member_expression#Right = AST#expression#Left 3 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileInfo AST#member_expression#Right AST#expression#Right . fileStatus AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_toast_text_del' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '50%' 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 . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#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#binary_expression#Left AST#expression#Left 'remove file failed with error:' AST#expression#Right + AST#expression#Left error 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 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 emitter AST#expression#Right . emit 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 eventId AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left priority AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left isDel 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#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#modifier_chain_expression#Left . id ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right + AST#expression#Left 'delete' AST#expression#Right AST#binary_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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_list_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_relative_container_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName 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#variable_declaration#Left const AST#variable_declarator#Left cacheDir = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . cacheDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left cacheDir AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName 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 // TODO:知识点:使用fs.access判断目录是否已经存在。 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 fs AST#expression#Right . access 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 . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left boolean 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#unary_expression#Left ! AST#expression#Left res AST#expression#Right AST#unary_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 AlertDialog AST#expression#Right . show 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 message AST#property_name#Right : AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 文件不存在,是否重新下载? ` AST#template_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 弹窗在竖直方向上的对齐方式。 AST#property_assignment#Left AST#property_name#Left autoCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , // 点击遮罩层时,是否关闭弹窗。默认值:true AST#property_assignment#Left AST#property_name#Left primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_button_text_cancel' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_files_download_text_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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#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#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_button_text_confirm' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_files_download_del_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 更改该条数据下载状态 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileInfo AST#member_expression#Right AST#expression#Right . fileStatus AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileStatus 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadFileArray 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 this AST#expression#Right . fileInfo 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . historyArray AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . historyArray AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left downloadFilesData 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#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 item AST#expression#Right . id AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . fileInfo AST#member_expression#Right AST#expression#Right . id 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 ) 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 . downloadCount AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . downloadFileArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cornerRadius AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_files_download_borderRadius_twelve' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , // 弹窗边框弧度 AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_list_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , // 弹窗宽度 AST#property_assignment#Left AST#property_name#Left cancel AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#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#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#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 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 promptAction AST#expression#Right . showToast 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 message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_files_download_history_toast_text_exist' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left '50%' 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#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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` access failed with error 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 , error 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 ` 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export default struct HistoryItem { @ObjectLink fileInfo: downloadFilesData; @State fileName: string = ''; @Link downloadCount: number; @Link historyArray: downloadFilesData[]; @Link downloadFileArray: downloadFilesData[]; @State fileStatus: number = -1; aboutToAppear(): void { this.fileName = getFileNameFromUrl(this.fileInfo.url); this.fileStatus = this.fileInfo.fileStatus; } build() { Row() { RelativeContainer() { Image($r('app.media.multiple_files_download_file')) .height($r('app.integer.multiple_files_download_image_size_fifty')) .width($r('app.integer.multiple_files_download_image_size_fifty')) .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, left: { anchor: '__container__', align: HorizontalAlign.Start } }) .id('fileImage') Text(this.fileName) .fontSize($r('app.integer.multiple_files_download_text_font_size_fourteen')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_padding_twenty') }) .alignRules({ left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .decoration({ type: this.fileStatus === 1 ? TextDecorationType.None : TextDecorationType.LineThrough }) .id('fileName') Text(this.fileStatus === 1 ? $r('app.string.multiple_files_download_history_text_downloaded') : '') .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .fontColor($r('app.color.multiple_files_download_text_font_color')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_padding_twenty') }) .alignRules({ top: { anchor: 'fileName', align: VerticalAlign.Bottom }, left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .id(this.fileName + 'state') Text(this.fileStatus === 1 ? formatTime(this.fileInfo.downloadTime, 'YYYY/MM/DD HH:mm') : '') .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .fontColor($r('app.color.multiple_files_download_text_font_color')) .margin({ top: $r('app.integer.multiple_files_download_margin_top_seven'), left: $r('app.integer.multiple_files_download_margin_left_sixty') }) .alignRules({ top: { anchor: 'fileName', align: VerticalAlign.Bottom }, left: { anchor: 'fileImage', align: HorizontalAlign.End } }) .id('downloadTime') Button($r('app.string.multiple_files_download_history_button_del'), { type: ButtonType.Normal, stateEffect: true }) .fontSize($r('app.integer.multiple_files_download_text_font_size_twelve')) .padding({ top: $r('app.integer.multiple_files_download_padding_zero'), left: $r('app.integer.multiple_files_download_padding_five'), bottom: $r('app.integer.multiple_files_download_padding_zero'), right: $r('app.integer.multiple_files_download_padding_five') }) .height($r('app.integer.multiple_files_download_height_twenty_six')) .borderRadius($r('app.integer.multiple_files_download_borderRadius_eight')) .enabled(this.fileStatus === 1 ? true : false) .opacity(this.fileStatus === 1 ? 1 : 0.7) .backgroundColor($r('app.color.multiple_files_download_del_bgc')) .alignRules({ bottom: { anchor: 'fileImage', align: VerticalAlign.Bottom }, right: { anchor: '__container__', align: HorizontalAlign.End } }) .margin({ bottom: 10 }) .onClick(() => { let filePath = getContext(this).cacheDir + '/' + this.fileName; fs.unlink(filePath).then(() => { this.fileStatus = 3; this.fileInfo.fileStatus = this.fileStatus; promptAction.showToast({ message: $r('app.string.multiple_files_download_history_toast_text_del'), duration: 2000, bottom: '50%', }) }).catch((error: BusinessError) => { logger.error('remove file failed with error:' + error); }); emitter.emit({ eventId: 0, priority: 0 }, { data: { isDel: true } }) }) .id(this.fileName + 'delete') } } .width($r('app.string.multiple_files_download_list_width')) .height($r('app.string.multiple_files_download_relative_container_height')) .id(this.fileName) .onClick(() => { const cacheDir = context.cacheDir; const filePath: string = `${cacheDir}/${this.fileName}`; fs.access(filePath).then((res: boolean) => { if (!res) { AlertDialog.show({ message: `${this.fileName}文件不存在,是否重新下载?`, alignment: DialogAlignment.Center, autoCancel: false, primaryButton: { value: $r('app.string.multiple_files_download_history_button_text_cancel'), fontColor: $r('app.color.multiple_files_download_text_color'), action: () => { logger.info('已取消'); } }, secondaryButton: { value: $r('app.string.multiple_files_download_history_button_text_confirm'), fontColor: $r('app.color.multiple_files_download_del_bgc'), action: () => { this.fileStatus = 0; this.fileInfo.fileStatus = this.fileStatus; this.downloadFileArray.push(this.fileInfo); 删除该条数据 this.historyArray = this.historyArray.filter((item: downloadFilesData) => { return item.id !== this.fileInfo.id; }); this.downloadCount = this.downloadFileArray.length; } }, cornerRadius: $r('app.integer.multiple_files_download_borderRadius_twelve'), width: $r('app.string.multiple_files_download_list_height'), cancel: () => { logger.info('点击关闭按钮'); } }); } else { promptAction.showToast({ message: $r('app.string.multiple_files_download_history_toast_text_exist'), duration: 1000, bottom: '50%', }) } }).catch((err: BusinessError) => { logger.error(TAG, `access failed with error message: ${err.message}, error code: ${err.code}`); }); }) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/HistoryItem.ets#L27-L209
3566d0a6ad2aaa5a52da418a4cd8c4b3066d40cf
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
HTTP工具类(完全静态方法)
export class Http { /** * 发送HTTP请求的快捷方法 * @param url 请求地址 * @param method 请求方法,默认GET * @param params 请求参数,默认null * @param callback 回调函数,返回成功状态和错误信息 */ static send( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, // 默认GET请求 params: HttpUtils.HttpParams = null, // 可选参数 callback: (succeed: boolean, msg: string | null) => void ) { // 调用底层HTTP模块,忽略返回的data字段 Http.request(url, method, params, (succeed: boolean, msg: string | null, data: Object[] | null) => { ///这里的data返回值为空,所以Object[]只是占位处理 callback(succeed, msg); // 透传结果 }); } /** * 发起HTTP请求(返回数组数据) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @param callback 回调函数 */ static request<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null, data: T[] | null) => void ): void { Http._request(url, method, params, (responseData: string | null) => { if (!responseData) { callback(false, "响应数据为空", null); return; } try { // 4. 使用类型断言替代any - 符合ArkTS规范 const jsonData: HttpUtils.ReceivedData<T> = JSON.parse(responseData) as HttpUtils.ReceivedData<T>; // 5. 运行时类型校验(增强安全性) // if (typeof jsonData.code === 'number' && typeof jsonData.msg === 'string') { const succeedCode = Http._isSucceed(jsonData.code); const msg = Http._localizedMsg(jsonData.code, jsonData.msg) callback(succeedCode, msg, jsonData.data ?? null); // } else { // callback(false, "无效的响应格式", null); // } } catch (error) { // 6. 安全类型转换(避免any) const errMsg = (error as Error).message; callback(false, `JSON解析失败: ${errMsg}`, null); } }); } /** * 发起HTTP请求(仅返回操作结果) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @param callback 回调函数 */ static async requestPromise<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null ): Promise<HttpUtils.HttpResponse<T>> { const responseData = await Http._requestPromise(url, method, params) if (responseData) { const jsonData: HttpUtils.ReceivedData<T> = JSON.parse(responseData) as HttpUtils.ReceivedData<T>; // if (typeof jsonData.code === 'number' && typeof jsonData.msg === 'string') { const succeedCode = Http._isSucceed(jsonData.code); const msg = Http._localizedMsg(jsonData.code, jsonData.msg) return {succeed: succeedCode, msg: msg, data: jsonData.data ?? null} // } else { // ///无效的响应格式 // return {succeed: false, msg: "无效的响应格式", data: null} // } } return {succeed: false, msg: "Response data is null", data: null} } // 私有方法:执行实际HTTP请求 private static _request( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams, callback: (responseData: string | null) => void ): void { const httpRequest = http.createHttp(); let finalUrl = url; let requestParams: string | null = null; // GET请求处理查询参数 if (method === HttpUtils.Method.GET && params) { finalUrl = `${url}?${Http._buildQueryString(params)}`; } else if (params) { requestParams = JSON.stringify(params); } DebugLog.d(`[HTTP] ${finalUrl} [${method}]`); Http._createHeaders().then((headers) => { // 发送HTTP请求 httpRequest.request( finalUrl, { method: HttpUtils.Functions.toRequestMethod(method), extraData: requestParams, expectDataType: http.HttpDataType.STRING, // 确保返回字符串 header: headers , connectTimeout: 10000, // 10秒连接超时 readTimeout: 10000 // 10秒读取超时 }, (err: BusinessError, data: http.HttpResponse) => { // 销毁请求对象释放资源 httpRequest.destroy(); if (err) { DebugLog.e(`[HTTP] 请求失败: ${JSON.stringify(err)}`); callback(null); } else { // 处理响应数据 if (data.resultType === http.HttpDataType.STRING) { callback(data.result as string); } else { DebugLog.e('[HTTP] 响应类型不是字符串'); callback(null); } } } ); }) .catch((err: Error)=>{ DebugLog.e(`[HTTP] create header error: ${err.message}`); callback(null); }) } // MARK: - 核心请求方法 /** * 执行实际HTTP请求(Promise封装) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @returns Promise封装的响应数据 */ private static async _requestPromise( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams ): Promise<string | null> { const httpRequest = http.createHttp(); // 创建HTTP请求实例 let finalUrl = url; let requestParams: string | null = null; // 1. 处理GET请求参数 if (method === HttpUtils.Method.GET && params) { finalUrl = `${url}?${Http._buildQueryString(params)}`; } else if (params) { requestParams = JSON.stringify(params); } DebugLog.d(`[HTTP] ${finalUrl} [${method}]`); try { // 2. 创建请求头 [6](@ref) const headers = await Http._createHeaders(); // 3. 发送HTTP请求 [7](@ref) const responsePromise: Promise<http.HttpResponse> = httpRequest.request( finalUrl, { method: HttpUtils.Functions.toRequestMethod(method), extraData: requestParams, expectDataType: http.HttpDataType.STRING, header: headers, connectTimeout: 10000, readTimeout: 10000 } ); const response = await responsePromise; // 4. 处理响应数据 if (response.resultType === http.HttpDataType.STRING) { return response.result as string; } else { DebugLog.e('[HTTP] 响应类型不是字符串'); return null; } } catch (err) { // 5. 错误处理 const businessErr = err as BusinessError; DebugLog.e(`[HTTP] 请求失败: ${JSON.stringify(businessErr)}`); return null; } finally { // 6. 确保资源释放 [8](@ref) httpRequest.destroy(); } } // 构建查询字符串 private static _buildQueryString(params: HttpUtils.HttpParams): string { if (!params) return ''; return Object.keys(params) .map(key => { const value = params[key]; // 安全编码参数 return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}` }) .join('&'); } // 判断请求是否成功(根据业务状态码) private static _isSucceed(code?: number): boolean { //return code >= 200 && code < 300; return HttpUtils.Functions.succeed(code) } private static _localizedMsg(code?: number, msg?: string): string | null { return HttpUtils.Functions.localizeMessage(code, msg) ?? null } private static async _createHeaders(): Promise<Record<string, string>> { const timestamp = Math.floor(Date.now() / 1000).toString(); const signString = `${StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appKey)}${timestamp}${StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appSecret)}`; const sign = await StringCrypto.md5(signString) const deviceType = 'Android' // 创建一个空对象 const headers: Record<string, string> = {}; // 使用方括号语法添加属性,这样即使属性名不是标识符也可以 headers[HttpUtils.Header.appKey] = StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appKey)||''; headers[HttpUtils.Header.timestamp] = timestamp; headers[HttpUtils.Header.sign] = sign; headers[HttpUtils.Header.device] = deviceType; headers['Content-Type'] = 'application/json'; return headers; } }
AST#export_declaration#Left export AST#class_declaration#Left class Http AST#class_body#Left { /** * 发送HTTP请求的快捷方法 * @param url 请求地址 * @param method 请求方法,默认GET * @param params 请求参数,默认null * @param callback 回调函数,返回成功状态和错误信息 */ AST#method_declaration#Left static send AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . Method AST#qualified_type#Right 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 HttpUtils AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#parameter#Right , // 默认GET请求 AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , // 可选参数 AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : 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#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 { // 调用底层HTTP模块,忽略返回的data字段 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left method AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : 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#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left Object [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { ///这里的data返回值为空,所以Object[]只是占位处理 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left succeed 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#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 /** * 发起HTTP请求(返回数组数据) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @param callback 回调函数 */ AST#method_declaration#Left static request AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . Method AST#qualified_type#Right 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 HttpUtils AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left succeed : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg : 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#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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#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 Http AST#expression#Right . _request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left method AST#expression#Right , AST#expression#Left params AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left responseData : 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#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 responseData AST#expression#Right AST#unary_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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left "响应数据为空" AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 4. 使用类型断言替代any - 符合ArkTS规范 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left jsonData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left HttpUtils . ReceivedData AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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#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 responseData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left HttpUtils . ReceivedData AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 5. 运行时类型校验(增强安全性) // if (typeof jsonData.code === 'number' && typeof jsonData.msg === 'string') { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left succeedCode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _isSucceed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . code 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 msg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _localizedMsg AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . msg AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left callback AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left succeedCode AST#expression#Right , AST#expression#Left msg AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . data 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#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // } else { // callback(false, "无效的响应格式", null); // } } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { // 6. 安全类型转换(避免any) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left errMsg = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` JSON解析失败: AST#template_substitution#Left $ { AST#expression#Left errMsg AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_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#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 /** * 发起HTTP请求(仅返回操作结果) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @param callback 回调函数 */ AST#method_declaration#Left static async requestPromise AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . Method AST#qualified_type#Right 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 HttpUtils AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left HttpUtils . HttpResponse AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left responseData = 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 Http AST#expression#Right AST#await_expression#Right AST#expression#Right . _requestPromise AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left method AST#expression#Right , AST#expression#Left params 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 responseData AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left jsonData : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left HttpUtils . ReceivedData AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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#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 responseData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AST#qualified_type#Left HttpUtils . ReceivedData AST#qualified_type#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T 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#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // if (typeof jsonData.code === 'number' && typeof jsonData.msg === 'string') { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left succeedCode = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _isSucceed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . code 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 msg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _localizedMsg AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . code AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . msg 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#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left succeed AST#property_name#Right : AST#expression#Left succeedCode AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left msg AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left jsonData AST#expression#Right . data 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right // } else { // ///无效的响应格式 // return {succeed: false, msg: "无效的响应格式", data: null} // } 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left succeed 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 msg AST#property_name#Right : AST#expression#Left "Response data is null" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_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#method_declaration#Right // 私有方法:执行实际HTTP请求 AST#method_declaration#Left private static _request AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . Method AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left responseData : 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#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#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 httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp 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 finalUrl = AST#expression#Left url 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 requestParams : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // GET请求处理查询参数 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 method AST#expression#Right === AST#expression#Left HttpUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right && AST#expression#Left params 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 finalUrl = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left url AST#expression#Right } AST#template_substitution#Right ? AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _buildQueryString 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#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 else AST#if_statement#Left if ( AST#expression#Left params AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left requestParams = 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 params 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#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 DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HTTP] AST#template_substitution#Left $ { AST#expression#Left finalUrl AST#expression#Right } AST#template_substitution#Right [ AST#template_substitution#Left $ { AST#expression#Left method AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 Http AST#expression#Right . _createHeaders 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 headers AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 发送HTTP请求 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left finalUrl AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#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 HttpUtils AST#expression#Right . Functions AST#member_expression#Right AST#expression#Right . toRequestMethod AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left method 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 extraData AST#property_name#Right : AST#expression#Left requestParams AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expectDataType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 确保返回字符串 AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left headers AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right , // 10秒连接超时 AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right // 10秒读取超时 } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { // 销毁请求对象释放资源 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . destroy 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#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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HTTP] 请求失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . resultType AST#member_expression#Right AST#expression#Right === AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . HttpDataType AST#member_expression#Right AST#expression#Right . STRING 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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . result AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[HTTP] 响应类型不是字符串' 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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_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#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 . 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 Error 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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HTTP] create header error: 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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_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 // MARK: - 核心请求方法 /** * 执行实际HTTP请求(Promise封装) * @param url 请求URL * @param method HTTP方法 * @param params 请求参数 * @returns Promise封装的响应数据 */ AST#method_declaration#Left private static async _requestPromise AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . Method AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left 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#variable_declaration#Left const AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . createHttp 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 // 创建HTTP请求实例 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left finalUrl = AST#expression#Left url 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 requestParams : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 1. 处理GET请求参数 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 method AST#expression#Right === AST#expression#Left HttpUtils AST#expression#Right AST#binary_expression#Right AST#expression#Right . Method AST#member_expression#Right AST#expression#Right . GET AST#member_expression#Right AST#expression#Right && AST#expression#Left params 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 finalUrl = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left url AST#expression#Right } AST#template_substitution#Right ? AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Http AST#expression#Right . _buildQueryString 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#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 else AST#if_statement#Left if ( AST#expression#Left params AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left requestParams = 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 params 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#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 DebugLog AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HTTP] AST#template_substitution#Left $ { AST#expression#Left finalUrl AST#expression#Right } AST#template_substitution#Right [ AST#template_substitution#Left $ { AST#expression#Left method AST#expression#Right } AST#template_substitution#Right ] ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 2. 创建请求头 [6](@ref) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left headers = 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 Http AST#expression#Right AST#await_expression#Right AST#expression#Right . _createHeaders 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 // 3. 发送HTTP请求 [7](@ref) AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left responsePromise : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left http . HttpResponse AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left finalUrl AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#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 HttpUtils AST#expression#Right . Functions AST#member_expression#Right AST#expression#Right . toRequestMethod AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left method 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 extraData AST#property_name#Right : AST#expression#Left requestParams AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left expectDataType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left header AST#property_name#Right : AST#expression#Left headers AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left connectTimeout AST#property_name#Right : AST#expression#Left 10000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left readTimeout AST#property_name#Right : AST#expression#Left 10000 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#variable_declaration#Left const AST#variable_declarator#Left response = AST#expression#Left AST#await_expression#Left await AST#expression#Left responsePromise AST#expression#Right AST#await_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 4. 处理响应数据 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . resultType AST#member_expression#Right AST#expression#Right === AST#expression#Left http AST#expression#Right AST#binary_expression#Right AST#expression#Right . HttpDataType AST#member_expression#Right AST#expression#Right . STRING AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left response AST#expression#Right . result AST#member_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#return_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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '[HTTP] 响应类型不是字符串' 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { // 5. 错误处理 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessErr = 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 DebugLog AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [HTTP] 请求失败: 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 businessErr 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#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#finally_clause#Left finally AST#block_statement#Left { // 6. 确保资源释放 [8](@ref) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left httpRequest AST#expression#Right . destroy 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#finally_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 构建查询字符串 AST#method_declaration#Left private static _buildQueryString AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams 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 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#unary_expression#Left ! AST#expression#Left params AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 Object AST#expression#Right . keys 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 . map AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left key => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left value = AST#expression#Left AST#subscript_expression#Left AST#expression#Left params AST#expression#Right [ AST#expression#Left key 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#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left encodeURIComponent 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#template_substitution#Right = AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left encodeURIComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left String AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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#template_substitution#Right ` AST#template_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 . 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 // 判断请求是否成功(根据业务状态码) AST#method_declaration#Left private static _isSucceed AST#parameter_list#Left ( AST#parameter#Left code ? : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { //return code >= 200 && code < 300; 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 HttpUtils AST#expression#Right . Functions AST#member_expression#Right AST#expression#Right . succeed AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left code 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 AST#method_declaration#Left private static _localizedMsg AST#parameter_list#Left ( AST#parameter#Left code ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left msg ? : 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return 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 HttpUtils AST#expression#Right . Functions AST#member_expression#Right AST#expression#Right . localizeMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left code AST#expression#Right , AST#expression#Left msg AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private static async _createHeaders 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#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 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#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 timestamp = 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 Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 1000 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left signString = 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 StringEncoder AST#expression#Right . decodeAfterRemoveSalt 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 Servers AST#expression#Right . Secure AST#member_expression#Right AST#expression#Right . appKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left timestamp AST#expression#Right } AST#template_substitution#Right AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringEncoder AST#expression#Right . decodeAfterRemoveSalt 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 Servers AST#expression#Right . Secure AST#member_expression#Right AST#expression#Right . appSecret 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left sign = 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 StringCrypto AST#expression#Right AST#await_expression#Right AST#expression#Right . md5 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left signString 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 deviceType = AST#expression#Left 'Android' 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 headers : 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } 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#subscript_expression#Left AST#expression#Left headers AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Header AST#member_expression#Right AST#expression#Right . appKey AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = Str AST#ERROR#Right AST#statement#Left AST#expression_statement#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 ingEncoder AST#expression#Right . decodeAfterRemoveSalt 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 Servers AST#expression#Right . Secure AST#member_expression#Right AST#expression#Right . appKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left headers AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Header AST#member_expression#Right AST#expression#Right . timestamp AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = timestamp AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left headers AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Header AST#member_expression#Right AST#expression#Right . sign AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = sign AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left headers AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtils AST#expression#Right . Header AST#member_expression#Right AST#expression#Right . device AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = device Type AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left headers AST#expression#Right [ AST#expression#Left 'Content-Type' AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 'application/json' AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left headers AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Http { static send( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null) => void ) { Http.request(url, method, params, (succeed: boolean, msg: string | null, data: Object[] | null) => { callback(succeed, msg); }); } static request<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null, callback: (succeed: boolean, msg: string | null, data: T[] | null) => void ): void { Http._request(url, method, params, (responseData: string | null) => { if (!responseData) { callback(false, "响应数据为空", null); return; } try { const jsonData: HttpUtils.ReceivedData<T> = JSON.parse(responseData) as HttpUtils.ReceivedData<T>; const succeedCode = Http._isSucceed(jsonData.code); const msg = Http._localizedMsg(jsonData.code, jsonData.msg) callback(succeedCode, msg, jsonData.data ?? null); } catch (error) { const errMsg = (error as Error).message; callback(false, `JSON解析失败: ${errMsg}`, null); } }); } static async requestPromise<T>( url: string, method: HttpUtils.Method = HttpUtils.Method.GET, params: HttpUtils.HttpParams = null ): Promise<HttpUtils.HttpResponse<T>> { const responseData = await Http._requestPromise(url, method, params) if (responseData) { const jsonData: HttpUtils.ReceivedData<T> = JSON.parse(responseData) as HttpUtils.ReceivedData<T>; const succeedCode = Http._isSucceed(jsonData.code); const msg = Http._localizedMsg(jsonData.code, jsonData.msg) return {succeed: succeedCode, msg: msg, data: jsonData.data ?? null} } return {succeed: false, msg: "Response data is null", data: null} } private static _request( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams, callback: (responseData: string | null) => void ): void { const httpRequest = http.createHttp(); let finalUrl = url; let requestParams: string | null = null; if (method === HttpUtils.Method.GET && params) { finalUrl = `${url}?${Http._buildQueryString(params)}`; } else if (params) { requestParams = JSON.stringify(params); } DebugLog.d(`[HTTP] ${finalUrl} [${method}]`); Http._createHeaders().then((headers) => { httpRequest.request( finalUrl, { method: HttpUtils.Functions.toRequestMethod(method), extraData: requestParams, expectDataType: http.HttpDataType.STRING, header: headers , connectTimeout: 10000, readTimeout: 10000 }, (err: BusinessError, data: http.HttpResponse) => { httpRequest.destroy(); if (err) { DebugLog.e(`[HTTP] 请求失败: ${JSON.stringify(err)}`); callback(null); } else { if (data.resultType === http.HttpDataType.STRING) { callback(data.result as string); } else { DebugLog.e('[HTTP] 响应类型不是字符串'); callback(null); } } } ); }) .catch((err: Error)=>{ DebugLog.e(`[HTTP] create header error: ${err.message}`); callback(null); }) } private static async _requestPromise( url: string, method: HttpUtils.Method, params: HttpUtils.HttpParams ): Promise<string | null> { const httpRequest = http.createHttp(); let finalUrl = url; let requestParams: string | null = null; if (method === HttpUtils.Method.GET && params) { finalUrl = `${url}?${Http._buildQueryString(params)}`; } else if (params) { requestParams = JSON.stringify(params); } DebugLog.d(`[HTTP] ${finalUrl} [${method}]`); try { const headers = await Http._createHeaders(); const responsePromise: Promise<http.HttpResponse> = httpRequest.request( finalUrl, { method: HttpUtils.Functions.toRequestMethod(method), extraData: requestParams, expectDataType: http.HttpDataType.STRING, header: headers, connectTimeout: 10000, readTimeout: 10000 } ); const response = await responsePromise; if (response.resultType === http.HttpDataType.STRING) { return response.result as string; } else { DebugLog.e('[HTTP] 响应类型不是字符串'); return null; } } catch (err) { const businessErr = err as BusinessError; DebugLog.e(`[HTTP] 请求失败: ${JSON.stringify(businessErr)}`); return null; } finally { httpRequest.destroy(); } } private static _buildQueryString(params: HttpUtils.HttpParams): string { if (!params) return ''; return Object.keys(params) .map(key => { const value = params[key]; return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}` }) .join('&'); } private static _isSucceed(code?: number): boolean { return HttpUtils.Functions.succeed(code) } private static _localizedMsg(code?: number, msg?: string): string | null { return HttpUtils.Functions.localizeMessage(code, msg) ?? null } private static async _createHeaders(): Promise<Record<string, string>> { const timestamp = Math.floor(Date.now() / 1000).toString(); const signString = `${StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appKey)}${timestamp}${StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appSecret)}`; const sign = await StringCrypto.md5(signString) const deviceType = 'Android' const headers: Record<string, string> = {}; headers[HttpUtils.Header.appKey] = StringEncoder.decodeAfterRemoveSalt(Servers.Secure.appKey)||''; headers[HttpUtils.Header.timestamp] = timestamp; headers[HttpUtils.Header.sign] = sign; headers[HttpUtils.Header.device] = deviceType; headers['Content-Type'] = 'application/json'; return headers; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L11-L267
ed3e66f35be036d9e1b15268be91da7a7aba4deb
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisLineDashedLine
Enables the axis line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance. @param effect the DashPathEffect
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
AST#method_declaration#Left public setAxisLineDashedLine AST#parameter_list#Left ( AST#parameter#Left effect : AST#type_annotation#Left AST#primary_type#Left DashPathEffect 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 . mAxisLineDashPathEffect AST#member_expression#Right = AST#expression#Left effect AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L647-L649
566325b92ad9153bd16b2b9bba4cc3fb87ffe78e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets
arkts
PicturePreviewImage
PicturePreviewImage 图片绘制组件 实现步骤: - 1. 使用matrix实现图片的缩放 - 2. 使用offset实现组件的偏移 - 3. 提前计算图片属性以便对组件属性进行设置 - 4. Image.objectFile使用Cover以便图片能够超出其父组件显示(而不撑大父组件) @param { Color } listBGColor - 图片背景色 @param { string } imageUrl - 图片预览地址 @param { Axis } listDirection - 图片预览的主轴方向 @param { number } [TogglePercent] - 图片滑动多大距离需要切换图片,默认 0.2 @param { number } [imageIndex] - 当前图片下标,默认 0 @param { number } imageMaxLength - 最多几张图片, 默认 0 @param { (offset: number, animationDuration?: number) => void } [setListOffset] - 设置偏移尺寸 @param { (index: number) => void } [setListToIndex] - 切换图片
@Reusable @Component export struct PicturePreviewImage { // 当前背景色 @Link listBGColor: Color; // 图片显示的地址 @Require @Prop imageUrl: string = ''; // 图片滑动方向 @Require @Prop listDirection: Axis; // 图片滑动多大距离需要切换图片 @Prop togglePercent: number = 0.2; // 当前图片下标 @Prop imageIndex: number = 0; // 最多几张图片 @Prop imageMaxLength: number = 0; // 设置偏移尺寸 setListOffset: (offset: number, animationDuration?: number) => void = (offset: number, animationDuration?: number) => { }; // 切换图片 setListToIndex: (index: number) => void = (index: number) => { }; // 图片旋转信息 @State imageRotateInfo: RotateModel = new RotateModel(); // 图片缩放信息 @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); // 图片默认大小 -- 是转化后的大小 @State imageDefaultSize: image.Size = { width: 0, height: 0 }; // 图片默认大小,即,与屏幕大小最适配的显示大小 // 表示当前图片是根据宽度适配还是高度适配 @State imageWH: ImageFitType = ImageFitType.TYPE_DEFAULT; // 本模块提供矩阵变换功能,可对图形进行平移、旋转和缩放等。 @State matrix: matrix4.Matrix4Transit = matrix4.identity().copy(); // 图片偏移信息 @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); // 记录偏移时控制list的偏移量 @State imageListOffset: number = 0; // 图片原始宽高比 private imageWHRatio: number = 0; // 保存手指移动位置 -- 减少重复触发计算 private eventOffsetX: number = 0; private eventOffsetY: number = 0; // 图片恢复的动画时长 private restImageAnimation: number = 300; /** * 当前是否移动交叉轴 * - 正常拖动可以移动 * - 当拖动时候展示出了下一张 且 展示具体 大于 isMoveMaxOffset 时固定 交叉轴,等到下次释放后再次移动 */ private isMoveCrossAxis: boolean = true; /** * 最大展示下一张图片的距离 * - 为了控制交叉轴的移动 * - 添加这个数值是为了防止在移动 且 图片抵达边缘时 滑动展示下一张图片会立即固定交叉轴无法移动 * - - 有时候移动虽然抵达边缘后会不小心移动到一点点数据但是实际行为不是为了切换照片,但此时交叉轴固定 且 视角中看不到下一个图片被误以为卡住 * - - 添加 30 则为了让抵达边缘后 向next 拓展距离让用户感知到已经在切换图片行为了然后固定交叉轴 * - 30 为可看到 next 图片,良好的距离 */ private moveMaxOffset: 30 = 30; /** * 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 * @param imageWHRatio:图片原始宽高比 * @param size:窗口大小{with:number,height:number} * @returns image.Size */ calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width: number = 0; let height: number = 0; if (imageWHRatio > windowSize.width / windowSize.height) { // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 width = windowSize.width; height = windowSize.width / imageWHRatio; } else { height = windowSize.height; width = windowSize.height * imageWHRatio; } return { width: width, height: height }; } /** * TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 * @param imageSize:图片当前大小 * @param windowSize:窗口大小 * @returns:缩放倍率 */ calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio; } /** * 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue * TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 */ initCurrentImageInfo(event: ImageLoadResult): void { let imageW = event.width; let imageH = event.height; let windowSize = windowSizeManager.get(); // 图片宽高比 this.imageWHRatio = imageW / imageH; // 图片默认大小 this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSize); // 图片宽度 等于 视口宽度 则图片使用宽度适配 否则 使用 高度适配 if (this.imageDefaultSize.width === windowSize.width) { this.imageWH = ImageFitType.TYPE_WIDTH; } else { this.imageWH = ImageFitType.TYPE_HEIGHT; } /** * 1.5 的基本倍数上添加 撑满全屏需要多少倍数 * 1.5 是初始化时候给的值 * 在1.5上面加是为了让图片可以放的更大 */ this.imageScaleInfo.maxScaleValue += this.imageWH === ImageFitType.TYPE_WIDTH ? (windowSize.height / this.imageDefaultSize.height) : (windowSize.width / this.imageDefaultSize.width); } /** * 在图片消失时,将当前图片的信息设置为默认值 */ resetCurrentImageInfo(): void { animateTo({ duration: this.restImageAnimation }, () => { this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); this.imageRotateInfo.reset(); this.matrix = matrix4.identity().copy(); }) } /** * TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 */ evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePercent: this.togglePercent, imageListOffset: this.imageListOffset }); const yBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_HEIGHT, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePercent: this.togglePercent, imageListOffset: this.imageListOffset }); if (this.listDirection === Axis.Horizontal) { if (xBol[0] || xBol[1]) { if (xBol[0]) { this.setListToIndex(this.imageIndex - 1); if (this.imageIndex !== 0) { this.resetCurrentImageInfo(); } } if (xBol[1]) { this.setListToIndex(this.imageIndex + 1); if (this.imageIndex < this.imageMaxLength - 1) { this.resetCurrentImageInfo(); } } } else { this.setListToIndex(this.imageIndex); } } else if (this.listDirection === Axis.Vertical) { if (yBol[0] || yBol[1]) { if (yBol[0]) { this.setListToIndex(this.imageIndex - 1); if (this.imageIndex !== 0) { this.resetCurrentImageInfo(); } } if (yBol[1]) { this.setListToIndex(this.imageIndex + 1); if (this.imageIndex < this.imageMaxLength - 1) { this.resetCurrentImageInfo(); } } } else { this.setListToIndex(this.imageIndex); } } this.imageListOffset = 0; this.isMoveCrossAxis = true; } // 设置交叉轴位置 setCrossAxis(event: GestureEvent) { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue; let listOffset: number = Math.abs(this.imageListOffset); if (listOffset > this.moveMaxOffset) { this.isMoveCrossAxis = false; } if (this.isMoveCrossAxis && isScale) { // 获取交叉轴方向 let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'Y' : 'X'; // 获取交叉轴中对应的是 width 还是 height let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH; // 获取手指在主轴移动偏移量 let offset = event[`offset${direction}`]; // 获取图片最后一次在主轴移动的数据 let lastOffset = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; // 计算当前移动后偏移量结果 let calculatedOffset = lastOffset + offset; // 设置交叉轴数据 this.setCurrentOffsetXY(imageWH, calculatedOffset); } } // 设置主轴位置 setPrincipalAxis(event: GestureEvent) { // 获取主轴方向 let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'X' : 'Y'; // 获取主轴中对应的是 width 还是 height let imageWH: ImageFitType = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; // 获取手指在主轴移动偏移量 let offset: number = event[`offset${direction}`]; // 获取图片最后一次在主轴移动的数据 let lastOffset: number = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; // 获取主轴上图片的尺寸 const IMG_SIZE: number = getImgSize(this.imageDefaultSize, this.imageRotateInfo.lastRotate, imageWH); const WIN_SIZE: window.Size = windowSizeManager.get(); // 获取窗口对应轴的尺寸 const WIN_AXIS_SIZE: number = WIN_SIZE[imageWH]; // 当前最大移动距离 let maxAllowedOffset: number = getMaxAllowedOffset(WIN_AXIS_SIZE, IMG_SIZE, this.imageScaleInfo.scaleValue); // 计算当前移动后偏移量结果 let calculatedOffset: number = lastOffset + offset; if (offset < 0) { // 左滑 if ((this.imageIndex >= this.imageMaxLength - 1) || (calculatedOffset >= -maxAllowedOffset)) { // 当是最后一个元素 或者 当前移动没有抵达边缘时候触发 this.setCurrentOffsetXY(imageWH, calculatedOffset); } } else if (offset > 0) { // 右滑 if ((this.imageIndex === 0) || (calculatedOffset <= maxAllowedOffset)) { // 当是第一个元素 或者 当前移动没有抵达边缘时候触发 this.setCurrentOffsetXY(imageWH, calculatedOffset); } } if ((calculatedOffset > maxAllowedOffset) && (this.imageIndex !== 0)) { // 右滑 -- 当前滑动超过最大值时 并且 不是第一个元素去设置list偏移量显“下一张”图片 let listOffset: number = calculatedOffset - maxAllowedOffset; this.setListOffset(-listOffset) this.imageListOffset = listOffset; } else if ((calculatedOffset < -maxAllowedOffset) && (this.imageIndex < this.imageMaxLength - 1)) { // 左滑 -- 当前滑动超过最大值时 并且 不是最后一个元素去设置list偏移量显“下一张”图片 let listOffset = calculatedOffset + maxAllowedOffset; this.setListOffset(Math.abs(listOffset)); this.imageListOffset = listOffset; } } // 设置对应轴方向的数据 setCurrentOffsetXY(direction: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT, offset: number) { if (direction === ImageFitType.TYPE_WIDTH) { this.imageOffsetInfo.currentX = offset; } else { this.imageOffsetInfo.currentY = offset; } } build() { Stack() { Image(this.imageUrl)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 .id('scale_image') .width(this.imageWH === ImageFitType.TYPE_WIDTH ? $r('app.string.imageviewer_image_default_width') : undefined) .height(this.imageWH === ImageFitType.TYPE_HEIGHT ? $r('app.string.imageviewer_image_default_height') : undefined) .aspectRatio(this.imageWHRatio) .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 .autoResize(false) .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 .defaultFocus(true) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .offset({ // TODO:知识点:通过offset控制图片的偏移 x: this.imageOffsetInfo.currentX, y: this.imageOffsetInfo.currentY }) .onComplete((event: ImageLoadResult) => { if (event) { this.initCurrentImageInfo(event); } }) } .alignContent(Alignment.Center) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .width($r('app.string.imageviewer_image_item_stack_width')) .height($r('app.string.imageviewer_image_item_stack_height')) .gesture( GestureGroup( GestureMode.Parallel, // 双击切换图片大小 TapGesture({ count: 2 }) .onAction(() => { let fn: Function; // 当前大小倍数 大于 默认的倍数,则是放大状态需要缩小 if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) { fn = () => { // 恢复默认大小 this.imageScaleInfo.reset(); // 重置偏移量 this.imageOffsetInfo.reset(); // 设置一个新的矩阵 this.matrix = matrix4.identity().copy().rotate({ z: 1, angle: this.imageRotateInfo.lastRotate }); } } else { fn = () => { // 这里是正常状态 -- 需要放大 // 获取放大倍数 const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get()); // 设置当前放大倍数 this.imageScaleInfo.scaleValue = ratio; // 重置偏移量 this.imageOffsetInfo.reset(); // 设置矩阵元素 this.matrix = matrix4.identity().scale({ x: ratio, y: ratio, }).rotate({ z: 1, angle: this.imageRotateInfo.lastRotate }).copy(); // 设置最后放大倍数设置为当前的倍数 this.imageScaleInfo.stash(); } } runWithAnimation(fn); }), // 拖动图片 PanGesture({ fingers: 1 }) .onActionUpdate((event: GestureEvent) => { if (this.imageWH != ImageFitType.TYPE_DEFAULT) { if (this.eventOffsetX != event.offsetX || event.offsetY != this.eventOffsetY) { this.eventOffsetX = event.offsetX; this.eventOffsetY = event.offsetY; this.setCrossAxis(event); this.setPrincipalAxis(event); } } }) .onActionEnd((event: GestureEvent) => { this.imageOffsetInfo.stash(); this.evaluateBound(); }), // 两根手指操作 // 双指旋转图片 RotationGesture({ angle: this.imageRotateInfo.startAngle }) .onActionUpdate((event: GestureEvent) => { let angle: number = this.imageRotateInfo.lastRotate + event.angle; if (event.angle > 0) { angle -= this.imageRotateInfo.startAngle; } else { angle += this.imageRotateInfo.startAngle; } this.matrix = matrix4.identity() .scale({ x: this.imageScaleInfo.scaleValue, y: this.imageScaleInfo.scaleValue }) .rotate({ x: 0, y: 0, z: 1, angle: angle, }).copy(); this.imageRotateInfo.currentRotate = angle; }) .onActionEnd((event: GestureEvent) => { let rotate = simplestRotationQuarter(this.imageRotateInfo.currentRotate); runWithAnimation(() => { this.imageRotateInfo.currentRotate = rotate; this.matrix = matrix4.identity() .rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); this.imageRotateInfo.stash(); this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); }) }), // TODO:知识点:双指捏合缩放图片 PinchGesture({ fingers: 2, distance: 1 }) .onActionUpdate((event: GestureEvent) => { let scale: number = this.imageScaleInfo.lastValue * event.scale; // TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验4 if (scale > this.imageScaleInfo.maxScaleValue * (1 + this.imageScaleInfo.extraScaleValue) ) { scale = this.imageScaleInfo.maxScaleValue * (1 + this.imageScaleInfo.extraScaleValue); } if (scale < this.imageScaleInfo.defaultScaleValue * (1 - this.imageScaleInfo.extraScaleValue)) { scale = this.imageScaleInfo.defaultScaleValue * (1 - this.imageScaleInfo.extraScaleValue); } // 当前最终的缩放比例 * 当前手指缩放比例 = 当前图片的缩放比例 this.imageScaleInfo.scaleValue = scale; // TODO:知识点:matrix默认缩放中心为组件中心 this.matrix = matrix4.identity().scale({ x: this.imageScaleInfo.scaleValue, y: this.imageScaleInfo.scaleValue, }).rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); }) .onActionEnd((event: GestureEvent) => { // TODO:知识点:当小于默认大小时,恢复为默认大小4 if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) { runWithAnimation(() => { this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); this.matrix = matrix4.identity().rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); }) } // TODO:知识点:当大于最大缩放因子时,恢复到最大 if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) { runWithAnimation(() => { this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue; this.matrix = matrix4.identity() .scale({ x: this.imageScaleInfo.maxScaleValue, y: this.imageScaleInfo.maxScaleValue }).rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }); }) } this.imageScaleInfo.stash(); }) ) ) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct PicturePreviewImage AST#component_body#Left { // 当前背景色 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right listBGColor : AST#type_annotation#Left AST#primary_type#Left Color AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 图片显示的地址 AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Prop AST#decorator#Right imageUrl : 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 @ Require AST#decorator#Right AST#decorator#Left @ Prop AST#decorator#Right listDirection : AST#type_annotation#Left AST#primary_type#Left Axis AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 图片滑动多大距离需要切换图片 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right togglePercent : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.2 AST#expression#Right ; AST#property_declaration#Right // 当前图片下标 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right imageIndex : 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 AST#decorator#Left @ Prop AST#decorator#Right imageMaxLength : 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 setListOffset : AST#type_annotation#Left AST#function_type#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 animationDuration ? : 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 offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left animationDuration ? : 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#property_declaration#Left setListToIndex : AST#type_annotation#Left AST#function_type#Left 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_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 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right // 图片旋转信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageRotateInfo : AST#type_annotation#Left AST#primary_type#Left RotateModel 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 RotateModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 图片缩放信息 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageScaleInfo : AST#type_annotation#Left AST#primary_type#Left ScaleModel 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 ScaleModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1.0 AST#expression#Right , AST#expression#Left 1.0 AST#expression#Right , AST#expression#Left 1.5 AST#expression#Right , AST#expression#Left 0.3 AST#expression#Right ) 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 imageDefaultSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size 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 width AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right // 图片默认大小,即,与屏幕大小最适配的显示大小 // 表示当前图片是根据宽度适配还是高度适配 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageWH : AST#type_annotation#Left AST#primary_type#Left ImageFitType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_DEFAULT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 本模块提供矩阵变换功能,可对图形进行平移、旋转和缩放等。 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right matrix : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . Matrix4Transit 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . copy 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 imageOffsetInfo : AST#type_annotation#Left AST#primary_type#Left OffsetModel 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 OffsetModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 记录偏移时控制list的偏移量 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imageListOffset : 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 private imageWHRatio : 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 private eventOffsetX : 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 private eventOffsetY : 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 private restImageAnimation : 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 /** * 当前是否移动交叉轴 * - 正常拖动可以移动 * - 当拖动时候展示出了下一张 且 展示具体 大于 isMoveMaxOffset 时固定 交叉轴,等到下次释放后再次移动 */ AST#property_declaration#Left private isMoveCrossAxis : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 最大展示下一张图片的距离 * - 为了控制交叉轴的移动 * - 添加这个数值是为了防止在移动 且 图片抵达边缘时 滑动展示下一张图片会立即固定交叉轴无法移动 * - - 有时候移动虽然抵达边缘后会不小心移动到一点点数据但是实际行为不是为了切换照片,但此时交叉轴固定 且 视角中看不到下一个图片被误以为卡住 * - - 添加 30 则为了让抵达边缘后 向next 拓展距离让用户感知到已经在切换图片行为了然后固定交叉轴 * - 30 为可看到 next 图片,良好的距离 */ AST#property_declaration#Left private moveMaxOffset AST#ERROR#Left : 30 AST#ERROR#Right = AST#expression#Left 30 AST#expression#Right ; AST#property_declaration#Right /** * 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 * @param imageWHRatio:图片原始宽高比 * @param size:窗口大小{with:number,height:number} * @returns image.Size */ AST#method_declaration#Left calcImageDefaultSize AST#parameter_list#Left ( AST#parameter#Left imageWHRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size 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#qualified_type#Left image . Size AST#qualified_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 width : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left imageWHRatio AST#expression#Right > AST#expression#Left windowSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left windowSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . height 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 width = AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left height = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left imageWHRatio 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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left height = AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left width = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right * AST#expression#Left imageWHRatio 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#block_statement#Right AST#if_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 width AST#property_name#Right : AST#expression#Left width AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left height AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 * @param imageSize:图片当前大小 * @param windowSize:窗口大小 * @returns:缩放倍率 */ AST#method_declaration#Left calcFitScaleRatio AST#parameter_list#Left ( AST#parameter#Left imageSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ratio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1.0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right > AST#expression#Left imageSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width 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 ratio = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left imageSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left ratio = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left imageSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left ratio AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue * TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 */ AST#method_declaration#Left initCurrentImageInfo AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ImageLoadResult 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 imageW = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . width 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 imageH = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowSize = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSizeManager AST#expression#Right . get 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 . imageWHRatio AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left imageW AST#expression#Right / AST#expression#Left imageH 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 . imageDefaultSize AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calcImageDefaultSize 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 . imageWHRatio AST#member_expression#Right AST#expression#Right , AST#expression#Left windowSize AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 图片宽度 等于 视口宽度 则图片使用宽度适配 否则 使用 高度适配 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . imageDefaultSize AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right === AST#expression#Left windowSize AST#expression#Right AST#binary_expression#Right AST#expression#Right . width 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 . imageWH AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_WIDTH 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 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 . imageWH AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_HEIGHT 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 /** * 1.5 的基本倍数上添加 撑满全屏需要多少倍数 * 1.5 是初始化时候给的值 * 在1.5上面加是为了让图片可以放的更大 */ AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue AST#member_expression#Right += AST#expression#Left AST#conditional_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 . imageWH AST#member_expression#Right AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? 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 windowSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageDefaultSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : 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 windowSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageDefaultSize AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#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#block_statement#Right AST#method_declaration#Right /** * 在图片消失时,将当前图片的信息设置为默认值 */ AST#method_declaration#Left resetCurrentImageInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . restImageAnimation AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right , AST#ERROR#Right AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . reset 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 */ AST#method_declaration#Left evaluateBound AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left xBol = AST#expression#Left AST#call_expression#Left AST#expression#Left constrainOffsetAndAnimation AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dimensionWH AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageDefaultSize AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageDefaultSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageOffsetInfo AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left scaleValue AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left rotate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left togglePercent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . togglePercent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageListOffset AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageListOffset 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left yBol = AST#expression#Left AST#call_expression#Left AST#expression#Left constrainOffsetAndAnimation AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dimensionWH AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageDefaultSize AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageDefaultSize AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageOffsetInfo AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left scaleValue AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left rotate AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left togglePercent AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . togglePercent AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left imageListOffset AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageListOffset 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal 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#subscript_expression#Left AST#expression#Left xBol AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left AST#subscript_expression#Left AST#expression#Left xBol AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left xBol 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setListToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_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#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 . imageIndex 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 . resetCurrentImageInfo 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left xBol AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 . setListToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageMaxLength AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 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 . resetCurrentImageInfo 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#if_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 this AST#expression#Right . setListToIndex 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 . imageIndex AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Vertical 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#subscript_expression#Left AST#expression#Left yBol AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left AST#subscript_expression#Left AST#expression#Left yBol AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left yBol 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setListToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_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#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 . imageIndex 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 . resetCurrentImageInfo 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left yBol AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 . setListToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageMaxLength AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 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 . resetCurrentImageInfo 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#if_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 this AST#expression#Right . setListToIndex 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 . imageIndex AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_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 . imageListOffset AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isMoveCrossAxis 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#method_declaration#Right // 设置交叉轴位置 AST#method_declaration#Left setCrossAxis 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 { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isScale : AST#type_annotation#Left AST#primary_type#Left boolean 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 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 . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue 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 listOffset : 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 Math AST#expression#Right . abs 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 . imageListOffset 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left listOffset AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . moveMaxOffset 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 . isMoveCrossAxis AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#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 . isMoveCrossAxis AST#member_expression#Right AST#expression#Right && AST#expression#Left isScale 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 direction AST#ERROR#Left : 'X' | 'Y' AST#ERROR#Right = AST#expression#Left AST#conditional_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 . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left 'Y' AST#expression#Right : AST#expression#Left 'X' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取交叉轴中对应的是 width 还是 height AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageWH = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right : AST#expression#Left ImageFitType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . TYPE_WIDTH 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 offset = AST#expression#Left AST#subscript_expression#Left AST#expression#Left event AST#expression#Right [ AST#expression#Left AST#template_literal#Left ` offset AST#template_substitution#Left $ { AST#expression#Left direction AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取图片最后一次在主轴移动的数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lastOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left imageWH AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastX AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastY 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 calculatedOffset = AST#expression#Left AST#binary_expression#Left AST#expression#Left lastOffset AST#expression#Right + AST#expression#Left offset 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 this AST#expression#Right . setCurrentOffsetXY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageWH AST#expression#Right , AST#expression#Left calculatedOffset 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#method_declaration#Right // 设置主轴位置 AST#method_declaration#Left setPrincipalAxis 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#variable_declaration#Left let AST#variable_declarator#Left direction AST#ERROR#Left : 'X' | 'Y' AST#ERROR#Right = AST#expression#Left AST#conditional_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 . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left 'X' AST#expression#Right : AST#expression#Left 'Y' AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取主轴中对应的是 width 还是 height AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageWH : AST#type_annotation#Left AST#primary_type#Left ImageFitType AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listDirection AST#member_expression#Right AST#expression#Right === AST#expression#Left Axis AST#expression#Right AST#binary_expression#Right AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right : AST#expression#Left ImageFitType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取手指在主轴移动偏移量 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left event AST#expression#Right [ AST#expression#Left AST#template_literal#Left ` offset AST#template_substitution#Left $ { AST#expression#Left direction AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取图片最后一次在主轴移动的数据 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left lastOffset : AST#type_annotation#Left AST#primary_type#Left number 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 AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left imageWH AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastX AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . lastY AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取主轴上图片的尺寸 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left IMG_SIZE : 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 getImgSize AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageDefaultSize AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate AST#member_expression#Right AST#expression#Right , AST#expression#Left imageWH 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 WIN_SIZE : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size 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 windowSizeManager AST#expression#Right . get 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 WIN_AXIS_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#subscript_expression#Left AST#expression#Left WIN_SIZE AST#expression#Right [ AST#expression#Left imageWH AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 当前最大移动距离 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left maxAllowedOffset : 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 getMaxAllowedOffset AST#expression#Right AST#argument_list#Left ( AST#expression#Left WIN_AXIS_SIZE AST#expression#Right , AST#expression#Left IMG_SIZE AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue 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 calculatedOffset : 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 lastOffset AST#expression#Right + AST#expression#Left offset 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 offset 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#if_statement#Left if ( 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_expression#Right AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageMaxLength AST#member_expression#Right 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#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left calculatedOffset AST#expression#Right >= AST#expression#Left AST#unary_expression#Left - AST#expression#Left maxAllowedOffset AST#expression#Right AST#unary_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#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 . setCurrentOffsetXY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageWH AST#expression#Right , AST#expression#Left calculatedOffset 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#binary_expression#Left AST#expression#Left offset 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#if_statement#Left if ( 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 . imageIndex 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 calculatedOffset AST#expression#Right <= AST#expression#Left maxAllowedOffset 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setCurrentOffsetXY AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imageWH AST#expression#Right , AST#expression#Left calculatedOffset 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#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#binary_expression#Left AST#expression#Left calculatedOffset AST#expression#Right > AST#expression#Left maxAllowedOffset 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 this AST#expression#Right . imageIndex 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#block_statement#Left { // 右滑 -- 当前滑动超过最大值时 并且 不是第一个元素去设置list偏移量显“下一张”图片 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listOffset : 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 calculatedOffset AST#expression#Right - AST#expression#Left maxAllowedOffset 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 this AST#expression#Right . setListOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#unary_expression#Left - AST#expression#Left listOffset 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageListOffset AST#member_expression#Right = AST#expression#Left listOffset 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#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left calculatedOffset AST#expression#Right < AST#expression#Left AST#unary_expression#Left - AST#expression#Left maxAllowedOffset AST#expression#Right AST#unary_expression#Right 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageIndex AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageMaxLength AST#member_expression#Right 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 { // 左滑 -- 当前滑动超过最大值时 并且 不是最后一个元素去设置list偏移量显“下一张”图片 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left listOffset = AST#expression#Left AST#binary_expression#Left AST#expression#Left calculatedOffset AST#expression#Right + AST#expression#Left maxAllowedOffset 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 this AST#expression#Right . setListOffset 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 listOffset AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageListOffset AST#member_expression#Right = AST#expression#Left listOffset 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 设置对应轴方向的数据 AST#method_declaration#Left setCurrentOffsetXY AST#parameter_list#Left ( AST#parameter#Left direction : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left ImageFitType . TYPE_WIDTH AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left ImageFitType . TYPE_HEIGHT AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , 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_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left direction AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . currentX AST#member_expression#Right = AST#expression#Left offset AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . currentY AST#member_expression#Right = AST#expression#Left offset AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageUrl AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right // TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 AST#modifier_chain_expression#Left . id ( AST#expression#Left 'scale_image' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageWH AST#member_expression#Right AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.imageviewer_image_default_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageWH AST#member_expression#Right AST#expression#Right === AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.imageviewer_image_default_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left undefined AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageWHRatio AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Cover AST#member_expression#Right AST#expression#Right ) // TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 AST#modifier_chain_expression#Left . autoResize ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . transform ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right AST#expression#Right ) // TODO:知识点:通过matrix控制图片的缩放 AST#modifier_chain_expression#Left . defaultFocus ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) 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 . TOP AST#member_expression#Right AST#expression#Right , 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#Left . offset ( AST#expression#Left AST#object_literal#Left { // TODO:知识点:通过offset控制图片的偏移 AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . currentX 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#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . currentY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onComplete ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ImageLoadResult 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 event 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 . initCurrentImageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#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#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 . alignContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) 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 . TOP AST#member_expression#Right AST#expression#Right , 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#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.imageviewer_image_item_stack_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.imageviewer_image_item_stack_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . gesture ( AST#expression#Left AST#call_expression#Left AST#expression#Left GestureGroup AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left GestureMode AST#expression#Right . Parallel AST#member_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 TapGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left count AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onAction AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left fn : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 当前大小倍数 大于 默认的倍数,则是放大状态需要缩小 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue 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 fn = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 恢复默认大小 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 重置偏移量 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . reset 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . rotate 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 z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate 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#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#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 fn = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 这里是正常状态 -- 需要放大 // 获取放大倍数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ratio : 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 this AST#expression#Right . calcFitScaleRatio 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 . imageDefaultSize AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowSizeManager AST#expression#Right . get 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right = AST#expression#Left ratio 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 . imageOffsetInfo AST#member_expression#Right AST#expression#Right . reset 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . scale 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 x AST#property_name#Right : AST#expression#Left ratio AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left ratio 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 . rotate 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 z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate 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 . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 设置最后放大倍数设置为当前的倍数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . stash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#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#call_expression#Left AST#expression#Left runWithAnimation AST#expression#Right AST#argument_list#Left ( AST#expression#Left fn 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#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 PanGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fingers AST#property_name#Right : AST#expression#Left 1 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 . 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#member_expression#Left AST#expression#Left this AST#expression#Right . imageWH AST#member_expression#Right AST#expression#Right != AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_DEFAULT AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . eventOffsetX AST#member_expression#Right AST#expression#Right != AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . offsetX AST#member_expression#Right AST#expression#Right || AST#expression#Left event AST#expression#Right AST#binary_expression#Right 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 . eventOffsetY 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 . eventOffsetX AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . offsetX 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 . eventOffsetY 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#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 . setCrossAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setPrincipalAxis AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left event 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#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#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 . imageOffsetInfo AST#member_expression#Right AST#expression#Right . stash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . evaluateBound AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , // 两根手指操作 // 双指旋转图片 AST#expression#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 RotationGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . startAngle 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 . 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#variable_declaration#Left let AST#variable_declarator#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . lastRotate AST#member_expression#Right AST#expression#Right + AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . angle AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . angle 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#assignment_expression#Left angle -= AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . startAngle 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 else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left angle += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . startAngle 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . scale 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 x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue 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#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue 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 . rotate 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 x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left angle 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 . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate AST#member_expression#Right = AST#expression#Left angle 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 . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#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#variable_declaration#Left let AST#variable_declarator#Left rotate = AST#expression#Left AST#call_expression#Left AST#expression#Left simplestRotationQuarter 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 . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate 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 runWithAnimation AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate AST#member_expression#Right = AST#expression#Left rotate 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 . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . rotate 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 x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate 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 . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . stash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , // TODO:知识点:双指捏合缩放图片 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 PinchGesture AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fingers AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left distance AST#property_name#Right : AST#expression#Left 1 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 . 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#variable_declaration#Left let AST#variable_declarator#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . lastValue AST#member_expression#Right AST#expression#Right * AST#expression#Left event AST#expression#Right AST#binary_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验4 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 scale AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue AST#member_expression#Right AST#expression#Right * 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 1 AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . extraScaleValue AST#member_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 scale = 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 . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue AST#member_expression#Right AST#expression#Right * 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 1 AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . extraScaleValue AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left scale AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue AST#member_expression#Right AST#expression#Right * 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 1 AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . extraScaleValue AST#member_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 scale = 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 . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue AST#member_expression#Right AST#expression#Right * 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 1 AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . extraScaleValue AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 当前最终的缩放比例 * 当前手指缩放比例 = 当前图片的缩放比例 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right = AST#expression#Left scale AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // TODO:知识点:matrix默认缩放中心为组件中心 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 . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . scale 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 x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue 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#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue 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 . rotate 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 x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate 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 . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . onActionEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#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 { // TODO:知识点:当小于默认大小时,恢复为默认大小4 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . defaultScaleValue 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 runWithAnimation 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . reset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageOffsetInfo AST#member_expression#Right AST#expression#Right . reset 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . rotate 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 x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate 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 . copy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // TODO:知识点:当大于最大缩放因子时,恢复到最大 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right AST#expression#Right > AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue 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 runWithAnimation AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . scaleValue AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue 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 . matrix AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left matrix4 AST#expression#Right . identity AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . scale 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 x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue 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#member_expression#Left AST#expression#Left this AST#expression#Right . imageScaleInfo AST#member_expression#Right AST#expression#Right . maxScaleValue 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 . rotate 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 x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left z AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageRotateInfo AST#member_expression#Right AST#expression#Right . currentRotate 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#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . imageScaleInfo AST#member_expression#Right AST#expression#Right . stash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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#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
@Reusable @Component export struct PicturePreviewImage { @Link listBGColor: Color; @Require @Prop imageUrl: string = ''; @Require @Prop listDirection: Axis; @Prop togglePercent: number = 0.2; @Prop imageIndex: number = 0; @Prop imageMaxLength: number = 0; setListOffset: (offset: number, animationDuration?: number) => void = (offset: number, animationDuration?: number) => { }; setListToIndex: (index: number) => void = (index: number) => { }; @State imageRotateInfo: RotateModel = new RotateModel(); @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); @State imageDefaultSize: image.Size = { width: 0, height: 0 }; @State imageWH: ImageFitType = ImageFitType.TYPE_DEFAULT; @State matrix: matrix4.Matrix4Transit = matrix4.identity().copy(); @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); @State imageListOffset: number = 0; private imageWHRatio: number = 0; private eventOffsetX: number = 0; private eventOffsetY: number = 0; private restImageAnimation: number = 300; private isMoveCrossAxis: boolean = true; private moveMaxOffset: 30 = 30; calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width: number = 0; let height: number = 0; if (imageWHRatio > windowSize.width / windowSize.height) { width = windowSize.width; height = windowSize.width / imageWHRatio; } else { height = windowSize.height; width = windowSize.height * imageWHRatio; } return { width: width, height: height }; } calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { let ratio: number = 1.0; if (windowSize.width > imageSize.width) { ratio = windowSize.width / imageSize.width; } else { ratio = windowSize.height / imageSize.height; } return ratio; } initCurrentImageInfo(event: ImageLoadResult): void { let imageW = event.width; let imageH = event.height; let windowSize = windowSizeManager.get(); this.imageWHRatio = imageW / imageH; this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSize); if (this.imageDefaultSize.width === windowSize.width) { this.imageWH = ImageFitType.TYPE_WIDTH; } else { this.imageWH = ImageFitType.TYPE_HEIGHT; } this.imageScaleInfo.maxScaleValue += this.imageWH === ImageFitType.TYPE_WIDTH ? (windowSize.height / this.imageDefaultSize.height) : (windowSize.width / this.imageDefaultSize.width); } resetCurrentImageInfo(): void { animateTo({ duration: this.restImageAnimation }, () => { this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); this.imageRotateInfo.reset(); this.matrix = matrix4.identity().copy(); }) } evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePercent: this.togglePercent, imageListOffset: this.imageListOffset }); const yBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_HEIGHT, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePercent: this.togglePercent, imageListOffset: this.imageListOffset }); if (this.listDirection === Axis.Horizontal) { if (xBol[0] || xBol[1]) { if (xBol[0]) { this.setListToIndex(this.imageIndex - 1); if (this.imageIndex !== 0) { this.resetCurrentImageInfo(); } } if (xBol[1]) { this.setListToIndex(this.imageIndex + 1); if (this.imageIndex < this.imageMaxLength - 1) { this.resetCurrentImageInfo(); } } } else { this.setListToIndex(this.imageIndex); } } else if (this.listDirection === Axis.Vertical) { if (yBol[0] || yBol[1]) { if (yBol[0]) { this.setListToIndex(this.imageIndex - 1); if (this.imageIndex !== 0) { this.resetCurrentImageInfo(); } } if (yBol[1]) { this.setListToIndex(this.imageIndex + 1); if (this.imageIndex < this.imageMaxLength - 1) { this.resetCurrentImageInfo(); } } } else { this.setListToIndex(this.imageIndex); } } this.imageListOffset = 0; this.isMoveCrossAxis = true; } setCrossAxis(event: GestureEvent) { let isScale: boolean = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue; let listOffset: number = Math.abs(this.imageListOffset); if (listOffset > this.moveMaxOffset) { this.isMoveCrossAxis = false; } if (this.isMoveCrossAxis && isScale) { let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'Y' : 'X'; let imageWH = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH; let offset = event[`offset${direction}`]; let lastOffset = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; let calculatedOffset = lastOffset + offset; this.setCurrentOffsetXY(imageWH, calculatedOffset); } } setPrincipalAxis(event: GestureEvent) { let direction: 'X' | 'Y' = this.listDirection === Axis.Horizontal ? 'X' : 'Y'; let imageWH: ImageFitType = this.listDirection === Axis.Horizontal ? ImageFitType.TYPE_WIDTH : ImageFitType.TYPE_HEIGHT; let offset: number = event[`offset${direction}`]; let lastOffset: number = imageWH === ImageFitType.TYPE_WIDTH ? this.imageOffsetInfo.lastX : this.imageOffsetInfo.lastY; const IMG_SIZE: number = getImgSize(this.imageDefaultSize, this.imageRotateInfo.lastRotate, imageWH); const WIN_SIZE: window.Size = windowSizeManager.get(); const WIN_AXIS_SIZE: number = WIN_SIZE[imageWH]; let maxAllowedOffset: number = getMaxAllowedOffset(WIN_AXIS_SIZE, IMG_SIZE, this.imageScaleInfo.scaleValue); let calculatedOffset: number = lastOffset + offset; if (offset < 0) { if ((this.imageIndex >= this.imageMaxLength - 1) || (calculatedOffset >= -maxAllowedOffset)) { this.setCurrentOffsetXY(imageWH, calculatedOffset); } } else if (offset > 0) { if ((this.imageIndex === 0) || (calculatedOffset <= maxAllowedOffset)) { this.setCurrentOffsetXY(imageWH, calculatedOffset); } } if ((calculatedOffset > maxAllowedOffset) && (this.imageIndex !== 0)) { -- 当前滑动超过最大值时 并且 不是第一个元素去设置list偏移量显“下一张”图片 let listOffset: number = calculatedOffset - maxAllowedOffset; this.setListOffset(-listOffset) this.imageListOffset = listOffset; } else if ((calculatedOffset < -maxAllowedOffset) && (this.imageIndex < this.imageMaxLength - 1)) { -- 当前滑动超过最大值时 并且 不是最后一个元素去设置list偏移量显“下一张”图片 let listOffset = calculatedOffset + maxAllowedOffset; this.setListOffset(Math.abs(listOffset)); this.imageListOffset = listOffset; } } setCurrentOffsetXY(direction: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT, offset: number) { if (direction === ImageFitType.TYPE_WIDTH) { this.imageOffsetInfo.currentX = offset; } else { this.imageOffsetInfo.currentY = offset; } } build() { Stack() { Image(this.imageUrl) .id('scale_image') .width(this.imageWH === ImageFitType.TYPE_WIDTH ? $r('app.string.imageviewer_image_default_width') : undefined) .height(this.imageWH === ImageFitType.TYPE_HEIGHT ? $r('app.string.imageviewer_image_default_height') : undefined) .aspectRatio(this.imageWHRatio) .objectFit(ImageFit.Cover) .autoResize(false) .transform(this.matrix) .defaultFocus(true) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .offset({ x: this.imageOffsetInfo.currentX, y: this.imageOffsetInfo.currentY }) .onComplete((event: ImageLoadResult) => { if (event) { this.initCurrentImageInfo(event); } }) } .alignContent(Alignment.Center) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) .width($r('app.string.imageviewer_image_item_stack_width')) .height($r('app.string.imageviewer_image_item_stack_height')) .gesture( GestureGroup( GestureMode.Parallel, TapGesture({ count: 2 }) .onAction(() => { let fn: Function; if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) { fn = () => { this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); this.matrix = matrix4.identity().copy().rotate({ z: 1, angle: this.imageRotateInfo.lastRotate }); } } else { fn = () => { const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get()); this.imageScaleInfo.scaleValue = ratio; this.imageOffsetInfo.reset(); this.matrix = matrix4.identity().scale({ x: ratio, y: ratio, }).rotate({ z: 1, angle: this.imageRotateInfo.lastRotate }).copy(); this.imageScaleInfo.stash(); } } runWithAnimation(fn); }), PanGesture({ fingers: 1 }) .onActionUpdate((event: GestureEvent) => { if (this.imageWH != ImageFitType.TYPE_DEFAULT) { if (this.eventOffsetX != event.offsetX || event.offsetY != this.eventOffsetY) { this.eventOffsetX = event.offsetX; this.eventOffsetY = event.offsetY; this.setCrossAxis(event); this.setPrincipalAxis(event); } } }) .onActionEnd((event: GestureEvent) => { this.imageOffsetInfo.stash(); this.evaluateBound(); }), RotationGesture({ angle: this.imageRotateInfo.startAngle }) .onActionUpdate((event: GestureEvent) => { let angle: number = this.imageRotateInfo.lastRotate + event.angle; if (event.angle > 0) { angle -= this.imageRotateInfo.startAngle; } else { angle += this.imageRotateInfo.startAngle; } this.matrix = matrix4.identity() .scale({ x: this.imageScaleInfo.scaleValue, y: this.imageScaleInfo.scaleValue }) .rotate({ x: 0, y: 0, z: 1, angle: angle, }).copy(); this.imageRotateInfo.currentRotate = angle; }) .onActionEnd((event: GestureEvent) => { let rotate = simplestRotationQuarter(this.imageRotateInfo.currentRotate); runWithAnimation(() => { this.imageRotateInfo.currentRotate = rotate; this.matrix = matrix4.identity() .rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); this.imageRotateInfo.stash(); this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); }) }), PinchGesture({ fingers: 2, distance: 1 }) .onActionUpdate((event: GestureEvent) => { let scale: number = this.imageScaleInfo.lastValue * event.scale; if (scale > this.imageScaleInfo.maxScaleValue * (1 + this.imageScaleInfo.extraScaleValue) ) { scale = this.imageScaleInfo.maxScaleValue * (1 + this.imageScaleInfo.extraScaleValue); } if (scale < this.imageScaleInfo.defaultScaleValue * (1 - this.imageScaleInfo.extraScaleValue)) { scale = this.imageScaleInfo.defaultScaleValue * (1 - this.imageScaleInfo.extraScaleValue); } this.imageScaleInfo.scaleValue = scale; this.matrix = matrix4.identity().scale({ x: this.imageScaleInfo.scaleValue, y: this.imageScaleInfo.scaleValue, }).rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); }) .onActionEnd((event: GestureEvent) => { if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) { runWithAnimation(() => { this.imageScaleInfo.reset(); this.imageOffsetInfo.reset(); this.matrix = matrix4.identity().rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }).copy(); }) } if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) { runWithAnimation(() => { this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue; this.matrix = matrix4.identity() .scale({ x: this.imageScaleInfo.maxScaleValue, y: this.imageScaleInfo.maxScaleValue }).rotate({ x: 0, y: 0, z: 1, angle: this.imageRotateInfo.currentRotate, }); }) } this.imageScaleInfo.stash(); }) ) ) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L48-L521
6a99bf919b45c221d3978e87a4d00245136befd0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets
arkts
需要更新的商品数据
export let targetItemList: ThirdGoodsItem[] = [ new ThirdGoodsItem($r("app.media.variablewatch_strawberry"), '价格5'), new ThirdGoodsItem($r("app.media.variablewatch_banana"), '价格6'), new ThirdGoodsItem($r("app.media.variablewatch_apple"), '价格7'), new ThirdGoodsItem($r("app.media.variablewatch_mango"), '价格8') ] /** * 初始商品数据 */
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left targetItemList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ThirdGoodsItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ThirdGoodsItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.variablewatch_strawberry" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '价格5' 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#new_expression#Left new AST#expression#Left ThirdGoodsItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.variablewatch_banana" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '价格6' 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#new_expression#Left new AST#expression#Left ThirdGoodsItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.variablewatch_apple" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '价格7' 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#new_expression#Left new AST#expression#Left ThirdGoodsItem AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.variablewatch_mango" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '价格8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right /** * 初始商品数据 */ AST#variable_declaration#Right AST#export_declaration#Right
export let targetItemList: ThirdGoodsItem[] = [ new ThirdGoodsItem($r("app.media.variablewatch_strawberry"), '价格5'), new ThirdGoodsItem($r("app.media.variablewatch_banana"), '价格6'), new ThirdGoodsItem($r("app.media.variablewatch_apple"), '价格7'), new ThirdGoodsItem($r("app.media.variablewatch_mango"), '价格8') ]
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/src/main/ets/model/GoodsModel.ets#L61-L70
d04b5eeff5baeaf6c2dcb758489aac26b7ec69bb
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Performance/ConcurrentModule/entry/src/main/ets/fileFs/MyWorker.ets
arkts
readyFilesToWorker
worker file
readyFilesToWorker(): void { let content = CONTENT + CONTENT + new Date() + '\n'; let workerDir = this.baseDir + '/workerDir'; try { if (!fs.accessSync(workerDir)) { fs.mkdirSync(workerDir); } Logger.info(TAG, 'readyFilesToWorker dpath = ' + workerDir); for (let i = 0; i < FILE_NUM; i++) { let myFile = ''; if (i < FILE_NUMBER) { myFile = workerDir + `/TestFile0${i + 1}.txt`; } else { myFile = workerDir + `/TestFile${i + 1}.txt`; } Logger.info(TAG, 'readyFilesToWorker myFile = ' + myFile); let file = fs.openSync(myFile, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); fs.writeSync(file.fd, content); fs.closeSync(file); } Logger.info(TAG, 'readyFilesToWorker successful'); } catch (e) { Logger.error(TAG, `readyFilesToWorker has failed for: {message: ${(e as Error).message}, ${e}}`); } }
AST#method_declaration#Left readyFilesToWorker AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left content = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left CONTENT AST#expression#Right + AST#expression#Left CONTENT AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left '\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left workerDir = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . baseDir AST#member_expression#Right AST#expression#Right + AST#expression#Left '/workerDir' 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#try_statement#Left try 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#unary_expression#Left ! AST#expression#Left fs AST#expression#Right AST#unary_expression#Right AST#expression#Right . accessSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left workerDir 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 fs AST#expression#Right . mkdirSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left workerDir 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'readyFilesToWorker dpath = ' AST#expression#Right + AST#expression#Left workerDir AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 FILE_NUM 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#variable_declaration#Left let AST#variable_declarator#Left myFile = AST#expression#Left '' 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 i AST#expression#Right < AST#expression#Left FILE_NUMBER 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 myFile = AST#expression#Left AST#binary_expression#Left AST#expression#Left workerDir AST#expression#Right + AST#expression#Left AST#template_literal#Left ` /TestFile0 AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right .txt ` AST#template_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#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left myFile = AST#expression#Left AST#binary_expression#Left AST#expression#Left workerDir AST#expression#Right + AST#expression#Left AST#template_literal#Left ` /TestFile AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right .txt ` AST#template_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#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'readyFilesToWorker myFile = ' AST#expression#Right + AST#expression#Left myFile AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let 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 myFile 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 fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . CREATE AST#member_expression#Right AST#expression#Right | AST#expression#Left fs AST#expression#Right AST#binary_expression#Right AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_WRITE 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 fs AST#expression#Right . writeSync 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 content 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 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#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'readyFilesToWorker successful' 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` readyFilesToWorker has failed for: {message: AST#template_substitution#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 e AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Error AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left e 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
readyFilesToWorker(): void { let content = CONTENT + CONTENT + new Date() + '\n'; let workerDir = this.baseDir + '/workerDir'; try { if (!fs.accessSync(workerDir)) { fs.mkdirSync(workerDir); } Logger.info(TAG, 'readyFilesToWorker dpath = ' + workerDir); for (let i = 0; i < FILE_NUM; i++) { let myFile = ''; if (i < FILE_NUMBER) { myFile = workerDir + `/TestFile0${i + 1}.txt`; } else { myFile = workerDir + `/TestFile${i + 1}.txt`; } Logger.info(TAG, 'readyFilesToWorker myFile = ' + myFile); let file = fs.openSync(myFile, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); fs.writeSync(file.fd, content); fs.closeSync(file); } Logger.info(TAG, 'readyFilesToWorker successful'); } catch (e) { Logger.error(TAG, `readyFilesToWorker has failed for: {message: ${(e as Error).message}, ${e}}`); } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Performance/ConcurrentModule/entry/src/main/ets/fileFs/MyWorker.ets#L53-L78
4e2f16e2d83cf9275bf5cf02e9f620f676f8de55
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets
arkts
getData
获取索引对应的数据
public getData(index: number): number { return this.dataArray[index]; }
AST#method_declaration#Left public getData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getData(index: number): number { return this.dataArray[index]; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/waterFlow/WaterFlowDataSource.ets#L28-L30
7bdf207297e922a8b86244c399c6bed9e4da72c9
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Application.ets
arkts
Current partial update context or undefined. @returns current partial update context
export function currentPartialUpdateContext<T>(): T | undefined { return _currentPartialUpdateContext as (T | undefined) }
AST#export_declaration#Left export AST#function_declaration#Left function currentPartialUpdateContext AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T 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#return_statement#Left return AST#expression#Left AST#as_expression#Left AST#expression#Left _currentPartialUpdateContext AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ) AST#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 currentPartialUpdateContext<T>(): T | undefined { return _currentPartialUpdateContext as (T | undefined) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Application.ets#L76-L78
7e7c20b8fb9f666e5c76258a4851c0eb0a096003
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawGridLinesBehindData
If this is set to false, the grid lines are draw on top of the actual data, otherwise behind. Default: true @param enabled
public setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
AST#method_declaration#Left public setDrawGridLinesBehindData 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 . mDrawGridLinesBehindData 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 setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L509-L511
037d9041311ab10b3c4536789c386bf9a2dfc98d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/FeatureComponent.ets
arkts
CustomAnimationTabPage
仅用于项目调试,单独使用可删除代码内容
@AppRouter({ name: "customanimationtab/CustomAnimationTabPage" }) @Component export struct CustomAnimationTabPage { build() { CustomAnimationTabView() .height($r("app.string.custom_animation_tab_one_hundred_percent")) .width($r("app.string.custom_animation_tab_one_hundred_percent")); } }
AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "customanimationtab/CustomAnimationTabPage" AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct CustomAnimationTabPage 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 CustomAnimationTabView ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.custom_animation_tab_one_hundred_percent" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.custom_animation_tab_one_hundred_percent" 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#ERROR#Left ; AST#ERROR#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@AppRouter({ name: "customanimationtab/CustomAnimationTabPage" }) @Component export struct CustomAnimationTabPage { build() { CustomAnimationTabView() .height($r("app.string.custom_animation_tab_one_hundred_percent")) .width($r("app.string.custom_animation_tab_one_hundred_percent")); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/FeatureComponent.ets#L21-L30
d49873d0999405377dbfdceb8ba1f88b3c6d6951
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/pages/Index.ets
arkts
toDeleteComment
删除评论 TODO
async toDeleteComment(key: string) { //先删除数据 await KVManager.deleteData(key)//等待deleteData执行完成 //再读取数据 let result=await KVManager.queryData(key);//等待queryData执行完成 this.commentContent=result.toString()//此时因为键值被删,无法查询数据,返回空字符串 this.isShowComment=!this.isShowComment//评论被删除,隐藏评论框 this.isComment=!this.isComment//评论状态也刷新为从未评论 KVManager.showToastMessage($r('app.string.delete_comment_notice')) }
AST#method_declaration#Left async toDeleteComment AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { //先删除数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left KVManager AST#expression#Right AST#await_expression#Right AST#expression#Right . deleteData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right //等待deleteData执行完成 //再读取数据 AST#statement#Left AST#variable_declaration#Left let 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 KVManager AST#expression#Right AST#await_expression#Right AST#expression#Right . queryData 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //等待queryData执行完成 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 . commentContent AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result 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#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 . isShowComment 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 . isShowComment 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 . isComment 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 . isComment 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left KVManager AST#expression#Right . showToastMessage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.delete_comment_notice' AST#expression#Right ) AST#resource_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#method_declaration#Right
async toDeleteComment(key: string) { await KVManager.deleteData(key) let result=await KVManager.queryData(key); this.commentContent=result.toString() this.isShowComment=!this.isShowComment this.isComment=!this.isComment KVManager.showToastMessage($r('app.string.delete_comment_notice')) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/pages/Index.ets#L134-L143
087e6fee264aaa66de7e490a66e036c3416380d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
requestRepository
重写请求方法来实现网络请求 @return 商品分类
protected requestRepository(): Promise<NetworkResponse<Category[]>> { return this.goodsRepository.getGoodsTypeList(); }
AST#method_declaration#Left protected requestRepository 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#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] 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#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#member_expression#Left AST#expression#Left this AST#expression#Right . goodsRepository AST#member_expression#Right AST#expression#Right . getGoodsTypeList 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
protected requestRepository(): Promise<NetworkResponse<Category[]>> { return this.goodsRepository.getGoodsTypeList(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L50-L52
b32b168085d6abcc4b02e5834cc3ad868312cf8f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
buyNow
立即购买 @param {SelectedGoods} selectedGoods - 已选商品信息 @returns {Promise<void>} Promise<void>
async buyNow(selectedGoods: SelectedGoods): Promise<void> { // 保存已选商品列表到本地存储(存储为数组格式) await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); // 关闭规格选择弹窗 this.dismissSpecModal(); // 跳转到订单确认页面 OrderNavigator.toConfirm(); }
AST#method_declaration#Left async buyNow AST#parameter_list#Left ( AST#parameter#Left selectedGoods : AST#type_annotation#Left AST#primary_type#Left SelectedGoods 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#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . orderCacheStoreRepository AST#member_expression#Right AST#expression#Right . saveSelectedGoodsList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left selectedGoods 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dismissSpecModal 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 OrderNavigator AST#expression#Right . toConfirm 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 buyNow(selectedGoods: SelectedGoods): Promise<void> { await this.orderCacheStoreRepository.saveSelectedGoodsList([selectedGoods]); this.dismissSpecModal(); OrderNavigator.toConfirm(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L172-L179
df4015536973267d70b06bfcd9e495688ffa38d9
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
exitSystem
#ffffff'; 退出系统。 @param context UIAbilityContext上下文对象
static exitSystem(context: common.UIAbilityContext) { // let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; context.terminateSelf(); }
AST#method_declaration#Left static exitSystem 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#builder_function_body#Left { // let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . terminateSelf 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 exitSystem(context: common.UIAbilityContext) { context.terminateSelf(); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L35-L38
d32f972b0ab520764323b8f4c95633b38c75b661
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets
arkts
computeTask
[EndExclude cold_start_speed_optimization]
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
AST#method_declaration#Left computeTask AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#while_statement#Left while ( AST#expression#Left AST#binary_expression#Left AST#expression#Left count AST#expression#Right < AST#expression#Left LARGE_NUMBER 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#update_expression#Left AST#expression#Left count AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#while_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
computeTask(): void { let count: number = 0; while (count < LARGE_NUMBER) { count++; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ColdStartSpeedOptimization.ets#L44-L49
530e72dd62a6952f54f97e2864e7f7f2d05c47cf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
Basic implementation of IDataSource to handle data listener @implements {IDataSource}
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; /** * 获取数组长度 */ public totalCount(): number { return this.originDataArray.length; } /** * 获取索引对应的数据 * @param index 数组索引 */ public getData(index: number): T { return this.originDataArray[index]; } /** * 在指定索引位置增加一个元素 * @param index 数组索引 */ public addData(index: number, data: T): void { this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); } /** * 从数据头部移除一个元素 */ public shiftData(): void { this.originDataArray.shift(); this.notifyDataDelete(0); } /** * 在数据尾部增加一个元素 * @param data 元素对象 */ public pushData(data: T): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); } /** * 注册改变数据的控制器 * @param listener 数据控制器 */ registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } } /** * 注销改变数据的控制器 * @param listener 数据控制器 */ unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener) if (pos >= 0) { this.listeners.splice(pos, 1); } } /** * 通知控制器数据重新加载 */ notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); } /** * 通知控制器数据增加 * @param index 数组索引 */ notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) } /** * 通知控制器数据变化 * @param index 数组索引 */ notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) } /** * 通知控制器数据删除 * @param index 数组索引 */ notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) } /** * 通知控制器数据位置变化 * @param from 起始位置 * @param to 最终位置 */ notifyDataMove(from: number, to: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataMove(from, to); }) } }
AST#export_declaration#Left export AST#class_declaration#Left class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private originDataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 获取数组长度 */ 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取索引对应的数据 * @param index 数组索引 */ AST#method_declaration#Left public getData 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_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 在指定索引位置增加一个元素 * @param 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 T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray 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 /** * 从数据头部移除一个元素 */ AST#method_declaration#Left public shiftData 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#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . shift 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 . notifyDataDelete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 在数据尾部增加一个元素 * @param data 元素对象 */ AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . push 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#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 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 . originDataArray AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注册改变数据的控制器 * @param listener 数据控制器 */ AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#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 . listeners AST#member_expression#Right AST#expression#Right . indexOf 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#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners AST#member_expression#Right AST#expression#Right . push 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 注销改变数据的控制器 * @param listener 数据控制器 */ AST#method_declaration#Left unregisterDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 pos = 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 . listeners AST#member_expression#Right AST#expression#Right . indexOf 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#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 pos 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 . listeners AST#member_expression#Right AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pos AST#expression#Right , AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 通知控制器数据重新加载 */ AST#method_declaration#Left notifyDataReload 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#member_expression#Left AST#expression#Left this AST#expression#Right . listeners 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 listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 listener AST#expression#Right . onDataReloaded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 通知控制器数据增加 * @param index 数组索引 */ AST#method_declaration#Left notifyDataAdd 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_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 . listeners 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 listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 listener AST#expression#Right . onDataAdd 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#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 /** * 通知控制器数据变化 * @param index 数组索引 */ AST#method_declaration#Left notifyDataChange 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_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 . listeners 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 listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 listener AST#expression#Right . onDataChange 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#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 /** * 通知控制器数据删除 * @param index 数组索引 */ AST#method_declaration#Left notifyDataDelete 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_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 . listeners 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 listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 listener AST#expression#Right . onDataDelete 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#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 /** * 通知控制器数据位置变化 * @param from 起始位置 * @param to 最终位置 */ AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listeners 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 listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener 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 listener AST#expression#Right . onDataMove AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left from AST#expression#Right , AST#expression#Left to 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#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; private originDataArray: T[] = []; public totalCount(): number { return this.originDataArray.length; } public getData(index: number): T { return this.originDataArray[index]; } public addData(index: number, data: T): void { this.originDataArray.splice(index, 0, data); this.notifyDataAdd(index); } public shiftData(): void { this.originDataArray.shift(); this.notifyDataDelete(0); } public pushData(data: T): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); } registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } } unregisterDataChangeListener(listener: DataChangeListener): void { const pos = this.listeners.indexOf(listener) if (pos >= 0) { this.listeners.splice(pos, 1); } } notifyDataReload(): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataReloaded(); }); } notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) } notifyDataChange(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataChange(index); }) } notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) } notifyDataMove(from: number, to: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataMove(from, to); }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/BasicDataSource.ets#L20-L135
bd8fbe68254005ab825ae2118e2f3adca32d18c8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/ColumnAttribute.ets
arkts
获取纵向居中 + 水平起始的 Column 对齐修饰器 @returns {AttributeModifier<ColumnAttribute>} Column 对齐修饰器 @example Column() { Text("Hi"); }.attributeModifier(columnCenterStart());
export function columnCenterStart(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.Start); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function columnCenterStart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ColumnAttribute 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#object_literal#Left { AST#property_assignment#Left AST#property_name#Left applyNormalAttribute AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left instance : AST#type_annotation#Left AST#primary_type#Left ColumnAttribute 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left instance AST#expression#Right . justifyContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center 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 instance AST#expression#Right . alignItems AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 columnCenterStart(): AttributeModifier<ColumnAttribute> { return { applyNormalAttribute: (instance: ColumnAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(HorizontalAlign.Start); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/ColumnAttribute.ets#L72-L79
d26c0700bcc26f0d6ce61eff70a435f6ea68a2b4
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/NoteDataModel.ets
arkts
Copyright (c) 2020-2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
export class NoteModel { title: string content: string constructor
AST#export_declaration#Left export AST#ERROR#Left class NoteModel { title : string content : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class NoteModel { title: string content: string constructor
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/Kvstore/entry/src/main/ets/model/NoteDataModel.ets#L16-L20
37fd61bc6ffe6b487600596540d350107c81db15
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/OnlineLunarService.ets
arkts
网络农历数据接口
export interface OnlineLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; lunarYear: number; lunarMonth: number; lunarDay: number; zodiac: string; ganzhi: string; solarTerms?: string; festivals?: string[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OnlineLunarDate AST#object_type#Left { AST#type_member#Left year : 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 month : 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 day : 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 isLeapMonth : 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 lunarYear : 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 lunarMonth : 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 lunarDay : 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 zodiac : 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 ganzhi : 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 solarTerms ? : 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 festivals ? : 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#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface OnlineLunarDate { year: number; month: number; day: number; isLeapMonth: boolean; lunarYear: number; lunarMonth: number; lunarDay: number; zodiac: string; ganzhi: string; solarTerms?: string; festivals?: string[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L13-L25
760bad90a58ac44c036a3451cd954ad863f988f4
github
qwerguai/ArkTSComponents.git
58ac77d9686670d79ba7421d71e68f31870aacd5
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSwiperImages
Get swiper image data. @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.aaaaaaaa'), $r('app.media.bbbbbb'), $r('app.media.cccccc'), $r('app.media.ddddddd') ]; return swiperImages; }
AST#method_declaration#Left getSwiperImages 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 Resource 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 swiperImages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.aaaaaaaa' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.bbbbbb' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.cccccc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ddddddd' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left swiperImages AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.aaaaaaaa'), $r('app.media.bbbbbb'), $r('app.media.cccccc'), $r('app.media.ddddddd') ]; return swiperImages; }
https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/viewmodel/MainViewModel.ets#L28-L36
a99e24d9b94366f515f54894d8ac74a5e272257c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
getModifier
获取当前gridItem的modifier @param item 网格元素 @returns 属性对象
getModifier(item: T): GridItemModifier { logger.info(`getModifier start, item:${JSON.stringify(item)}`); const index: number = this.gridData.indexOf(item); if (index === -1) { return new GridItemModifier(); } else { return this.modifier[index]; } }
AST#method_declaration#Left getModifier AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GridItemModifier 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#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 ` getModifier start, item: 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 item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . gridData AST#member_expression#Right AST#expression#Right . indexOf 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#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 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left GridItemModifier 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#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . modifier AST#member_expression#Right AST#expression#Right [ AST#expression#Left index 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#method_declaration#Right
getModifier(item: T): GridItemModifier { logger.info(`getModifier start, item:${JSON.stringify(item)}`); const index: number = this.gridData.indexOf(item); if (index === -1) { return new GridItemModifier(); } else { return this.modifier[index]; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L59-L67
eb20d316b777668d80cbd79cc2ad19ab8ce88e61
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/toggle/toggleNormal.ets
arkts
ToggleBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@Builder export function ToggleBuilder(name: string, param: Object) { ToggleExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ToggleExample ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
@Builder export function ToggleBuilder(name: string, param: Object) { ToggleExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleNormal.ets#L16-L19
87294185a0ac63f5b51fac16b34db055563012c7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/CsvParser.ets
arkts
splitCsvLines
分割CSV行,处理多行字段
private static splitCsvLines(content: string): string[] { const lines: string[] = []; let currentLine = ''; let inQuotes = false; for (let i = 0; i < content.length; i++) { const char = content[i]; if (char === '"') { inQuotes = !inQuotes; currentLine += char; } else if (char === '\n' && !inQuotes) { if (currentLine.trim()) { lines.push(currentLine); } currentLine = ''; } else if (char === '\r' && !inQuotes) { // 跳过 \r continue; } else { currentLine += char; } } if (currentLine.trim()) { lines.push(currentLine); } return lines; }
AST#method_declaration#Left private static splitCsvLines 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lines : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left currentLine = 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 inQuotes = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left 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 content 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 const AST#variable_declarator#Left char = AST#expression#Left AST#subscript_expression#Left AST#expression#Left content 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 char AST#expression#Right === AST#expression#Left '"' 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 inQuotes = AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inQuotes AST#expression#Right AST#unary_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 currentLine += AST#expression#Left char 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right === AST#expression#Left '\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inQuotes 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentLine AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lines AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left currentLine 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#assignment_expression#Left currentLine = AST#expression#Left '' 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left char AST#expression#Right === AST#expression#Left '\r' AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left inQuotes AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 跳过 \r AST#statement#Left AST#continue_statement#Left continue ; AST#continue_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 currentLine += AST#expression#Left char 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#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left currentLine AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left lines AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left currentLine AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left lines AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
private static splitCsvLines(content: string): string[] { const lines: string[] = []; let currentLine = ''; let inQuotes = false; for (let i = 0; i < content.length; i++) { const char = content[i]; if (char === '"') { inQuotes = !inQuotes; currentLine += char; } else if (char === '\n' && !inQuotes) { if (currentLine.trim()) { lines.push(currentLine); } currentLine = ''; } else if (char === '\r' && !inQuotes) { continue; } else { currentLine += char; } } if (currentLine.trim()) { lines.push(currentLine); } return lines; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/CsvParser.ets#L92-L121
fe31e64b45111e5cf987ed400689c7e9b2621fbf
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines ChipItemStyle. @interface ChipItemStyle @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipItemStyle { /** * Chip size. * * @type { ?(ChipSize | SizeOptions) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ size?: ChipSize | SizeOptions; /** * ChipItem background color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ backgroundColor?: ResourceColor; /** * Text font color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ fontColor?: ResourceColor; /** * Selected Text font color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ selectedFontColor?: ResourceColor; /** * Selected chip item background color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ selectedBackgroundColor?: ResourceColor; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipItemStyle AST#object_type#Left { /** * Chip size. * * @type { ?(ChipSize | SizeOptions) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left size ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChipSize AST#primary_type#Right | AST#primary_type#Left SizeOptions AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * ChipItem background color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left backgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Text font color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Selected Text font color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left selectedFontColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Selected chip item background color. * * @type { ?ResourceColor } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left selectedBackgroundColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor 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 ChipItemStyle { size?: ChipSize | SizeOptions; backgroundColor?: ResourceColor; fontColor?: ResourceColor; selectedFontColor?: ResourceColor; selectedBackgroundColor?: ResourceColor; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ChipGroup.d.ets#L283-L339
ab6d8fe8885eb1cb1a1090ecb297db1a464231da
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/ability/NaturalLanguageExtract.ets
arkts
========== 类型定义 ==========
export interface HuaweiLinkParseResult { packageName: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface HuaweiLinkParseResult AST#object_type#Left { AST#type_member#Left packageName : 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 HuaweiLinkParseResult { packageName: string; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/ability/NaturalLanguageExtract.ets#L4-L6
34e2a9a7b2a8472de6178f10c4059e751d56fc85
github
hushenghao/ArkTS-RelativeContainerExtend.git
8df722220a15be576736c7a58a8ed30820c3a1ea
entry/src/main/ets/utils/SpaceExtend.ets
arkts
垂直方向边距 @param size @returns
export function vertical(size: Length): Padding { return { top: size, bottom: size } }
AST#export_declaration#Left export AST#function_declaration#Left function vertical AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Length AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Padding AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left size AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left size 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#function_declaration#Right AST#export_declaration#Right
export function vertical(size: Length): Padding { return { top: size, bottom: size } }
https://github.com/hushenghao/ArkTS-RelativeContainerExtend.git/blob/8df722220a15be576736c7a58a8ed30820c3a1ea/entry/src/main/ets/utils/SpaceExtend.ets#L15-L17
b8890d4aacb78e2bf7b3410b742e684c7ebcc62a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets
arkts
getDistanceSquare
根据圆心,以及纵坐标拿到水位线两个端点的距离的平方 @param ordinate 纵坐标 @returns 端点间距离的平方
getDistanceSquare(ordinate: number): number { return Constants.RADIUS_IN_PX * Constants.RADIUS_IN_PX - (ordinate - Constants.RADIUS_IN_PX) * (ordinate - Constants.RADIUS_IN_PX); }
AST#method_declaration#Left getDistanceSquare AST#parameter_list#Left ( AST#parameter#Left ordinate : 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 number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 Constants AST#expression#Right . RADIUS_IN_PX AST#member_expression#Right AST#expression#Right * AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . RADIUS_IN_PX AST#member_expression#Right AST#expression#Right - 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 ordinate AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . RADIUS_IN_PX AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left ordinate AST#expression#Right - AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . RADIUS_IN_PX AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_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
getDistanceSquare(ordinate: number): number { return Constants.RADIUS_IN_PX * Constants.RADIUS_IN_PX - (ordinate - Constants.RADIUS_IN_PX) * (ordinate - Constants.RADIUS_IN_PX); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L76-L78
6bb150d9eafeb9912e6565daa605afedbe435538
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets
arkts
Draw screen
build() { Column() { if (this.targetView == 'MenuItem') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }).backgroundColor(Color.Pink).commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .padding(0) .key(this.parentKey) } else if (this.targetView == 'MenuItemGroup') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItemGroup() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.commonStyle().backgroundColor(Color.Pink) } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .padding(0) .key(this.parentKey) } else if (this.targetView == 'NavDestination') { NavRouter() { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) NavDestination().backgroundColor(Color.Pink).commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'StepperItem') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) Stepper() { StepperItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this._width) .height(this._height) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'FlowItem') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) WaterFlow() { FlowItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'GridCol') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) GridRow() { GridCol() { Text('GridCol') } .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'GridItem') { Grid() { GridItem() .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) GridItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'ListItem') { List() { ListItem() { Button('ListItem') } .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) ListItem() { Button('ListItem') } .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'ListItemGroup') { List() { ListItem() { Text('ListItem') } .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) ListItemGroup() { ListItem() { Text('ListItemGroup') } } .backgroundColor(Color.Pink) .commonStyle() } .listDirection(Axis.Horizontal) .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'TabContent') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) Tabs() { TabContent() { Text('TabContent Test') } .backgroundColor(Color.Pink) .commonStyle() } .width(this._width) .height(this._height) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else { Column() { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) if (this.targetView == 'AlphabetIndexer') { AlphabetIndexer({ arrayValue: this.value, selected: 0 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Blank') { Blank() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Button') { Button('button').commonStyle() } else if (this.targetView == 'Checkbox') { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'CheckboxGroup') { CheckboxGroup({ group: 'checkboxGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [25] }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'DatePicker') { DatePicker() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Divider') { Divider() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Gauge') { Gauge({ value: 75 }) .colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1]]) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Image') { Image($r('app.media.icon')) .commonStyle() } else if (this.targetView == 'ImageAnimator') { ImageAnimator() .images([{ src: $r('app.media.icon') }]) .commonStyle() } else if (this.targetView == 'LoadingProgress') { LoadingProgress() .color(Color.Blue) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Marquee') { Marquee({ start: true, src: this.src }) .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Menu') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'Menu' }) }.backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Navigation') { Navigation() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'NavRouter') { NavRouter().backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'PatternLock') { PatternLock() .sideLength(this._width) .commonStyle() } else if (this.targetView == 'Progress') { Progress({ value: 20 }) .border({ width: 2 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'QRCode') { QRCode(this.src) .border({ width: 2 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Radio') { Radio({ value: 'Radio1', group: 'radioGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Rating') { Rating() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RichText') { RichText('RichText').backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'ScrollBar') { ScrollBar({ scroller: this.scroller, state: BarState.On }) { Text('text') } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Search') { Search() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa' }, { value: 'bbb' }, { value: 'ccc' }]) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Slider') { Slider() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Stepper') { Stepper() { StepperItem() }.backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Text') { Text('text') .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextArea') { TextArea() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextClock') { TextClock() .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextInput') { TextInput() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextPicker') { TextPicker({ range: this.value }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextTimer') { TextTimer({ controller: this.textTimerController }) .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TimePicker') { TimePicker() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Toggle') { Toggle({ type: ToggleType.Switch }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Badge') { Badge({ count: 50, style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red } }) { Button('message').backgroundColor(0x317aff) } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Column') { Column() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'ColumnSplit') { ColumnSplit() { Text('1').backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) Text('2').backgroundColor(0xD2B48C).textAlign(TextAlign.Center) } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Flex') { Flex() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'GridRow') { GridRow() { GridCol() { Text('GridCol') } } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Grid') { Grid() { GridItem() { Text('Grid').backgroundColor(Color.White) } } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'List') { List() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Navigator') { Navigator({ target: '' }).backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Panel') { Panel(true) .backgroundMask(Color.Pink) .commonStyle() } else if (this.targetView == 'Refresh') { Refresh({ refreshing: false }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RelativeContainer') { RelativeContainer() { Row() .width(100) .height(50) .backgroundColor('#FF3333') .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, left: { anchor: '__container__', align: HorizontalAlign.Start } }) .id('OnAreaChange') } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Row') { Row() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RowSplit') { RowSplit() { Text('Text') }.commonStyle() } else if (this.targetView == 'Scroll') { Scroll() { Column() { ForEach([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], (item: string) => { Text('Scroll' + item.toString()) .width('90%') .height(150) .backgroundColor(Color.White) .textAlign(TextAlign.Center) }, (item: string) => item) }.width('100%') }.scrollBar(BarState.On).commonStyle() } else if (this.targetView == 'SideBarContainer') { SideBarContainer(SideBarContainerType.Embed) { Column() { ForEach([1, 2, 3], (item: string) => { Column({ space: 5 }) { Image($r('app.media.icon')) .width(50) .height(50) Text('Index0' + item) .fontSize(25) } }) }.width('100%') .justifyContent(FlexAlign.SpaceEvenly) .backgroundColor(Color.Green) Column() { Text('SideBarContainer content') .fontSize(25) }.backgroundColor(Color.Orange) }.commonStyle() } else if (this.targetView == 'Stack') { Stack() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Swiper') { Swiper() { ForEach([1, 2, 3], (item: string) => { Text('Swiper' + item) }, (item: string) => item) } .indicator(true) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Tabs') { Tabs() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'WaterFlow') { WaterFlow() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Circle') { Circle() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Ellipse') { Ellipse() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Line') { Line() .backgroundColor(Color.Pink) .startPoint([0, 0]) .endPoint([50, 100]) .commonStyle() } else if (this.targetView == 'Polyline') { Polyline() .points([[0, 0], [20, 60], [100, 100]]) .fillOpacity(0) .stroke(Color.Blue) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Polygon') { Polygon() .points([[0, 0], [0, 100], [100, 100], [100, 0]]) .fillOpacity(0) .strokeWidth(5) .stroke(Color.Blue) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Path') { Path() .commands('M100 0 L200 240 L0 240 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Rect') { Rect() .fillOpacity(0) .stroke(Color.Red) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Shape') { Shape() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Counter') { Counter() .backgroundColor(Color.Pink) .commonStyle() } } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } Text(this.sizeOldValue).key(this.compareOldTextKey) Text(this.sizeNewValue).key(this.compareNewTextKey) }.width('100%').height('100%') }
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#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'MenuItem' 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left 'MenuItem' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left 'MenuItem' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'MenuItemGroup' 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left 'MenuItem' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 MenuItemGroup ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left 'MenuItem' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'NavDestination' 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 NavRouter ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 NavDestination ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'StepperItem' 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 Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 Stepper ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left StepperItem ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _width AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _height AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'FlowItem' 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 Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 WaterFlow ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left FlowItem ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'GridCol' 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 Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 GridRow ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridCol ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'GridCol' AST#expression#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'GridItem' 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 Grid ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 GridItem ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'ListItem' 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 List ( ) AST#container_content_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 Button ( AST#expression#Left 'ListItem' AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'ListItem' AST#expression#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'ListItemGroup' 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 List ( ) AST#container_content_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 'ListItem' AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 ListItemGroup ( ) AST#container_content_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 'ListItemGroup' AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TabContent' 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 Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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 Tabs ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TabContent ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'TabContent Test' AST#expression#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _width AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _height AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'Button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _compareButtonHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareButtonKey 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#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'AlphabetIndexer' 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 AlphabetIndexer ( AST#component_parameters#Left { AST#component_parameter#Left arrayValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selected : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Blank' 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 Blank ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Button' 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 Button ( AST#expression#Left 'button' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Checkbox' 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 Checkbox ( AST#component_parameters#Left { AST#component_parameter#Left name : AST#expression#Left 'checkbox1' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left group : AST#expression#Left 'checkboxGroup' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'CheckboxGroup' 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 CheckboxGroup ( AST#component_parameters#Left { AST#component_parameter#Left group : AST#expression#Left 'checkboxGroup' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'DataPanel' 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 DataPanel ( AST#component_parameters#Left { AST#component_parameter#Left values : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 25 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'DatePicker' 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 DatePicker ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Divider' 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 Divider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Gauge' 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 Gauge ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left 75 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . colors ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x317AF7 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x5BA854 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0xE08C3A AST#expression#Right , AST#expression#Left 1 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0x9C554B AST#expression#Right , AST#expression#Left 1 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Image' 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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'ImageAnimator' 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 ImageAnimator ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . images ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left src AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'LoadingProgress' 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 LoadingProgress ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Marquee' 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 Marquee ( AST#component_parameters#Left { AST#component_parameter#Left start : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left src : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . src AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Menu' 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 Menu ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MenuItem ( AST#component_parameters#Left { AST#component_parameter#Left startIcon : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left 'Menu' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Navigation' 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 Navigation ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'NavRouter' 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 NavRouter ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'PatternLock' 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 PatternLock ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . sideLength ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _width AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Progress' 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 Progress ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left 20 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'QRCode' 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 QRCode ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . src AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Radio' 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 Radio ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left 'Radio1' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left group : AST#expression#Left 'radioGroup' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Rating' 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 Rating ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'RichText' 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 RichText ( AST#expression#Left 'RichText' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'ScrollBar' 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 ScrollBar ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left state : AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . On 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 Text ( AST#expression#Left 'text' AST#expression#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Search' 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 Search ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Select' 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 Select ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left 'aaa' 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 value AST#property_name#Right : AST#expression#Left 'bbb' 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 value AST#property_name#Right : AST#expression#Left 'ccc' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Slider' 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 Slider ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Stepper' 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 Stepper ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left StepperItem ( ) 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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Text' 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 Text ( AST#expression#Left 'text' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TextArea' 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 TextArea ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TextClock' 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 TextClock ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TextInput' 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 TextInput ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TextPicker' 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 TextPicker ( AST#component_parameters#Left { AST#component_parameter#Left range : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TextTimer' 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 TextTimer ( AST#component_parameters#Left { AST#component_parameter#Left controller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textTimerController AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 15 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'TimePicker' 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 TimePicker ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Toggle' 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 Toggle ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ToggleType AST#expression#Right . Switch AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Badge' 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 Badge ( AST#component_parameters#Left { AST#component_parameter#Left count : AST#expression#Left 50 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left style : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 0xFFFFFF AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontSize AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left badgeSize AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left badgeColor AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left 'message' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0x317aff 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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Column' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'ColumnSplit' 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 ColumnSplit ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '1' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xF5DEB3 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#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 '2' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 0xD2B48C 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#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 AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Flex' 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 Flex ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'GridRow' 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 GridRow ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridCol ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'GridCol' AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Grid' 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 Grid ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Grid' AST#expression#Right ) AST#ui_component#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#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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'List' 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 List ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Navigator' 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 Navigator ( AST#component_parameters#Left { AST#component_parameter#Left target : AST#expression#Left '' AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Panel' 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 Panel ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundMask ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Refresh' 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 Refresh ( AST#component_parameters#Left { AST#component_parameter#Left refreshing : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'RelativeContainer' 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 RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 100 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FF3333' AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right 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 left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left '__container__' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'OnAreaChange' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Row' 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 Row ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'RowSplit' 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 RowSplit ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Text' AST#expression#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 . commonStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Scroll' 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 Scroll ( ) 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( 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#ui_builder_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#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 AST#binary_expression#Left AST#expression#Left 'Scroll' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_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#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#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 . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'SideBarContainer' 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 SideBarContainer ( AST#expression#Left AST#member_expression#Left AST#expression#Left SideBarContainerType AST#expression#Right . Embed 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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#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#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 5 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 AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 50 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'Index0' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 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#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 . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'SideBarContainer content' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 25 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 . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Orange AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Stack' 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 Stack ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Swiper' 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 Swiper ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#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#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#binary_expression#Left AST#expression#Left 'Swiper' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#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 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 . indicator ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Tabs' 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 Tabs ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'WaterFlow' 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 WaterFlow ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Circle' 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#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Ellipse' 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 Ellipse ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Line' 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 Line ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . startPoint ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . endPoint ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 50 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Polyline' 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 Polyline ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . points ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 20 AST#expression#Right , AST#expression#Left 60 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 100 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Polygon' 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 Polygon ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . points ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 100 AST#expression#Right , AST#expression#Left 100 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 100 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 5 AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Blue AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Path' 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 Path ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . commands ( AST#expression#Left 'M100 0 L200 240 L0 240 Z' AST#expression#Right ) AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Rect' 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 Rect ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillOpacity ( AST#expression#Left 0 AST#expression#Right ) AST#modifier_chain_expression#Left . stroke ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . strokeWidth ( AST#expression#Left 3 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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 } else 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 . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Shape' 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 Shape ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . targetView AST#member_expression#Right AST#expression#Right == AST#expression#Left 'Counter' 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 Counter ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Pink AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . commonStyle ( ) 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_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Green AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . parentKey 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#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeOldValue AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareOldTextKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sizeNewValue AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . key ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . compareNewTextKey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
build() { Column() { if (this.targetView == 'MenuItem') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }).backgroundColor(Color.Pink).commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .padding(0) .key(this.parentKey) } else if (this.targetView == 'MenuItemGroup') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) MenuItemGroup() { MenuItem({ startIcon: $r('app.media.icon'), content: 'MenuItem' }) }.commonStyle().backgroundColor(Color.Pink) } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .padding(0) .key(this.parentKey) } else if (this.targetView == 'NavDestination') { NavRouter() { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) NavDestination().backgroundColor(Color.Pink).commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'StepperItem') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) Stepper() { StepperItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this._width) .height(this._height) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'FlowItem') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) WaterFlow() { FlowItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'GridCol') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) GridRow() { GridCol() { Text('GridCol') } .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'GridItem') { Grid() { GridItem() .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) GridItem() .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'ListItem') { List() { ListItem() { Button('ListItem') } .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) ListItem() { Button('ListItem') } .backgroundColor(Color.Pink) .commonStyle() } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'ListItemGroup') { List() { ListItem() { Text('ListItem') } .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) ListItemGroup() { ListItem() { Text('ListItemGroup') } } .backgroundColor(Color.Pink) .commonStyle() } .listDirection(Axis.Horizontal) .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else if (this.targetView == 'TabContent') { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) Tabs() { TabContent() { Text('TabContent Test') } .backgroundColor(Color.Pink) .commonStyle() } .width(this._width) .height(this._height) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } else { Column() { Button('Button') .width(this._compareButtonWidth) .height(this._compareButtonHeight) .key(this.compareButtonKey) if (this.targetView == 'AlphabetIndexer') { AlphabetIndexer({ arrayValue: this.value, selected: 0 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Blank') { Blank() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Button') { Button('button').commonStyle() } else if (this.targetView == 'Checkbox') { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'CheckboxGroup') { CheckboxGroup({ group: 'checkboxGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'DataPanel') { DataPanel({ values: [25] }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'DatePicker') { DatePicker() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Divider') { Divider() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Gauge') { Gauge({ value: 75 }) .colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1]]) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Image') { Image($r('app.media.icon')) .commonStyle() } else if (this.targetView == 'ImageAnimator') { ImageAnimator() .images([{ src: $r('app.media.icon') }]) .commonStyle() } else if (this.targetView == 'LoadingProgress') { LoadingProgress() .color(Color.Blue) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Marquee') { Marquee({ start: true, src: this.src }) .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Menu') { Menu() { MenuItem({ startIcon: $r('app.media.icon'), content: 'Menu' }) }.backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Navigation') { Navigation() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'NavRouter') { NavRouter().backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'PatternLock') { PatternLock() .sideLength(this._width) .commonStyle() } else if (this.targetView == 'Progress') { Progress({ value: 20 }) .border({ width: 2 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'QRCode') { QRCode(this.src) .border({ width: 2 }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Radio') { Radio({ value: 'Radio1', group: 'radioGroup' }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Rating') { Rating() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RichText') { RichText('RichText').backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'ScrollBar') { ScrollBar({ scroller: this.scroller, state: BarState.On }) { Text('text') } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Search') { Search() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Select') { Select([{ value: 'aaa' }, { value: 'bbb' }, { value: 'ccc' }]) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Slider') { Slider() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Stepper') { Stepper() { StepperItem() }.backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Text') { Text('text') .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextArea') { TextArea() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextClock') { TextClock() .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextInput') { TextInput() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextPicker') { TextPicker({ range: this.value }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TextTimer') { TextTimer({ controller: this.textTimerController }) .fontSize(15) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'TimePicker') { TimePicker() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Toggle') { Toggle({ type: ToggleType.Switch }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Badge') { Badge({ count: 50, style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red } }) { Button('message').backgroundColor(0x317aff) } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Column') { Column() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'ColumnSplit') { ColumnSplit() { Text('1').backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) Text('2').backgroundColor(0xD2B48C).textAlign(TextAlign.Center) } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Flex') { Flex() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'GridRow') { GridRow() { GridCol() { Text('GridCol') } } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Grid') { Grid() { GridItem() { Text('Grid').backgroundColor(Color.White) } } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'List') { List() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Navigator') { Navigator({ target: '' }).backgroundColor(Color.Pink).commonStyle() } else if (this.targetView == 'Panel') { Panel(true) .backgroundMask(Color.Pink) .commonStyle() } else if (this.targetView == 'Refresh') { Refresh({ refreshing: false }) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RelativeContainer') { RelativeContainer() { Row() .width(100) .height(50) .backgroundColor('#FF3333') .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top }, left: { anchor: '__container__', align: HorizontalAlign.Start } }) .id('OnAreaChange') } .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Row') { Row() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'RowSplit') { RowSplit() { Text('Text') }.commonStyle() } else if (this.targetView == 'Scroll') { Scroll() { Column() { ForEach([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], (item: string) => { Text('Scroll' + item.toString()) .width('90%') .height(150) .backgroundColor(Color.White) .textAlign(TextAlign.Center) }, (item: string) => item) }.width('100%') }.scrollBar(BarState.On).commonStyle() } else if (this.targetView == 'SideBarContainer') { SideBarContainer(SideBarContainerType.Embed) { Column() { ForEach([1, 2, 3], (item: string) => { Column({ space: 5 }) { Image($r('app.media.icon')) .width(50) .height(50) Text('Index0' + item) .fontSize(25) } }) }.width('100%') .justifyContent(FlexAlign.SpaceEvenly) .backgroundColor(Color.Green) Column() { Text('SideBarContainer content') .fontSize(25) }.backgroundColor(Color.Orange) }.commonStyle() } else if (this.targetView == 'Stack') { Stack() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Swiper') { Swiper() { ForEach([1, 2, 3], (item: string) => { Text('Swiper' + item) }, (item: string) => item) } .indicator(true) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Tabs') { Tabs() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'WaterFlow') { WaterFlow() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Circle') { Circle() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Ellipse') { Ellipse() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Line') { Line() .backgroundColor(Color.Pink) .startPoint([0, 0]) .endPoint([50, 100]) .commonStyle() } else if (this.targetView == 'Polyline') { Polyline() .points([[0, 0], [20, 60], [100, 100]]) .fillOpacity(0) .stroke(Color.Blue) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Polygon') { Polygon() .points([[0, 0], [0, 100], [100, 100], [100, 0]]) .fillOpacity(0) .strokeWidth(5) .stroke(Color.Blue) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Path') { Path() .commands('M100 0 L200 240 L0 240 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Rect') { Rect() .fillOpacity(0) .stroke(Color.Red) .strokeWidth(3) .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Shape') { Shape() .backgroundColor(Color.Pink) .commonStyle() } else if (this.targetView == 'Counter') { Counter() .backgroundColor(Color.Pink) .commonStyle() } } .width(this.parentWidth) .height(this.parentHeight) .backgroundColor(Color.Green) .margin(this.parentMargin) .key(this.parentKey) } Text(this.sizeOldValue).key(this.compareOldTextKey) Text(this.sizeNewValue).key(this.compareNewTextKey) }.width('100%').height('100%') }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_onAreaChange/entry/src/main/ets/MainAbility/pages/onAreaChange/OnAreaChangePage.ets#L83-L597
3fed98754d7a0df502ac8f9d16a1bf0b0bd091e5
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/util/MosaicPixelMapHelper.ets
arkts
compress
对输入的像素图压缩到合理尺寸用于后续生成马赛克图 WARNING:调用者不能在子线程调用此接口,会导致原始输入像素图被修改,业务再访问修改后的输入像素图属性方法会抛异常 @param pixelMap 输入的像素图 @returns Promise<PixelMap | undefined>
static async compress(pixelMap: PixelMap): Promise<PixelMap | undefined> { let start = Date.now() let compressPixelMap: PixelMap | undefined let imgSrc: image.ImageSource | undefined try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'compress ' + JSON.stringify(imgInfo)); let scale = 1 let dataArray: Uint8Array = new Uint8Array(0) let maxRes = Math.max(imgInfo.size.width, imgInfo.size.height) let mosaicSize: image.Size = { width: imgInfo.size.width, height: imgInfo.size.height } if (maxRes > MAX_RESOLUTION) { let packedData = await MosaicPixelMapHelper.packing(pixelMap, 90, imgInfo.mimeType) imgSrc = image.createImageSource(packedData) scale = maxRes / MAX_RESOLUTION compressPixelMap = await imgSrc.createPixelMap({ desiredSize: { width: imgInfo.size.width / scale, height: imgInfo.size.height / scale } }) let bufferData = new ArrayBuffer(compressPixelMap.getPixelBytesNumber()); await compressPixelMap.readPixelsToBuffer(bufferData); dataArray = new Uint8Array(bufferData); mosaicSize = { width: imgInfo.size.width / scale, height: imgInfo.size.height / scale } } else { let bufferData = new ArrayBuffer(pixelMap.getPixelBytesNumber()); await pixelMap.readPixelsToBuffer(bufferData); dataArray = new Uint8Array(bufferData); } mosaicSize.width = Math.floor(mosaicSize.width) mosaicSize.height = Math.floor(mosaicSize.height) let option: image.InitializationOptions = { size: { width: mosaicSize.width, height: mosaicSize.height }, pixelFormat: image.PixelMapFormat.RGBA_8888, srcPixelFormat: imgInfo.pixelFormat } compressPixelMap = await image.createPixelMap(dataArray.buffer, option); LoggerWrapper.i(MODULE, TAG, 'compress end cost(ms)=' + (Date.now() - start)); } catch (e) { LoggerWrapper.e(MODULE, TAG, 'compress error', e); } imgSrc?.release() return compressPixelMap }
AST#method_declaration#Left static async compress AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap 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 PixelMap AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left start = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left compressPixelMap : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imgSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imgInfo = 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 pixelMap AST#expression#Right . getImageInfoSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left LoggerWrapper AST#ERROR#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'compress ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left imgInfo AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scale = AST#expression#Left 1 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 dataArray : AST#type_annotation#Left AST#primary_type#Left Uint8Array 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 Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 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 maxRes = 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size 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#variable_declaration#Left let AST#variable_declarator#Left mosaicSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size 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 width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left maxRes AST#expression#Right > AST#expression#Left MAX_RESOLUTION 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 packedData AST#ERROR#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 MosaicPixelMapHelper AST#expression#Right AST#await_expression#Right AST#expression#Right . packing AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right , AST#expression#Left 90 AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . mimeType AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right imgSrc = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left packedData AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right scale AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left maxRes AST#expression#Right / AST#expression#Left AST#assignment_expression#Left MAX_RESOLUTION AST#ERROR#Left compressPixelMap AST#ERROR#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left imgSrc AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap 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 desiredSize AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left scale AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left scale AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_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#variable_declaration#Left let AST#variable_declarator#Left bufferData = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left compressPixelMap AST#expression#Right . getPixelBytesNumber 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#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 compressPixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . readPixelsToBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData 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 dataArray = 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 bufferData 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 mosaicSize = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right / AST#expression#Left scale AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . size AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right / AST#expression#Left scale AST#expression#Right AST#binary_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#variable_declaration#Left let AST#variable_declarator#Left bufferData = 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left pixelMap AST#expression#Right . getPixelBytesNumber 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#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 pixelMap AST#expression#Right AST#await_expression#Right AST#expression#Right . readPixelsToBuffer AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bufferData 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 dataArray = 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 bufferData 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 mosaicSize AST#expression#Right . width AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . height AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . floor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize 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#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left option : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . InitializationOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left mosaicSize AST#expression#Right . height AST#member_expression#Right 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 pixelFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left image AST#expression#Right . PixelMapFormat AST#member_expression#Right AST#expression#Right . RGBA_8888 AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left srcPixelFormat AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left imgInfo AST#expression#Right . pixelFormat AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right compressPixelMap = AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left image AST#expression#Right AST#await_expression#Right AST#expression#Right . createPixelMap AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left dataArray AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right , AST#expression#Left option 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 LoggerWrapper AST#expression#Right . i AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 'compress end cost(ms)=' AST#expression#Right + AST#expression#Left AST#parenthesized_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 Date AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left start 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#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 LoggerWrapper AST#expression#Right . e AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MODULE AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'compress error' AST#expression#Right , AST#expression#Left e AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left imgSrc AST#expression#Right ?. release 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#expression#Left compressPixelMap AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async compress(pixelMap: PixelMap): Promise<PixelMap | undefined> { let start = Date.now() let compressPixelMap: PixelMap | undefined let imgSrc: image.ImageSource | undefined try { let imgInfo = pixelMap.getImageInfoSync() LoggerWrapper.i(MODULE, TAG, 'compress ' + JSON.stringify(imgInfo)); let scale = 1 let dataArray: Uint8Array = new Uint8Array(0) let maxRes = Math.max(imgInfo.size.width, imgInfo.size.height) let mosaicSize: image.Size = { width: imgInfo.size.width, height: imgInfo.size.height } if (maxRes > MAX_RESOLUTION) { let packedData = await MosaicPixelMapHelper.packing(pixelMap, 90, imgInfo.mimeType) imgSrc = image.createImageSource(packedData) scale = maxRes / MAX_RESOLUTION compressPixelMap = await imgSrc.createPixelMap({ desiredSize: { width: imgInfo.size.width / scale, height: imgInfo.size.height / scale } }) let bufferData = new ArrayBuffer(compressPixelMap.getPixelBytesNumber()); await compressPixelMap.readPixelsToBuffer(bufferData); dataArray = new Uint8Array(bufferData); mosaicSize = { width: imgInfo.size.width / scale, height: imgInfo.size.height / scale } } else { let bufferData = new ArrayBuffer(pixelMap.getPixelBytesNumber()); await pixelMap.readPixelsToBuffer(bufferData); dataArray = new Uint8Array(bufferData); } mosaicSize.width = Math.floor(mosaicSize.width) mosaicSize.height = Math.floor(mosaicSize.height) let option: image.InitializationOptions = { size: { width: mosaicSize.width, height: mosaicSize.height }, pixelFormat: image.PixelMapFormat.RGBA_8888, srcPixelFormat: imgInfo.pixelFormat } compressPixelMap = await image.createPixelMap(dataArray.buffer, option); LoggerWrapper.i(MODULE, TAG, 'compress end cost(ms)=' + (Date.now() - start)); } catch (e) { LoggerWrapper.e(MODULE, TAG, 'compress error', e); } imgSrc?.release() return compressPixelMap }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/util/MosaicPixelMapHelper.ets#L93-L134
60f522cc9f5eef447368cd92fd8f71ebed291785
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/TextConstants.ets
arkts
@author 2008 @datetime 2024/6/28 22:36 @className: TextConstants
export default class TextConstants { //文本LinHeight高度 static readonly TEXT_LINE_HEIGHT_18: number = 18; static readonly TEXT_LINE_HEIGHT_20: number = 20; static readonly TEXT_LINE_HEIGHT_22: number = 22; static readonly TEXT_LINE_HEIGHT_24: number = 24; static readonly TEXT_LINE_HEIGHT_26: number = 26; static readonly TEXT_LINE_HEIGHT_28: number = 28; }
AST#export_declaration#Left export default AST#class_declaration#Left class TextConstants AST#class_body#Left { //文本LinHeight高度 AST#property_declaration#Left static readonly TEXT_LINE_HEIGHT_18 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 18 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_LINE_HEIGHT_20 : 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 TEXT_LINE_HEIGHT_22 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 22 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_LINE_HEIGHT_24 : 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 TEXT_LINE_HEIGHT_26 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 26 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TEXT_LINE_HEIGHT_28 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 28 AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class TextConstants { static readonly TEXT_LINE_HEIGHT_18: number = 18; static readonly TEXT_LINE_HEIGHT_20: number = 20; static readonly TEXT_LINE_HEIGHT_22: number = 22; static readonly TEXT_LINE_HEIGHT_24: number = 24; static readonly TEXT_LINE_HEIGHT_26: number = 26; static readonly TEXT_LINE_HEIGHT_28: number = 28; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/TextConstants.ets#L6-L14
6a0fbcffbd5850f1674462d87b012e67623faea8
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/VHPushCardBuilder.ets
arkts
自定义参数类型
export class PushCardParams { card: VHCardInfo; webinar: VHWebinarData; constructor(card: VHCardInfo, webinar: VHWebinarData) { this.card = card; this.webinar = webinar; } }
AST#export_declaration#Left export AST#class_declaration#Left class PushCardParams AST#class_body#Left { AST#property_declaration#Left card : AST#type_annotation#Left AST#primary_type#Left VHCardInfo AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left webinar : AST#type_annotation#Left AST#primary_type#Left VHWebinarData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left card : AST#type_annotation#Left AST#primary_type#Left VHCardInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left webinar : AST#type_annotation#Left AST#primary_type#Left VHWebinarData 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 . card AST#member_expression#Right = AST#expression#Left card 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 . webinar AST#member_expression#Right = AST#expression#Left webinar 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 PushCardParams { card: VHCardInfo; webinar: VHWebinarData; constructor(card: VHCardInfo, webinar: VHWebinarData) { this.card = card; this.webinar = webinar; } }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/VHPushCardBuilder.ets#L11-L19
168b67fe50e1aae11f8473586f5a535373fbd6dc
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets
arkts
clearData
清空数据
public clearData(): void { this.messageList = []; this.notifyDataReload(); }
AST#method_declaration#Left public clearData 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 . messageList AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataReload 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
public clearData(): void { this.messageList = []; this.notifyDataReload(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/DataSource.ets#L56-L59
f136a711937959e2b9e55b1a5b32c55a4c253832
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/pages/IntroductionPage.ets
arkts
getLazySwiperData
Get the swiper data for lazy load.
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
AST#method_declaration#Left getLazySwiperData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ZonesItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 zonesViewModel AST#expression#Right . getZonesList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) 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 item 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 list AST#expression#Right . push 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#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . zoneListSwiper AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left SwiperDataSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left list AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L238-L244
84f4558b98cecc121a20027d56c33aa8ca76dea5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
clear
清除所有数据
async clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to clear preferences: ${businessError.message}`); throw new Error(businessError.message); } }
AST#method_declaration#Left async clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . clear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 clear preferences: 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 clear(): Promise<void> { try { this.checkInitialized(); await this.dataPreferences!.clear(); await this.dataPreferences!.flush(); } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed to clear preferences: ${businessError.message}`); throw new Error(businessError.message); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L266-L276
0a055263c934d326642fa7619e721a61254549a4
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/MyDay.ets
arkts
ClockHeader
时钟所在的 ListItemGroup 的标题组件。
@Builder private ClockHeader(): void { Row() { Text(this.isClockShow ? '隐藏时钟' : '显示时钟') .fontWeight(FontWeight.Medium) .fontSize(14) .fontColor($r('app.color.font_black')); } .padding('1%') .size({ width: '96%', height: '4%' }) .border({ radius: 12, style: BorderStyle.Solid, color: $r('app.color.font_grey') }) .margin('2%') .backgroundColor($r('app.color.pure_white')) .opacity(0.6) .onClick(() => { animateTo({ duration: 400, curve: Curve.Smooth }, () => this.isClockShow = !this.isClockShow); }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ClockHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClockShow AST#member_expression#Right AST#expression#Right ? AST#expression#Left '隐藏时钟' AST#expression#Right : AST#expression#Left '显示时钟' AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#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 . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.font_black' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left '1%' AST#expression#Right ) AST#modifier_chain_expression#Left . size ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left '96%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left '4%' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left style AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderStyle AST#expression#Right . Solid AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.font_grey' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left '2%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.pure_white' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.6 AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left animateTo 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 400 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 . Smooth AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClockShow 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 . isClockShow AST#member_expression#Right AST#expression#Right AST#assignment_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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private ClockHeader(): void { Row() { Text(this.isClockShow ? '隐藏时钟' : '显示时钟') .fontWeight(FontWeight.Medium) .fontSize(14) .fontColor($r('app.color.font_black')); } .padding('1%') .size({ width: '96%', height: '4%' }) .border({ radius: 12, style: BorderStyle.Solid, color: $r('app.color.font_grey') }) .margin('2%') .backgroundColor($r('app.color.pure_white')) .opacity(0.6) .onClick(() => { animateTo({ duration: 400, curve: Curve.Smooth }, () => this.isClockShow = !this.isClockShow); }); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/MyDay.ets#L519-L541
46a29349deb7a1213ca8ab3af2c496c3d107ecc3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/InputFilter.ets
arkts
通过正则表达式设置输入过滤器。匹配表达式的输入允许显示,不匹配的输入将被过滤。仅支持单个字符匹配,不支持字符串匹配。
export interface InputFilter { value: ResourceStr; //正则表达式。 error?: (value: string) => void; //正则匹配失败时,返回被过滤的内容。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface InputFilter AST#object_type#Left { AST#type_member#Left value : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; //正则表达式。 AST#type_member#Left error ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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#type_member#Right ; //正则匹配失败时,返回被过滤的内容。 } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface InputFilter { value: ResourceStr; error?: (value: string) => void; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/InputFilter.ets#L4-L7
14034adfc6375b4ef941be2241758ac17890775a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/Index.ets
arkts
PicturePreviewSample
view
export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample'
AST#export_declaration#Left export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample' AST#export_declaration#Right
export { PicturePreviewSample } from './src/main/ets/picturepreviewsample/PicturePreviewSample'
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/Index.ets#L17-L17
b0618ec9444de240443bc83d838d847a44d88ef1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
getMax
获取指定列的最大值 @param column - 列名(如:"age") @param table - 表名(如:"users") @param where - WHERE条件语句(可选,如:"status = 1") @returns Promise<number> 返回最大值(无数据时返回0)
async getMax(column: string, table: string, where?: string): Promise<number> { // 构建MAX查询SQL let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; }
AST#method_declaration#Left async getMax AST#parameter_list#Left ( AST#parameter#Left column : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left table : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left where ? : 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 构建MAX查询SQL AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sql = AST#expression#Left AST#template_literal#Left ` SELECT MAX( AST#template_substitution#Left $ { AST#expression#Left column AST#expression#Right } AST#template_substitution#Right ) FROM AST#template_substitution#Left $ { AST#expression#Left table 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#if_statement#Left if ( AST#expression#Left where AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sql += AST#expression#Left AST#template_literal#Left ` WHERE AST#template_substitution#Left $ { AST#expression#Left where 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#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left max = 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 . getData AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left sql AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left rs => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rs AST#expression#Right . getLong AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left max 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
async getMax(column: string, table: string, where?: string): Promise<number> { let sql = `SELECT MAX(${column}) FROM ${table}`; if (where) sql += ` WHERE ${where}`; const max = await this.getData<number>(sql, [], rs => rs.getLong(0)); return max ?? 0; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L284-L291
ad5f2bb1fe64bb72f83a06a3c2c518ebb28c5125
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageViewerView.ets
arkts
aboutToAppear
初始化数据源
aboutToAppear(): void { const resourceDir: string = this.context.resourceDir; this.imageDataSource.pushData(resourceDir + '/' + ImageViewerConstants.IMAGE_NAME); }
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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resourceDir : 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . resourceDir AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageDataSource AST#member_expression#Right AST#expression#Right . pushData 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 resourceDir AST#expression#Right + AST#expression#Left '/' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left ImageViewerConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . IMAGE_NAME AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
aboutToAppear(): void { const resourceDir: string = this.context.resourceDir; this.imageDataSource.pushData(resourceDir + '/' + ImageViewerConstants.IMAGE_NAME); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageViewerView.ets#L46-L49
d8ab3e13b56161778f5927c7d928bca03e68bd6b
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets
arkts
getCipherTextSpec
获取转换SM2密文格式,ASN.1格式转换为C1C2C3或C1C3C2 @param cipherText ASN.1格式的SM2密文参数 @param cipherMode 0-C1C2C3 、1-C1C3C2,默认为0 @returns
static getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string { try { let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2'); let startPre = "04"; // bigint 转十六进制需要补零,参考BC转换 let c1x = CryptoHelper.toHexWithPaddingZero(spec.xCoordinate); let c1y = CryptoHelper.toHexWithPaddingZero(spec.yCoordinate); let c3 = buffer.from(spec.hashData).toString('hex'); let c2 = buffer.from(spec.cipherTextData).toString('hex'); if (mode === 0) { return (startPre + c1x + c1y + c2 + c3).toUpperCase(); } else { return (startPre + c1x + c1y + c3 + c2).toUpperCase(); } } catch (err) { let e: BusinessError = err as BusinessError; LogUtil.error(`getCipherTextSpec error, ${e.code}, ${e.message}`); } return ""; }
AST#method_declaration#Left static getCipherTextSpec AST#parameter_list#Left ( AST#parameter#Left cipherText : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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_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#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left spec : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SM2CipherTextSpec 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#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . SM2CryptoUtil AST#member_expression#Right AST#expression#Right . getCipherTextSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left cipherText AST#expression#Right , AST#expression#Left 'C1C3C2' 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 startPre = AST#expression#Left "04" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // bigint 转十六进制需要补零,参考BC转换 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left c1x = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . toHexWithPaddingZero AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . xCoordinate 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 c1y = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoHelper AST#expression#Right . toHexWithPaddingZero AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . yCoordinate 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 c3 = 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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . hashData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hex' 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 c2 = 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 buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left spec AST#expression#Right . cipherTextData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'hex' 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 mode 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_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#binary_expression#Left AST#expression#Left startPre AST#expression#Right + AST#expression#Left c1x AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c1y AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c3 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_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#binary_expression#Left AST#expression#Left startPre AST#expression#Right + AST#expression#Left c1x AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c1y AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c3 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left c2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . toUpperCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right = 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 LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getCipherTextSpec error, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left e 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#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 getCipherTextSpec(cipherText: cryptoFramework.DataBlob, mode: number = 0): string { try { let spec: cryptoFramework.SM2CipherTextSpec = cryptoFramework.SM2CryptoUtil.getCipherTextSpec(cipherText, 'C1C3C2'); let startPre = "04"; let c1x = CryptoHelper.toHexWithPaddingZero(spec.xCoordinate); let c1y = CryptoHelper.toHexWithPaddingZero(spec.yCoordinate); let c3 = buffer.from(spec.hashData).toString('hex'); let c2 = buffer.from(spec.cipherTextData).toString('hex'); if (mode === 0) { return (startPre + c1x + c1y + c2 + c3).toUpperCase(); } else { return (startPre + c1x + c1y + c3 + c2).toUpperCase(); } } catch (err) { let e: BusinessError = err as BusinessError; LogUtil.error(`getCipherTextSpec error, ${e.code}, ${e.message}`); } return ""; }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM2.ets#L181-L201
a3311a5764365116dfa6e54c04c16142cfb3e53d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/NetUtil.ets
arkts
网络变化事件
export class netEventHandler { /** * 网络可用 */ availableCallback?: Callback<connection.NetHandle>; /** * 网络不可用 */ unavailableCallback?: Callback<void>; /** * 网络能力变化 */ capabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>; /** * 网络连接信息变化 */ connPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>; /** * 网络阻塞 */ blockStatusChangeCallback?: Callback<connection.NetBlockStatusInfo>; /** * 网络丢失 */ lostCallback?: Callback<connection.NetHandle>; }
AST#export_declaration#Left export AST#class_declaration#Left class netEventHandler AST#class_body#Left { /** * 网络可用 */ AST#property_declaration#Left availableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 网络不可用 */ AST#property_declaration#Left unavailableCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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#property_declaration#Right /** * 网络能力变化 */ AST#property_declaration#Left capabilitiesChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetCapabilityInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 网络连接信息变化 */ AST#property_declaration#Left connPropertiesChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetConnectionPropertyInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 网络阻塞 */ AST#property_declaration#Left blockStatusChangeCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetBlockStatusInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 网络丢失 */ AST#property_declaration#Left lostCallback ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class netEventHandler { availableCallback?: Callback<connection.NetHandle>; unavailableCallback?: Callback<void>; capabilitiesChangeCallback?: Callback<connection.NetCapabilityInfo>; connPropertiesChangeCallback?: Callback<connection.NetConnectionPropertyInfo>; blockStatusChangeCallback?: Callback<connection.NetBlockStatusInfo>; lostCallback?: Callback<connection.NetHandle>; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/NetUtil.ets#L152-L177
c8410e362c881b00e2fdb20e57ac49901743d296
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
AI生成响应接口
export interface AIGeneratedResponse { content: string; type?: MessageType; metadata?: Record<string, string | number | boolean>; attachments?: MessageAttachment[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AIGeneratedResponse AST#object_type#Left { AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type ? : AST#type_annotation#Left AST#primary_type#Left MessageType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left metadata ? : 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#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left boolean 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#type_member#Right ; AST#type_member#Left attachments ? : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MessageAttachment [ ] AST#array_type#Right 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 AIGeneratedResponse { content: string; type?: MessageType; metadata?: Record<string, string | number | boolean>; attachments?: MessageAttachment[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L218-L223
8d7f22be936909b76fbaf9673b4ec1cc12d68589
github
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/tables/TodoTable.ets
arkts
updateData
更新数据
updateData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName); predicates.equalTo('id', todoItem.id); this.todoTable.updateData(predicates, valueBucket, callback); }
AST#method_declaration#Left updateData AST#parameter_list#Left ( AST#parameter#Left todoItem : AST#type_annotation#Left AST#primary_type#Left TodoItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left valueBucket : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ValuesBucket AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left generateBucket AST#expression#Right AST#argument_list#Left ( AST#expression#Left todoItem 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 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 AST#member_expression#Left AST#expression#Left TODO_TABLE AST#expression#Right . tableName 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 predicates AST#expression#Right . equalTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'id' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left todoItem AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#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 . todoTable AST#member_expression#Right AST#expression#Right . updateData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left predicates AST#expression#Right , AST#expression#Left valueBucket AST#expression#Right , AST#expression#Left callback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
updateData(todoItem: TodoItem, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(todoItem); let predicates = new relationalStore.RdbPredicates(TODO_TABLE.tableName); predicates.equalTo('id', todoItem.id); this.todoTable.updateData(predicates, valueBucket, callback); }
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/tables/TodoTable.ets#L46-L51
d7263eed940359311978b559c9bb70d99e74dc4f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebOptions.ets
arkts
ArkWeb参数
export class ArkWebOptions { downloadPath: string = FileUtils.getCacheDirPath(); //ArkWeb下载文件夹的路径 renderMode: RenderMode = RenderMode.ASYNC_RENDER; //表示当前Web组件的渲染方式,RenderMode.ASYNC_RENDER表示Web组件异步渲染,RenderMode.SYNC_RENDER表示支持Web组件同步渲染能力,默认值RenderMode.ASYNC_RENDER,该模式不支持动态调整。 incognitoMode: boolean = false; //表示当前创建的webview是否是隐私模式。true表示创建隐私模式的webview,false表示创建正常模式的webview。 默认值:false。 sharedRenderProcessToken: string = ""; //表示当前Web组件指定共享渲染进程的token,多渲染进程模式下,相同token的Web组件会优先尝试复用与token相绑定的渲染进程。token与渲染进程的绑定发生在渲染进程的初始化阶段。当渲染进程没有关联的Web组件时,其与token绑定关系将被移除。 默认值: ""。 /** * 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认开启。 */ domStorageAccess: boolean = true; /** * 设置是否允许执行JavaScript脚本,默认允许执行。 */ javaScriptAccess: boolean = true; /** * 设置是否开启应用中文件系统的访问。$rawfile(filepath/filename)中rawfile路径的文件不受该属性影响而限制访问。 * 从API version 12开始,fileAccess默认不启用。同时,当fileAccess为false的时候,仅只读资源目录/data/storage/el1/bundle/entry/resources/resfile里面的file协议资源依然可以访问,不受fileAccess管控。 */ fileAccess: boolean = false; /** * 设置是否允许自动加载图片资源,默认允许。 */ imageAccess: boolean = true; /** * 设置是否允许从网络加载图片资源(通过HTTP和HTTPS访问的资源),默认允许访问。 * 设置是否允许从网络加载图片资源。默认值:true。 */ onlineImageAccess: boolean = true; /** * 设置Web过滚动模式,默认关闭。当过滚动模式开启时,当用户在Web根页面上滑动到边缘时,Web会通过弹性动画弹回界面,根页面上的内部页面不会触发回弹。 * 设置Web的过滚动模式为关闭或开启。默认值:OverScrollMode.NEVER。 */ overScrollMode: OverScrollMode = OverScrollMode.NEVER; /** * 设置是否允许加载超文本传输协议(HTTP)和超文本传输安全协议(HTTPS)混合内容,默认不允许加载HTTP和HTTPS混合内容。 * 要设置的混合内容。默认值:MixedMode.None。 */ mixedMode: MixedMode = MixedMode.None /** * 设置是否支持手势进行缩放,默认允许执行缩放。 */ zoomAccess: boolean = true; /** * 设置是否使用概览模式加载网页,默认使用该方式。当前仅支持移动设备。 */ overviewModeAccess: boolean = true; /** * 设置是否开启数据库存储API权限,默认不开启。 */ databaseAccess: boolean = false; /** * 设置是否开启获取地理位置权限,默认开启。具体使用方式参考管理位置权限。 */ geolocationAccess: boolean = true; /** * 设置有声视频播放是否需要用户手动点击,静音视频播放不受该接口管控,默认需要。 */ mediaPlayGestureAccess: boolean = true; /** * 设置是否开启多窗口权限,默认不开启。使能多窗口权限时,需要实现onWindowNew事件,示例代码参考onWindowNew事件。 */ multiWindowAccess: boolean = false; /** * 设置是否显示横向滚动条,包括系统默认滚动条和用户自定义滚动条。默认显示。 */ horizontalScrollBarAccess: boolean = true; /** * 设置是否显示纵向滚动条,包括系统默认滚动条和用户自定义滚动条。默认显示。 */ verticalScrollBarAccess: boolean = true; /** * 设置缓存模式。默认值:CacheMode.Default。 */ cacheMode: CacheMode = CacheMode.Default; /** * 设置剪贴板复制范围选项。默认值:CopyOptions.LocalDevice。 */ copyOptions: CopyOptions = CopyOptions.LocalDevice; /** * 设置页面的文本缩放百分比。取值为整数,范围为(0, +∞)。默认值:100。 */ textZoomRatio: number = 100; /** * 设置整体页面的缩放百分比,默认为100。 */ initialScale: number = 100; /** * 设置Web组件是否阻止从网络加载资源。默认值:false。 */ blockNetwork: boolean = false; /** * 设置网页的默认等宽字体大小。单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:13。 */ defaultFixedFontSize: number = 13; /** * 设置网页的默认字体大小,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:16。 */ defaultFontSize: number = 13; /** * 设置网页字体大小最小值,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:8。 */ minFontSize: number = 8; /** * 设置网页逻辑字体大小最小值,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:8。 */ minLogicalFontSize: number = 8; /** * 设置网页的fixed font字体库。默认值:monospace。 */ webFixedFont: string = "monospace"; /** * 设置网页的sans serif font字体库。默认值:sans-serif。 */ webSansSerifFont: string = "sans-serif"; /** * 设置网页的serif font字体库。默认值:serif。 */ webSerifFont: string = "serif"; /** * 设置网页的standard font字体库。默认值:sans serif。 */ webStandardFont: string = "sans serif"; /** * 设置网页的fantasy font字体库。默认值:fantasy。 */ webFantasyFont: string = "fantasy"; /** * 设置网页的cursive font字体库。默认值:cursive。 */ webCursiveFont: string = "cursive"; /** * 设置Web深色模式,默认关闭。当深色模式开启时,Web将启用媒体查询prefers-color-scheme中网页所定义的深色样式,若网页未定义深色样式,则保持原状。如需开启强制深色模式,建议配合forceDarkAccess使用。 */ darkMode: WebDarkMode = WebDarkMode.Off; /** * 设置网页是否开启强制深色模式。默认关闭。该属性仅在darkMode开启深色模式时生效。 */ forceDarkAccess: boolean = false; /** * 设置网页是否开启捏合流畅模式,默认不开启。 */ pinchSmooth: boolean = false; /** * 设置网页是否可以通过JavaScript自动打开新窗口。 * 该属性为true时,可通过JavaScript自动打开新窗口。该属性为false时,用户行为仍可通过JavaScript自动打开新窗口,但非用户行为不能通过JavaScript自动打开新窗口。此处的用户行为是指,在用户对Web组件进行点击等操作后,同时在5秒内请求打开新窗口(window.open)的行为。 * 该属性仅在javaScriptAccess开启时生效。 * 该属性在multiWindowAccess开启时打开新窗口,关闭时打开本地窗口。 * 该属性的默认值与系统属性persist.web.allowWindowOpenMethod.enabled 保持一致,如果未设置系统属性则默认值为false。 */ allowWindowOpenMethod: boolean = false; /** * 设置Web媒体播放的策略,其中包括:Web中的音频在重新获焦后能够自动续播的有效期、应用内多个Web实例的音频是否独占。 */ mediaOptions: WebMediaOptions = { resumeInterval: 0, audioExclusive: true }; /** * 将JavaScript脚本注入到Web组件中,当指定页面或者文档开始加载时,该脚本将在其来源与scriptRules匹配的任何页面中执行。 * 该脚本将在页面的任何JavaScript代码之前运行,并且DOM树此时可能尚未加载、渲染完毕。 */ javaScriptOnDocumentStart: Array<ScriptItem> = []; /** * 将JavaScript脚本注入到Web组件中,当指定页面或者文档加载完成时,该脚本将在其来源与scriptRules匹配的任何页面中执行。 * 该脚本将在页面的任何JavaScript代码之后运行,并且DOM树此时已经加载、渲染完毕。 */ javaScriptOnDocumentEnd: Array<ScriptItem> = []; /** * 设置web布局模式,跟随系统或自适应布局。默认值:WebLayoutMode.NONE。 */ layoutMode: WebLayoutMode = WebLayoutMode.NONE; /** * 调用以设置嵌套滚动选项。默认scrollForward和scrollBackward模式为NestedScrollMode.SELF_FIRST。 */ nestedScroll: NestedScrollOptions = { scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.SELF_FIRST }; /** * 设置是否开启同层渲染功能,默认不开启。 */ enableNativeEmbedMode: boolean = false; /** * 设置网页的默认字符编码。默认值:"UTF-8"。 */ defaultTextEncodingFormat: string = "UTF-8"; /** * 设置meta标签的viewport属性是否可用。默认值:true。 */ metaViewport: boolean = true; /** * 设置使能文本自动调整大小。默认值:true。 */ textAutosizing: boolean = true; /** * 开启应用接管网页媒体播放功能。默认值:{enable: false, shouldOverlay: false}。 * enable: 是否开启该功能。 * shouldOverlay: 该功能开启后, 应用接管网页视频的播放器画面是否覆盖网页内容。 */ enableNativeMediaPlayer: NativeMediaPlayerConfig = { enable: false, shouldOverlay: false }; /** * Web组件自定义菜单扩展项接口,允许用户设置扩展项的文本内容、图标、回调方法。 * 该接口只支持选中纯文本,当选中内容包含图片及其他非文本内容时,action信息中会显示乱码。 */ selectionMenuOptions: Array<ExpandedMenuItemOptions> = []; /** * Web组件自定义软件键盘避让模式。默认是WebKeyboardAvoidMode.RESIZE_CONTENT避让行为。 * 当UIContext设置的键盘避让模式为KeyboardAvoidMode.RESIZE模式时,该接口功能不生效。 */ keyboardAvoidMode: WebKeyboardAvoidMode = WebKeyboardAvoidMode.RESIZE_CONTENT; /** * 控制组件扩展其安全区域。 * types: 配置扩展安全区域的类型。未添加Metadata配置项时,页面不避让挖孔,CUTOUT类型不生效。默认值:[SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD];非法值:按默认值处理。 * edges: 配置扩展安全区域的边缘。默认值:[SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END];非法值:按默认值处理。扩展至所有避让区域。 * */ expandSafeArea: SafeArea = { types: [SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD], edges: [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END] }; }
AST#export_declaration#Left export AST#class_declaration#Left class ArkWebOptions AST#class_body#Left { AST#property_declaration#Left downloadPath : AST#type_annotation#Left AST#primary_type#Left string 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 FileUtils AST#expression#Right . getCacheDirPath 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 //ArkWeb下载文件夹的路径 AST#property_declaration#Left renderMode : AST#type_annotation#Left AST#primary_type#Left RenderMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left RenderMode AST#expression#Right . ASYNC_RENDER AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right //表示当前Web组件的渲染方式,RenderMode.ASYNC_RENDER表示Web组件异步渲染,RenderMode.SYNC_RENDER表示支持Web组件同步渲染能力,默认值RenderMode.ASYNC_RENDER,该模式不支持动态调整。 AST#property_declaration#Left incognitoMode : 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 //表示当前创建的webview是否是隐私模式。true表示创建隐私模式的webview,false表示创建正常模式的webview。 默认值:false。 AST#property_declaration#Left sharedRenderProcessToken : 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 //表示当前Web组件指定共享渲染进程的token,多渲染进程模式下,相同token的Web组件会优先尝试复用与token相绑定的渲染进程。token与渲染进程的绑定发生在渲染进程的初始化阶段。当渲染进程没有关联的Web组件时,其与token绑定关系将被移除。 默认值: ""。 /** * 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认开启。 */ AST#property_declaration#Left domStorageAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否允许执行JavaScript脚本,默认允许执行。 */ AST#property_declaration#Left javaScriptAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否开启应用中文件系统的访问。$rawfile(filepath/filename)中rawfile路径的文件不受该属性影响而限制访问。 * 从API version 12开始,fileAccess默认不启用。同时,当fileAccess为false的时候,仅只读资源目录/data/storage/el1/bundle/entry/resources/resfile里面的file协议资源依然可以访问,不受fileAccess管控。 */ AST#property_declaration#Left fileAccess : 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 imageAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否允许从网络加载图片资源(通过HTTP和HTTPS访问的资源),默认允许访问。 * 设置是否允许从网络加载图片资源。默认值:true。 */ AST#property_declaration#Left onlineImageAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置Web过滚动模式,默认关闭。当过滚动模式开启时,当用户在Web根页面上滑动到边缘时,Web会通过弹性动画弹回界面,根页面上的内部页面不会触发回弹。 * 设置Web的过滚动模式为关闭或开启。默认值:OverScrollMode.NEVER。 */ AST#property_declaration#Left overScrollMode : AST#type_annotation#Left AST#primary_type#Left OverScrollMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left OverScrollMode AST#expression#Right . NEVER AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否允许加载超文本传输协议(HTTP)和超文本传输安全协议(HTTPS)混合内容,默认不允许加载HTTP和HTTPS混合内容。 * 要设置的混合内容。默认值:MixedMode.None。 */ AST#property_declaration#Left mixedMode : AST#type_annotation#Left AST#primary_type#Left MixedMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left MixedMode AST#expression#Right . None AST#member_expression#Right /** * 设置是否支持手势进行缩放,默认允许执行缩放。 */ AST#ERROR#Left zoomAccess : boolean AST#ERROR#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否使用概览模式加载网页,默认使用该方式。当前仅支持移动设备。 */ AST#property_declaration#Left overviewModeAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否开启数据库存储API权限,默认不开启。 */ AST#property_declaration#Left databaseAccess : 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 geolocationAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置有声视频播放是否需要用户手动点击,静音视频播放不受该接口管控,默认需要。 */ AST#property_declaration#Left mediaPlayGestureAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否开启多窗口权限,默认不开启。使能多窗口权限时,需要实现onWindowNew事件,示例代码参考onWindowNew事件。 */ AST#property_declaration#Left multiWindowAccess : 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 horizontalScrollBarAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否显示纵向滚动条,包括系统默认滚动条和用户自定义滚动条。默认显示。 */ AST#property_declaration#Left verticalScrollBarAccess : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置缓存模式。默认值:CacheMode.Default。 */ AST#property_declaration#Left cacheMode : AST#type_annotation#Left AST#primary_type#Left CacheMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CacheMode AST#expression#Right . Default AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置剪贴板复制范围选项。默认值:CopyOptions.LocalDevice。 */ AST#property_declaration#Left copyOptions : AST#type_annotation#Left AST#primary_type#Left CopyOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left CopyOptions AST#expression#Right . LocalDevice AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置页面的文本缩放百分比。取值为整数,范围为(0, +∞)。默认值:100。 */ AST#property_declaration#Left textZoomRatio : 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 /** * 设置整体页面的缩放百分比,默认为100。 */ AST#property_declaration#Left initialScale : 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 /** * 设置Web组件是否阻止从网络加载资源。默认值:false。 */ AST#property_declaration#Left blockNetwork : 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 /** * 设置网页的默认等宽字体大小。单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:13。 */ AST#property_declaration#Left defaultFixedFontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 13 AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的默认字体大小,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:16。 */ AST#property_declaration#Left defaultFontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 13 AST#expression#Right ; AST#property_declaration#Right /** * 设置网页字体大小最小值,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:8。 */ AST#property_declaration#Left minFontSize : 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 /** * 设置网页逻辑字体大小最小值,单位px。输入值的范围为-2^31到2^31-1,实际渲染时超过72的值按照72进行渲染,低于1的值按照1进行渲染。默认值:8。 */ AST#property_declaration#Left minLogicalFontSize : 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 /** * 设置网页的fixed font字体库。默认值:monospace。 */ AST#property_declaration#Left webFixedFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "monospace" AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的sans serif font字体库。默认值:sans-serif。 */ AST#property_declaration#Left webSansSerifFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "sans-serif" AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的serif font字体库。默认值:serif。 */ AST#property_declaration#Left webSerifFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "serif" AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的standard font字体库。默认值:sans serif。 */ AST#property_declaration#Left webStandardFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "sans serif" AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的fantasy font字体库。默认值:fantasy。 */ AST#property_declaration#Left webFantasyFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "fantasy" AST#expression#Right ; AST#property_declaration#Right /** * 设置网页的cursive font字体库。默认值:cursive。 */ AST#property_declaration#Left webCursiveFont : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "cursive" AST#expression#Right ; AST#property_declaration#Right /** * 设置Web深色模式,默认关闭。当深色模式开启时,Web将启用媒体查询prefers-color-scheme中网页所定义的深色样式,若网页未定义深色样式,则保持原状。如需开启强制深色模式,建议配合forceDarkAccess使用。 */ AST#property_declaration#Left darkMode : AST#type_annotation#Left AST#primary_type#Left WebDarkMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left WebDarkMode AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置网页是否开启强制深色模式。默认关闭。该属性仅在darkMode开启深色模式时生效。 */ AST#property_declaration#Left forceDarkAccess : 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 pinchSmooth : 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 /** * 设置网页是否可以通过JavaScript自动打开新窗口。 * 该属性为true时,可通过JavaScript自动打开新窗口。该属性为false时,用户行为仍可通过JavaScript自动打开新窗口,但非用户行为不能通过JavaScript自动打开新窗口。此处的用户行为是指,在用户对Web组件进行点击等操作后,同时在5秒内请求打开新窗口(window.open)的行为。 * 该属性仅在javaScriptAccess开启时生效。 * 该属性在multiWindowAccess开启时打开新窗口,关闭时打开本地窗口。 * 该属性的默认值与系统属性persist.web.allowWindowOpenMethod.enabled 保持一致,如果未设置系统属性则默认值为false。 */ AST#property_declaration#Left allowWindowOpenMethod : 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 /** * 设置Web媒体播放的策略,其中包括:Web中的音频在重新获焦后能够自动续播的有效期、应用内多个Web实例的音频是否独占。 */ AST#property_declaration#Left mediaOptions : AST#type_annotation#Left AST#primary_type#Left WebMediaOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left resumeInterval AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left audioExclusive 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#property_declaration#Right /** * 将JavaScript脚本注入到Web组件中,当指定页面或者文档开始加载时,该脚本将在其来源与scriptRules匹配的任何页面中执行。 * 该脚本将在页面的任何JavaScript代码之前运行,并且DOM树此时可能尚未加载、渲染完毕。 */ AST#property_declaration#Left javaScriptOnDocumentStart : 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 ScriptItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 将JavaScript脚本注入到Web组件中,当指定页面或者文档加载完成时,该脚本将在其来源与scriptRules匹配的任何页面中执行。 * 该脚本将在页面的任何JavaScript代码之后运行,并且DOM树此时已经加载、渲染完毕。 */ AST#property_declaration#Left javaScriptOnDocumentEnd : 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 ScriptItem AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置web布局模式,跟随系统或自适应布局。默认值:WebLayoutMode.NONE。 */ AST#property_declaration#Left layoutMode : AST#type_annotation#Left AST#primary_type#Left WebLayoutMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left WebLayoutMode AST#expression#Right . NONE AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 调用以设置嵌套滚动选项。默认scrollForward和scrollBackward模式为NestedScrollMode.SELF_FIRST。 */ AST#property_declaration#Left nestedScroll : AST#type_annotation#Left AST#primary_type#Left NestedScrollOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left scrollForward AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left NestedScrollMode AST#expression#Right . SELF_FIRST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left scrollBackward AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left NestedScrollMode AST#expression#Right . SELF_FIRST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置是否开启同层渲染功能,默认不开启。 */ AST#property_declaration#Left enableNativeEmbedMode : 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 /** * 设置网页的默认字符编码。默认值:"UTF-8"。 */ AST#property_declaration#Left defaultTextEncodingFormat : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "UTF-8" AST#expression#Right ; AST#property_declaration#Right /** * 设置meta标签的viewport属性是否可用。默认值:true。 */ AST#property_declaration#Left metaViewport : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 设置使能文本自动调整大小。默认值:true。 */ AST#property_declaration#Left textAutosizing : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * 开启应用接管网页媒体播放功能。默认值:{enable: false, shouldOverlay: false}。 * enable: 是否开启该功能。 * shouldOverlay: 该功能开启后, 应用接管网页视频的播放器画面是否覆盖网页内容。 */ AST#property_declaration#Left enableNativeMediaPlayer : AST#type_annotation#Left AST#primary_type#Left NativeMediaPlayerConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enable 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 shouldOverlay AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * Web组件自定义菜单扩展项接口,允许用户设置扩展项的文本内容、图标、回调方法。 * 该接口只支持选中纯文本,当选中内容包含图片及其他非文本内容时,action信息中会显示乱码。 */ AST#property_declaration#Left selectionMenuOptions : 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 ExpandedMenuItemOptions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right /** * Web组件自定义软件键盘避让模式。默认是WebKeyboardAvoidMode.RESIZE_CONTENT避让行为。 * 当UIContext设置的键盘避让模式为KeyboardAvoidMode.RESIZE模式时,该接口功能不生效。 */ AST#property_declaration#Left keyboardAvoidMode : AST#type_annotation#Left AST#primary_type#Left WebKeyboardAvoidMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left WebKeyboardAvoidMode AST#expression#Right . RESIZE_CONTENT AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 控制组件扩展其安全区域。 * types: 配置扩展安全区域的类型。未添加Metadata配置项时,页面不避让挖孔,CUTOUT类型不生效。默认值:[SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD];非法值:按默认值处理。 * edges: 配置扩展安全区域的边缘。默认值:[SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END];非法值:按默认值处理。扩展至所有避让区域。 * */ AST#property_declaration#Left expandSafeArea : AST#type_annotation#Left AST#primary_type#Left SafeArea AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left types AST#property_name#Right : 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#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . CUTOUT AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . KEYBOARD AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left edges AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . TOP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . BOTTOM AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . START AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaEdge AST#expression#Right . END AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class ArkWebOptions { downloadPath: string = FileUtils.getCacheDirPath(); renderMode: RenderMode = RenderMode.ASYNC_RENDER; incognitoMode: boolean = false; sharedRenderProcessToken: string = ""; domStorageAccess: boolean = true; javaScriptAccess: boolean = true; fileAccess: boolean = false; imageAccess: boolean = true; onlineImageAccess: boolean = true; overScrollMode: OverScrollMode = OverScrollMode.NEVER; mixedMode: MixedMode = MixedMode.None zoomAccess: boolean = true; overviewModeAccess: boolean = true; databaseAccess: boolean = false; geolocationAccess: boolean = true; mediaPlayGestureAccess: boolean = true; multiWindowAccess: boolean = false; horizontalScrollBarAccess: boolean = true; verticalScrollBarAccess: boolean = true; cacheMode: CacheMode = CacheMode.Default; copyOptions: CopyOptions = CopyOptions.LocalDevice; textZoomRatio: number = 100; initialScale: number = 100; blockNetwork: boolean = false; defaultFixedFontSize: number = 13; defaultFontSize: number = 13; minFontSize: number = 8; minLogicalFontSize: number = 8; webFixedFont: string = "monospace"; webSansSerifFont: string = "sans-serif"; webSerifFont: string = "serif"; webStandardFont: string = "sans serif"; webFantasyFont: string = "fantasy"; webCursiveFont: string = "cursive"; darkMode: WebDarkMode = WebDarkMode.Off; forceDarkAccess: boolean = false; pinchSmooth: boolean = false; allowWindowOpenMethod: boolean = false; mediaOptions: WebMediaOptions = { resumeInterval: 0, audioExclusive: true }; javaScriptOnDocumentStart: Array<ScriptItem> = []; javaScriptOnDocumentEnd: Array<ScriptItem> = []; layoutMode: WebLayoutMode = WebLayoutMode.NONE; nestedScroll: NestedScrollOptions = { scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.SELF_FIRST }; enableNativeEmbedMode: boolean = false; defaultTextEncodingFormat: string = "UTF-8"; metaViewport: boolean = true; textAutosizing: boolean = true; enableNativeMediaPlayer: NativeMediaPlayerConfig = { enable: false, shouldOverlay: false }; selectionMenuOptions: Array<ExpandedMenuItemOptions> = []; keyboardAvoidMode: WebKeyboardAvoidMode = WebKeyboardAvoidMode.RESIZE_CONTENT; expandSafeArea: SafeArea = { types: [SafeAreaType.SYSTEM, SafeAreaType.CUTOUT, SafeAreaType.KEYBOARD], edges: [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM, SafeAreaEdge.START, SafeAreaEdge.END] }; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebOptions.ets#L7-L227
fb514c3198b6bc432601c1b19510517828ff71ab
gitee