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
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreviewCustomBuilder.ets
arkts
BindContextMenuPreviewCustomBuilder
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 BindContextMenuPreviewCustomBuilder(name: string, param: Object) { BindContextMenuPreviewCustomBuilderExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function BindContextMenuPreviewCustomBuilder 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 BindContextMenuPreviewCustomBuilderExample ( ) 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 BindContextMenuPreviewCustomBuilder(name: string, param: Object) { BindContextMenuPreviewCustomBuilderExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreviewCustomBuilder.ets#L16-L19
b7b20cb300ddd2ad86135ce2292e981425c96091
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/components/common/LoadingView.ets
arkts
PageLoadingView
页面级加载视图
@Component export struct PageLoadingView { @Prop message: string = '页面加载中...'; build() { Column() { LoadingView({ message: this.message, size: 48, showBackground: true, backgroundColor: '#f5f5f5' }) } .width('100%') .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PageLoadingView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right message : 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#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 LoadingView ( AST#component_parameters#Left { AST#component_parameter#Left message : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left size : AST#expression#Left 48 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showBackground : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left backgroundColor : AST#expression#Left '#f5f5f5' 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 . 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 } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct PageLoadingView { @Prop message: string = '页面加载中...'; build() { Column() { LoadingView({ message: this.message, size: 48, showBackground: true, backgroundColor: '#f5f5f5' }) } .width('100%') .height('100%') } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/components/common/LoadingView.ets#L39-L55
b7f174a5d30e007e0ba4d425fdc1949e07463a62
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
clearSessionCookie
异步promise方式清除所有会话cookie。 @returns
static async clearSessionCookie(): Promise<void> { return await webview.WebCookieManager.clearSessionCookie(); }
AST#method_declaration#Left static async clearSessionCookie AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left webview AST#expression#Right AST#await_expression#Right AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . clearSessionCookie 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 clearSessionCookie(): Promise<void> { return await webview.WebCookieManager.clearSessionCookie(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L215-L217
9d1f5e4693c11546cefdebeca96d6650e69b2ac7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets
arkts
startPackUp
收起方法,与startPackUp绑定
private startPackUp(): void { if (this.startPackUpFloor) { this.packUpFloor(); this.startPackUpFloor = false; } }
AST#method_declaration#Left private startPackUp 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startPackUpFloor AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . packUpFloor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startPackUpFloor AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
private startPackUp(): void { if (this.startPackUpFloor) { this.packUpFloor(); this.startPackUpFloor = false; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondfloorloadanimation/src/main/ets/view/FloorView.ets#L64-L69
6d0a700fb5fde9e70ee84a29bacd0b7787e8e7a4
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/set_lib_func_004_F.ets
arkts
Introduction 库函数-set_values
export function set_lib_func_004_F(taint_src : string) { let s = new Set<string>(); s.add("_"); taint.Sink(s.values()); }
AST#export_declaration#Left export AST#function_declaration#Left function set_lib_func_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left s = 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . add 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . values AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function set_lib_func_004_F(taint_src : string) { let s = new Set<string>(); s.add("_"); taint.Sink(s.values()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/set_lib_func_004_F.ets#L6-L10
da1ef3fdd1e3cc9255299197a4ffe9c46012e209
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
decodeECB192
解密-ECB模式-192位 @param str 加密的字符串 @param aesKey AES密钥-192位 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 @returns
static decodeECB192(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES192', 'AES192|ECB|PKCS7', 192, keyCoding, dataCoding); }
AST#method_declaration#Left static decodeECB192 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyCoding : 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#parameter#Right , AST#parameter#Left dataCoding : 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 'base64' 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . decodeECB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left aesKey AST#expression#Right , AST#expression#Left 'AES192' AST#expression#Right , AST#expression#Left 'AES192|ECB|PKCS7' AST#expression#Right , AST#expression#Left 192 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left dataCoding 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 decodeECB192(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.decodeECB(str, aesKey, 'AES192', 'AES192|ECB|PKCS7', 192, keyCoding, dataCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L297-L300
8ed49b818ecbf1e21595e2efcb73d24ad362e4a4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/component/PasswordInputField.ets
arkts
构建密码输入组件 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.password, type: this.isPasswordHidden ? "password" : "normal", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: this.placeholder, placeholderColor: $r("app.color.text_quaternary"), showPasswordIcon: false, rightIcon: this.isPasswordHidden ? $r("app.media.ic_eye_hide") : $r("app.media.ic_eye"), hasBorder: false, borderLeft: 0, fieldPadding: 0, onRightIconClick: (): void => { this.isPasswordHidden = !this.isPasswordHidden; }, onFieldFocus: (): void => { this.isFocused = true; }, onFieldBlur: (): void => { this.isFocused = false; }, onChange: (value: IBestFieldValueType): void => { this.onPasswordChange(`${value ?? ""}`); } }) .width(P100); FocusableDivider({ focused: this.isFocused }); } }
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#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 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 IBestField ( AST#component_parameters#Left { AST#component_parameter#Left value : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . password AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left type : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPasswordHidden AST#member_expression#Right AST#expression#Right ? AST#expression#Left "password" AST#expression#Right : AST#expression#Left "normal" AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showLabel : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left labelWidth : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left inputAlign : AST#expression#Left "left" AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left inputFontSize : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left inputFontColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left placeholderColor : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_quaternary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showPasswordIcon : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left rightIcon : AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPasswordHidden AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_eye_hide" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.ic_eye" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left hasBorder : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left borderLeft : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left fieldPadding : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRightIconClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPasswordHidden 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 . isPasswordHidden 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#component_parameter#Right , AST#component_parameter#Left onFieldFocus : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFocused 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#component_parameter#Right , AST#component_parameter#Left onFieldBlur : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFocused AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#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 IBestFieldValueType 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 this AST#expression#Right . onPasswordChange AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_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#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 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#ui_custom_component_statement#Left FocusableDivider ( AST#component_parameters#Left { AST#component_parameter#Left focused : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFocused AST#member_expression#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#build_body#Right AST#build_method#Right
build(): void { ColumnStart({ widthValue: P100 }) { IBestField({ value: this.password, type: this.isPasswordHidden ? "password" : "normal", showLabel: false, labelWidth: 0, inputAlign: "left", inputFontSize: 16, inputFontColor: $r("app.color.text_primary"), placeholder: this.placeholder, placeholderColor: $r("app.color.text_quaternary"), showPasswordIcon: false, rightIcon: this.isPasswordHidden ? $r("app.media.ic_eye_hide") : $r("app.media.ic_eye"), hasBorder: false, borderLeft: 0, fieldPadding: 0, onRightIconClick: (): void => { this.isPasswordHidden = !this.isPasswordHidden; }, onFieldFocus: (): void => { this.isFocused = true; }, onFieldBlur: (): void => { this.isFocused = false; }, onChange: (value: IBestFieldValueType): void => { this.onPasswordChange(`${value ?? ""}`); } }) .width(P100); FocusableDivider({ focused: this.isFocused }); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/component/PasswordInputField.ets#L42-L76
07bf39a5150e886f472c6ee61cf7990c9df47c73
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.prompt.d.ets
arkts
@file @kit ArkUI Defines the options of ShowToast. @interface ShowToastOptions @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 @deprecated since 8 @useinstead ohos.prompt
export interface ShowToastOptions { /** * Text to display. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ message: string; /** * Duration of toast dialog box. The default value is 1500. * The recommended value ranges from 1500 ms to 10000ms. * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ duration?: number; /** * The distance between toast dialog box and the bottom of screen. * * @type { ?(string | number) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 5 * @deprecated since 8 */ bottom?: string | number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShowToastOptions AST#object_type#Left { /** * Text to display. * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Duration of toast dialog box. The default value is 1500. * The recommended value ranges from 1500 ms to 10000ms. * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 * @deprecated since 8 */ AST#type_member#Left duration ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * The distance between toast dialog box and the bottom of screen. * * @type { ?(string | number) } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 5 * @deprecated since 8 */ AST#type_member#Left bottom ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface ShowToastOptions { message: string; duration?: number; bottom?: string | number; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.prompt.d.ets#L30-L62
64fe204b41b6514af97e407ea521cd576af9a6ab
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
check
底部复选框配置 @param isChecked 是否默认选中 @param onCheckedChange 选中状态改变回调 @param tips 复选右侧提示文案 @returns
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, tips?: ResourceStr) { this.builderOptions.checkTips = tips this.builderOptions.isChecked = isChecked this.builderOptions.onCheckedChange = onCheckedChange return this; }
AST#method_declaration#Left check AST#parameter_list#Left ( AST#parameter#Left isChecked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onCheckedChange ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left tips ? : 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#builder_function_body#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 . checkTips AST#member_expression#Right = AST#expression#Left tips 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . isChecked AST#member_expression#Right = AST#expression#Left isChecked 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . onCheckedChange AST#member_expression#Right = AST#expression#Left onCheckedChange AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, tips?: ResourceStr) { this.builderOptions.checkTips = tips this.builderOptions.isChecked = isChecked this.builderOptions.onCheckedChange = onCheckedChange return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L63-L68
cc357c9a8c53a7341a4699732f9f6d62ef5129c1
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/view/dust/DustMonitorCard.ets
arkts
getIconText
辅助函数:根据状态返回图标中的文字
private getIconText(status: DustStatus): string { if (status === DustStatus.WARNING) return '!'; return '✔'; // 表示"空气" }
AST#method_declaration#Left private getIconText AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left DustStatus 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left status AST#expression#Right === AST#expression#Left DustStatus AST#expression#Right AST#binary_expression#Right AST#expression#Right . WARNING AST#member_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#expression#Right ; AST#return_statement#Right AST#statement#Right // 表示"空气" } AST#block_statement#Right AST#method_declaration#Right
private getIconText(status: DustStatus): string { if (status === DustStatus.WARNING) return '!'; return '✔'; }
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L129-L132
a7bfa53620885211c68bd8305bf2478c6de42c92
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
提醒频率枚举
export enum ReminderFrequency { ONCE = 'once', DAILY = 'daily', WEEKLY = 'weekly', MONTHLY = 'monthly' }
AST#export_declaration#Left export AST#enum_declaration#Left enum ReminderFrequency AST#enum_body#Left { AST#enum_member#Left ONCE = AST#expression#Left 'once' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left DAILY = AST#expression#Left 'daily' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WEEKLY = AST#expression#Left 'weekly' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MONTHLY = AST#expression#Left 'monthly' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
export enum ReminderFrequency { ONCE = 'once', DAILY = 'daily', WEEKLY = 'weekly', MONTHLY = 'monthly' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L275-L280
b8a32e4b239148676389529db78b2c65f4275fd1
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets
arkts
buttons
弹窗按钮 @param primaryButton 左侧按钮 @param secondaryButton 右侧按钮 @returns
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
AST#method_declaration#Left buttons AST#parameter_list#Left ( AST#parameter#Left primaryButton : AST#type_annotation#Left AST#primary_type#Left ButtonOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left secondaryButton ? : 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#builder_function_body#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 . primaryButton AST#member_expression#Right = AST#expression#Left primaryButton 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderOptions AST#member_expression#Right AST#expression#Right . secondaryButton AST#member_expression#Right = AST#expression#Left secondaryButton AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
buttons(primaryButton: ButtonOptions, secondaryButton?: ButtonOptions) { this.builderOptions.primaryButton = primaryButton this.builderOptions.secondaryButton = secondaryButton return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TipsBuilderProxy.ets#L50-L54
f3350d06951f51471a42d9c415a2643674babc4b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets
arkts
imageAnimation
扫描线动画参数
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, centerY: 0 }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function imageAnimation AST#parameter_list#Left ( AST#parameter#Left speed : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left linePosition : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left allAngle : 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#extend_function_body#Left { AST#modifier_chain_expression#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 0.5 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 130 AST#expression#Right ) AST#modifier_chain_expression#Left . scale ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#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 speed AST#expression#Right , AST#expression#Left 0.007 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#Left . position ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left linePosition AST#expression#Right + AST#expression#Left '%' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x 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 allAngle AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left centerY AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#decorated_function_declaration#Right
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, centerY: 0 }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/ScanLine.ets#L23-L39
f90c881ba631a12684580e620cd8b7c3d366d812
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets
arkts
getDictData
获取字典数据 @param {DictDataRequest} request - 字典查询参数 @returns {Promise<NetworkResponse<DictDataResponse>>} 字典数据
async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> { const resp: AxiosResponse<NetworkResponse<DictDataResponse>> = await NetworkClient.http.post("dict/info/data", request); return resp.data; }
AST#method_declaration#Left async getDictData AST#parameter_list#Left ( AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left DictDataRequest 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 NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#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 resp : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left DictDataResponse AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#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#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 NetworkClient AST#expression#Right AST#await_expression#Right AST#expression#Right . http AST#member_expression#Right AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "dict/info/data" AST#expression#Right , AST#expression#Left request 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 resp AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async getDictData(request: DictDataRequest): Promise<NetworkResponse<DictDataResponse>> { const resp: AxiosResponse<NetworkResponse<DictDataResponse>> = await NetworkClient.http.post("dict/info/data", request); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets#L37-L41
3f349186c662c08a9ad031b672ced085287e7c3d
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/ImageEditComponent.ets
arkts
ImageEditComponent
图片编辑组件 提供画板、马赛克、裁剪、文字功能 支持独立组件引用
@ComponentV2 export struct ImageEditComponent { @Param @Require option: ImageEditOption; @Provider() imageMatrixOpt: matrix4.Matrix4Transit = matrix4.identity().scale({ x: 1, y: 1 }); @Local contentSize: EditRect = { x: 0, y: 0, width: 0, height: 0 }; @Local angle: number = 0; @Local viewDataArray: Array<ImageEditFunctionData> = []; @Local currentViewData: ImageEditFunctionData = new ImageEditFunctionData(ImageEditFunctionType.PALETTE, { text: StringUtils.getString(getContext(), $r("app.string.image_edit_photo_brush")) }, ImageEditIconFontName.icon_pen); @Local undoButtonActivated: boolean = false; @Local showCropButton: boolean = false; @Local textAreaData: TextInputData | undefined; private functionTypes: Array<ImageEditFunctionType> = []; private imageDisplayRegion?: EditRect; private cropData?: CropChangedData; private recordManager: EditRecordManager = new EditRecordManager((exist: boolean) => { if (exist !== this.undoButtonActivated) { this.undoButtonActivated = exist; } }); private textNodeController?: TextEditNodeController; private toolbarActions: ToolbarActions = { onPickColor: (color: string, rgbType: RgbColor): void => { if (this.isSelectedType(ImageEditFunctionType.PALETTE)) { this.paletteController?.refreshColor(color); } else if (this.isSelectedType(ImageEditFunctionType.TEXT)) { this.textInputController?.setSelectedColor(color); if (this.textAreaData) { this.textAreaData.color = color; } } }, onPickBrushSize: (size: number): void => { this.paletteBrushSize = size; if (this.isSelectedType(ImageEditFunctionType.PALETTE)) { this.paletteController?.refreshBrushSize(size); } }, onRotate: (angle: number): void => { this.onRotate(angle); }, onPickSize: (size: number): void => { this.mosaicController?.refreshBrushSize(size); } }; private paletteController?: PaletteController; private mosaicController?: MosaicController; private cropController?: CropController; private textInputController?: TextInputController; private currentScale: number = 1; private cropDelay: boolean = false; private paletteBrushSize: number = 3; build() { if (this.option?.pixelMap && this.option?.callback) { this.componentBuilder(); } else { Text('Invalid ImageEditOption!').fontColor(Color.Red); } } aboutToAppear(): void { Logger.i(MODULE, TAG, 'aboutToAppear vp2px(1)=' + vp2px(1) + ',option:' + JSON.stringify(this.option)); if (this.option?.pixelMap && this.option?.callback) { this.initViewData(); this.initController(); let font: Font = this.getUIContext().getFont(); font.registerFont({ familyName: 'iconfont', familySrc: $rawfile('iconfont.ttf') }) } else { Logger.e(MODULE, TAG, 'invalid option!'); } } @Builder componentBuilder() { RelativeContainer() { this.buildContent(); this.buildHeader(); this.buildToolbar(); this.buildFooter(); }.backgroundColor(Color.Black); } @Builder buildHeader() { RelativeContainer() { Text($r("app.string.image_edit_common_cancel")) .fontWeight(FontWeight.Bold) .fontColor($r("app.color.common_white2_color")) .fontSize(16) .alignRules({ start: { anchor: '__container__', align: HorizontalAlign.Start }, bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }) .onClick(() => { Logger.i(MODULE, TAG, 'user click cancel'); this.option?.callback?.onCancel(); }); Text(this.currentViewData.title.text ?? '') .fontWeight(FontWeight.Bold) .fontColor(this.currentViewData.title.fontColor ?? Color.White) .fontSize(this.currentViewData.title.fontSize ?? 16) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }); } .id('imageEditHeaderContainer') .backgroundColor($r("app.color.image_edit_container_background")) .padding(16) .width('100%') .height('10%') .expandSafeArea([SafeAreaType.SYSTEM]) .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top } }); } @Builder buildContent() { Stack({ alignContent: Alignment.Center }) { Stack({ alignContent: Alignment.Center }) { Stack({ alignContent: Alignment.Center }) { this.buildMosaic(); this.buildPalette(); }.transform(this.imageMatrixOpt); }.id('imageEditContainer').onAreaChange((oldV: Area, newV: Area) => { Logger.i(MODULE, TAG, 'onAreaChange oldV ' + JSON.stringify(oldV)); Logger.i(MODULE, TAG, 'onAreaChange newV ' + JSON.stringify(newV)); }); this.buildCrop(); this.buildNodeContainer(); } .id('rootContentContainer') .backgroundColor(this.isSelectedType(ImageEditFunctionType.CROP) ? Color.Transparent : $r("app.color.image_edit_content_background")) .alignRules({ top: { anchor: 'imageEditHeaderContainer', align: VerticalAlign.Bottom }, bottom: { anchor: 'imageEditToolbarContainer', align: VerticalAlign.Top }, start: { anchor: 'imageEditHeaderContainer', align: HorizontalAlign.Start }, end: { anchor: 'imageEditHeaderContainer', align: HorizontalAlign.End } }); } @Builder buildNodeContainer() { if (this.isSupport(ImageEditFunctionType.TEXT)) { NodeContainer(this.textNodeController) .id('imageEditNodeContainer') .width(this.contentSize.width) .height(this.contentSize.height) .onTouch((event: TouchEvent) => { this.textInputController?.onTouch(event); }) .transform(this.imageMatrixOpt) .enabled(this.isSelectedType(ImageEditFunctionType.TEXT)); if (this.textAreaData) { TextInputArea({ item: this.textAreaData }); } } } @Builder buildCrop() { if (this.isSupport(ImageEditFunctionType.CROP)) { CropComponent({ contentSize: this.contentSize, actions: { onCropRegionChanged: (data: CropChangedData) => { this.cropData = data; }, onShowCropButton: (show: boolean) => { if (this.showCropButton !== show) { this.showCropButton = show; } }, onReady: (cropController: CropController) => { this.cropController = cropController; }, onImageDisplayRegionChanged: (region: EditRect) => { this.imageDisplayRegion = region; } } }).onAreaChange((old, newV) => { if (this.cropDelay && this.isSelectedType(ImageEditFunctionType.CROP) && this.contentSize.width > 0) { this.enterCrop(); } }) .visibility(this.contentSize.width > 0 ? Visibility.Visible : Visibility.None) .enabled(this.isSelectedType(ImageEditFunctionType.CROP)); } } @Builder buildPalette() { if (this.isSupport(ImageEditFunctionType.PALETTE)) { PaletteComponent({ eventListener: { onAdd: (data: PaletteData) => { this.recordManager.addPaletteRecord(data); }, onReady: (controller: PaletteController) => { this.paletteController = controller; this.paletteController.refreshBrushSize(this.paletteBrushSize); } } }) .enabled(this.isSelectedType(ImageEditFunctionType.PALETTE)) .width(this.contentSize.width) .height(this.contentSize.height); } } @Builder buildMosaic() { if (this.isSupport(ImageEditFunctionType.MOSAIC)) { MosaicComponent({ sourcePixelMap: this.option.pixelMap, eventListener: { onAdd: (data: MosaicData) => { this.recordManager.addMosaicRecord(data); }, onContentLoadFinish: (contentSize: EditRect) => { this.onContentLoadFinish(contentSize); }, onReady: (controller: MosaicController) => { this.mosaicController = controller; }, onError: (reason: string) => { this.option.callback?.onFailure?.(new ImageEditError(1000, reason)); }, } }).enabled(this.isSelectedType(ImageEditFunctionType.MOSAIC)); } else { Image(this.option.pixelMap) .width('100%') .height('100%') .objectFit(ImageFit.Contain) .onComplete((event) => { if (event !== undefined) { // NodeContainer的宽高设置为图片成功加载后实际绘制的尺寸 if (event?.loadingStatus === 1) { this.onContentLoadFinish({ x: px2vp(event.contentOffsetX), y: px2vp(event.contentOffsetY), width: px2vp(event.contentWidth), height: px2vp(event.contentHeight) }); } } }) .onError((error: ImageError) => { this.option.callback?.onFailure?.(new ImageEditError(1001, JSON.stringify(error))); }); } } @Builder buildToolbar() { ToolBarComponent({ selectedFunctionType: this.currentViewData.type, functionTypes: this.functionTypes, actions: this.toolbarActions }).id('imageEditToolbarContainer').alignRules({ bottom: { anchor: 'imageEditFooterContainer', align: VerticalAlign.Top } }); } @Builder buildFooter() { Row({ space: 12 }) { // 撤销按钮 this.buildIcon(ImageEditIconFontName.icon_wd_undo, '撤销', $r('app.color.common_blue1_active_color'), $r('app.color.common_blue2_color'), () => { this.undoRecord(); }, 0, undefined, true); // 只有一个场景不展示底部按钮,顶部标题仍按照实际配置展示 if (this.viewDataArray.length > 1) { // 画笔、马赛克、裁剪、文字按钮 Row({ space: 0 }) { ForEach(this.viewDataArray, (item: ImageEditFunctionData) => { ListItem() { this.buildIcon(item.iconRes, item.title.text, $r('app.color.common_blue1_active_color'), $r('app.color.common_white1_color'), () => { this.onItemSwitch(item); }, item.marginEnd, item); }; }, (item: ImageEditFunctionData) => { return item.type; }); }.justifyContent(FlexAlign.SpaceBetween) .layoutWeight(1) .margin({ left: 16, right: 16 }) } // 完成按钮 Text(this.showCropButton ? $r("app.string.image_edit_photo_editor_crop") : (this.option.finishButtonText ?? $r("app.string.image_edit_common_done"))) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.common_white2_color')) .enabled(this.isFinishButtonActive()) .fontSize(20) .align(Alignment.End) .onClick(() => { Logger.i(MODULE, TAG, 'click showCropButton=' + this.showCropButton); if (this.showCropButton) { this.onConfirmCrop(); } else { this.onDone(); } }); } .id('imageEditFooterContainer') .backgroundColor($r("app.color.image_edit_container_background")) .padding(16) .width('100%') .height('10%') .expandSafeArea([SafeAreaType.SYSTEM]) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.SpaceBetween) .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }); } private isFinishButtonActive(): boolean { // 存在可撤销内容为激活状态,否则根据选项配置来决定 return this.undoButtonActivated || !this.option.finishButtonDisableWhenUnModified; } private onAddTextArea(data: TextInputData): void { let newData = new TextInputData(data.textId, data.position, data.color); newData.copy(data); newData.onRemove = (uniqueId: number) => { let input = newData.text?.trim(); data.text = !input ? undefined : input; this.textAreaData = undefined; }; this.textAreaData = newData; } private onContentLoadFinish(contentSize: EditRect) { Logger.i(MODULE, TAG, 'onContentLoadFinish ' + JSON.stringify(contentSize)); this.contentSize = { x: contentSize.x, y: contentSize.y, width: contentSize.width, height: contentSize.height }; this.textInputController?.setContainerSize(this.contentSize.width, this.contentSize.height); } private undoRecord(): void { let data = this.recordManager.undo(); if (data instanceof MosaicData) { this.mosaicController?.undo(data); } else if (data instanceof CropData) { this.undoCrop(data); } else if (data instanceof PaletteData) { this.paletteController?.undo(data); } else if (data instanceof TextInputData) { this.textNodeController?.undo(); } } @Builder private buildIcon(iconRes: ResourceStr | ImageEditIconOption, text: ResourceStr, activatedColor: ResourceColor, normalColor: ResourceColor, click: () => void, rightMargin: number = 0, item?: ImageEditFunctionData, isUndoButton: boolean = false) { Stack({ alignContent: Alignment.Center }) { if (typeof iconRes === 'string') { //TODO 纯粹为了解耦合造造成这样没实测,临时使用下面文本替代,开源整改后这里需要一个撤销的图标,并且没有东西可撤销时图标颜色应该置灰 /* ImageEditIconFont({ attribute: this.isActivated(item) ? { name: iconRes, size: 24, backgroundSize: 24, color: activatedColor } : { name: iconRes, size: 24, backgroundSize: 24, color: normalColor } }).margin({ right: rightMargin })*/ Text(text) .backgroundColor(isUndoButton ? (this.undoButtonActivated ? Color.White : Color.Black) : (this.isActivated(item) ? $r("app.color.common_blue1_active_color") : $r("app.color.common_white1_color"))) .fontColor(isUndoButton ? (this.undoButtonActivated ? Color.Black : '#999999') : (this.isActivated(item) ? Color.White : Color.Black)) .fontSize(16) .borderRadius(8) .padding({ left: 5, right: 5, top: 5, bottom: 5 }) } else if (iconRes instanceof ImageEditIconOption) { // 业务提供两种状态图标场景 Image(this.isActivated(item) ? (iconRes as ImageEditIconOption).selected : (iconRes as ImageEditIconOption).unSelected) .width(24) .height(24) .margin({ right: rightMargin }) .objectFit(ImageFit.Contain); } else { // 业务提供svg图标场景,由业务自己保证是svg图标 Image(iconRes) .width(24) .height(24) .margin({ right: rightMargin }) .objectFit(ImageFit.Contain) .fillColor(this.isActivated(item) ? activatedColor : normalColor); } }.onClick(() => { click(); }); } private isActivated(item?: ImageEditFunctionData): boolean { return item ? item.selected : this.undoButtonActivated; } private undoCrop(data: CropData): void { let records = this.cropController?.onUndoCrop(data); if (records) { // 根据添加操作记录反向计算逆操作 let reverse = records.reverse(); // 计算回退记录中回退的旋转角度同步刷新到文本控制器用于控制新文本输入的旋转矫正 let angle = 0; reverse.forEach((value) => { if (value.type === MatrixType.rotate && value.option as matrix4.RotateOption) { angle -= (value.option as matrix4.RotateOption).angle!; } else if (value.type === MatrixType.scale && value.option as matrix4.ScaleOption) { this.currentScale *= (1 / (value.option as matrix4.ScaleOption).x!); } }); this.onScaleChanged(this.currentScale); this.textInputController?.onRotate(angle); Logger.i(MODULE, TAG, 'undoCrop currentScale=' + this.currentScale + ',revert angle:' + angle); } } private onDone(): void { if (this.isSelectedType(ImageEditFunctionType.CROP)) { // 裁剪页面点击完成需要退出裁剪再继续截图 this.exitCrop(); this.snapshot(500); }
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ImageEditComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right option : AST#type_annotation#Left AST#primary_type#Left ImageEditOption AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Provider ( ) AST#decorator#Right imageMatrixOpt : 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 . 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 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y 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 ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right contentSize : AST#type_annotation#Left AST#primary_type#Left EditRect AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left 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 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 @ Local AST#decorator#Right angle : 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 @ Local AST#decorator#Right viewDataArray : 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 ImageEditFunctionData 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 AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right currentViewData : AST#type_annotation#Left AST#primary_type#Left ImageEditFunctionData 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 ImageEditFunctionData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . PALETTE AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left text AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringUtils AST#expression#Right . getString AST#member_expression#Right AST#expression#Right AST#argument_list#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 , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.image_edit_photo_brush" 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#expression#Left AST#member_expression#Left AST#expression#Left ImageEditIconFontName AST#expression#Right . icon_pen AST#member_expression#Right 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 @ Local AST#decorator#Right undoButtonActivated : 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 @ Local AST#decorator#Right showCropButton : 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 @ Local AST#decorator#Right textAreaData : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left TextInputData AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private functionTypes : 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 ImageEditFunctionType 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 AST#property_declaration#Left private imageDisplayRegion ? : AST#type_annotation#Left AST#primary_type#Left EditRect AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private cropData ? : AST#type_annotation#Left AST#primary_type#Left CropChangedData AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private recordManager : AST#type_annotation#Left AST#primary_type#Left EditRecordManager 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 EditRecordManager AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left exist : 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left exist AST#expression#Right !== AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . undoButtonActivated 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 . undoButtonActivated AST#member_expression#Right = AST#expression#Left exist AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private textNodeController ? : AST#type_annotation#Left AST#primary_type#Left TextEditNodeController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private toolbarActions : AST#type_annotation#Left AST#primary_type#Left ToolbarActions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onPickColor AST#property_name#Right : AST#expression#Left AST#arrow_function#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 rgbType : 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#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 this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . PALETTE AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . paletteController AST#member_expression#Right AST#expression#Right ?. refreshColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . TEXT AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInputController AST#member_expression#Right AST#expression#Right ?. setSelectedColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left color AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAreaData 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAreaData AST#member_expression#Right AST#expression#Right . color AST#member_expression#Right = AST#expression#Left color AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onPickBrushSize AST#property_name#Right : AST#expression#Left AST#arrow_function#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#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 . paletteBrushSize AST#member_expression#Right = AST#expression#Left size 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . PALETTE AST#member_expression#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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . paletteController AST#member_expression#Right AST#expression#Right ?. refreshBrushSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left size 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#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onRotate AST#property_name#Right : AST#expression#Left AST#arrow_function#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#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 . onRotate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle 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#property_assignment#Left AST#property_name#Left onPickSize AST#property_name#Right : AST#expression#Left AST#arrow_function#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#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 . mosaicController AST#member_expression#Right AST#expression#Right ?. refreshBrushSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left size 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_declaration#Right AST#property_declaration#Left private paletteController ? : AST#type_annotation#Left AST#primary_type#Left PaletteController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private mosaicController ? : AST#type_annotation#Left AST#primary_type#Left MosaicController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private cropController ? : AST#type_annotation#Left AST#primary_type#Left CropController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private textInputController ? : AST#type_annotation#Left AST#primary_type#Left TextInputController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private currentScale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private cropDelay : 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 private paletteBrushSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3 AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . option AST#member_expression#Right AST#expression#Right ?. pixelMap AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . option AST#member_expression#Right AST#expression#Right ?. callback AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentBuilder 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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'Invalid ImageEditOption!' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Red AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#build_body#Right AST#build_method#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#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 . 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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'aboutToAppear vp2px(1)=' AST#expression#Right + AST#expression#Left vp2px AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left ',option:' AST#expression#Right AST#binary_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 . option AST#member_expression#Right AST#expression#Right ?. pixelMap AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . option AST#member_expression#Right AST#expression#Right ?. callback AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initViewData 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 . initController 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#variable_declaration#Left let AST#variable_declarator#Left font : AST#type_annotation#Left AST#primary_type#Left Font 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 this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFont 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 font AST#expression#Right . registerFont 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 familyName AST#property_name#Right : AST#expression#Left 'iconfont' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left familySrc AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'iconfont.ttf' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 Logger 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 'invalid option!' 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 AST#decorator#Left @ Builder AST#decorator#Right componentBuilder 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 RelativeContainer ( ) 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 . buildContent 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 . buildHeader 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 . buildToolbar 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 . buildFooter 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#modifier_chain_expression#Left . backgroundColor ( 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#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader 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 RelativeContainer ( ) 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.image_edit_common_cancel" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.common_white2_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left start 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#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 '__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 . Bottom 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 . 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 Logger 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 'user click cancel' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right ?. callback AST#member_expression#Right AST#expression#Right ?. onCancel AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#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 this AST#expression#Right . currentViewData AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right . text AST#member_expression#Right AST#expression#Right ?? AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentViewData AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right . fontColor AST#member_expression#Right AST#expression#Right ?? AST#expression#Left Color AST#expression#Right AST#binary_expression#Right AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( 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 this AST#expression#Right . currentViewData AST#member_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 16 AST#expression#Right AST#binary_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 middle 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 . Center 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 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 '__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 . Bottom 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#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 . id ( AST#expression#Left 'imageEditHeaderContainer' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.image_edit_container_background" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '10%' 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#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#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContent 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#component_parameters#Left { AST#component_parameter#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#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#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#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#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#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 . buildMosaic 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 . buildPalette 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#modifier_chain_expression#Left . transform ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageMatrixOpt 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 . id ( AST#expression#Left 'imageEditContainer' AST#expression#Right ) AST#modifier_chain_expression#Left . onAreaChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left oldV : AST#type_annotation#Left AST#primary_type#Left Area AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newV : AST#type_annotation#Left AST#primary_type#Left Area 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 . 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 'onAreaChange oldV ' 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 oldV AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'onAreaChange newV ' 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 newV AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildCrop 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 . buildNodeContainer 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#modifier_chain_expression#Left . id ( AST#expression#Left 'rootContentContainer' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . CROP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.image_edit_content_background" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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 'imageEditHeaderContainer' 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 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 'imageEditToolbarContainer' 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 start 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 'imageEditHeaderContainer' 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#property_assignment#Left AST#property_name#Left end 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 'imageEditHeaderContainer' 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNodeContainer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSupport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . TEXT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NodeContainer ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textNodeController AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'imageEditNodeContainer' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onTouch ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 . textInputController AST#member_expression#Right AST#expression#Right ?. onTouch 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#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . transform ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . imageMatrixOpt AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . TEXT AST#member_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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAreaData AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInputArea ( AST#component_parameters#Left { AST#component_parameter#Left item : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textAreaData AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildCrop AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSupport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . CROP AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CropComponent ( AST#component_parameters#Left { AST#component_parameter#Left contentSize : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left actions : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCropRegionChanged AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CropChangedData 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 . cropData AST#member_expression#Right = AST#expression#Left data 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#property_assignment#Left AST#property_name#Left onShowCropButton AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left show : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCropButton AST#member_expression#Right AST#expression#Right !== AST#expression#Left show 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 . showCropButton AST#member_expression#Right = AST#expression#Left show AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onReady AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left cropController : AST#type_annotation#Left AST#primary_type#Left CropController 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 . cropController AST#member_expression#Right = AST#expression#Left cropController 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#property_assignment#Left AST#property_name#Left onImageDisplayRegionChanged AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left region : AST#type_annotation#Left AST#primary_type#Left EditRect 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 . imageDisplayRegion AST#member_expression#Right = AST#expression#Left region 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#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onAreaChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left old AST#parameter#Right , AST#parameter#Left newV 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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cropDelay AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . CROP AST#member_expression#Right AST#expression#Right ) 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 . contentSize AST#member_expression#Right AST#expression#Right . width 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 . enterCrop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . CROP AST#member_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildPalette AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSupport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . PALETTE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left PaletteComponent ( AST#component_parameters#Left { AST#component_parameter#Left eventListener : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onAdd AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left PaletteData 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 . recordManager AST#member_expression#Right AST#expression#Right . addPaletteRecord 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#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onReady AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left PaletteController 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 . paletteController AST#member_expression#Right = AST#expression#Left controller AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . paletteController AST#member_expression#Right AST#expression#Right . refreshBrushSize 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 . paletteBrushSize 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#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . PALETTE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildMosaic AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSupport AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . MOSAIC AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left MosaicComponent ( AST#component_parameters#Left { AST#component_parameter#Left sourcePixelMap : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left eventListener : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onAdd AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left MosaicData 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 . recordManager AST#member_expression#Right AST#expression#Right . addMosaicRecord 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#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onContentLoadFinish AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contentSize : AST#type_annotation#Left AST#primary_type#Left EditRect 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 this AST#expression#Right . onContentLoadFinish AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contentSize 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#property_assignment#Left AST#property_name#Left onReady AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left MosaicController 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 . mosaicController AST#member_expression#Right = AST#expression#Left controller AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onError AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left reason : 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#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right . callback AST#member_expression#Right AST#expression#Right ?. onFailure AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageEditError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1000 AST#expression#Right , AST#expression#Left reason AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSelectedType AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . MOSAIC AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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 } else { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onComplete ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event 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 event AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // NodeContainer的宽高设置为图片成功加载后实际绘制的尺寸 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 ?. loadingStatus 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 . onContentLoadFinish 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#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . contentOffsetX AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . contentOffsetY AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . contentWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . contentHeight AST#member_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#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#modifier_chain_expression#Left . onError ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left ImageError 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right . callback AST#member_expression#Right AST#expression#Right ?. onFailure AST#member_expression#Right AST#expression#Right ?. AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ImageEditError AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1001 AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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#ERROR#Left ; AST#ERROR#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildToolbar 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 ToolBarComponent ( AST#component_parameters#Left { AST#component_parameter#Left selectedFunctionType : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentViewData AST#member_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left functionTypes : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . functionTypes AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left actions : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toolbarActions AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'imageEditToolbarContainer' 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 'imageEditFooterContainer' 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#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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFooter AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditIconFontName AST#expression#Right . icon_wd_undo AST#member_expression#Right AST#expression#Right , AST#expression#Left '撤销' AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.common_blue1_active_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.common_blue2_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . undoRecord AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left undefined AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 只有一个场景不展示底部按钮,顶部标题仍按照实际配置展示 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewDataArray 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#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 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewDataArray 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 ImageEditFunctionData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . iconRes AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . title AST#member_expression#Right AST#expression#Right . text AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.common_blue1_active_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.common_white1_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onItemSwitch 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#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . marginEnd AST#member_expression#Right AST#expression#Right , AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left ImageEditFunctionData 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 item AST#expression#Right . type 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#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 . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right // 完成按钮 AST#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 . showCropButton AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.image_edit_photo_editor_crop" AST#expression#Right ) AST#resource_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#member_expression#Left AST#expression#Left this AST#expression#Right . option AST#member_expression#Right AST#expression#Right . finishButtonText AST#member_expression#Right AST#expression#Right ?? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.image_edit_common_done" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.common_white2_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enabled ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isFinishButtonActive AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . align ( AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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 Logger 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#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'click showCropButton=' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . showCropButton 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showCropButton AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onConfirmCrop 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 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 . onDone AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . id ( AST#expression#Left 'imageEditFooterContainer' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.image_edit_container_background" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '10%' 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#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center 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 . SpaceBetween AST#member_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 '__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 . Bottom 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#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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private isFinishButtonActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 存在可撤销内容为激活状态,否则根据选项配置来决定 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . undoButtonActivated AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . option AST#member_expression#Right AST#expression#Right . finishButtonDisableWhenUnModified AST#member_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 onAddTextArea AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TextInputData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TextInputData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . textId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . position AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . color AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newData AST#expression#Right . copy 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#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left newData AST#expression#Right . onRemove AST#member_expression#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left uniqueId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left input = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left newData AST#expression#Right . text AST#member_expression#Right AST#expression#Right ?. trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 data AST#expression#Right . text AST#member_expression#Right = AST#expression#Left AST#unary_expression#Left ! AST#expression#Left input AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#ERROR#Left ? AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left undefined AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left input AST#primary_type#Right AST#type_annotation#Right ; this AST#ERROR#Right . textAreaData AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_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#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 . textAreaData AST#member_expression#Right = AST#expression#Left newData 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 private onContentLoadFinish AST#parameter_list#Left ( AST#parameter#Left contentSize : AST#type_annotation#Left AST#primary_type#Left EditRect AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'onContentLoadFinish ' 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 contentSize 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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize AST#member_expression#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left x AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contentSize AST#expression#Right . x AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left contentSize AST#expression#Right . y 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#member_expression#Left AST#expression#Left contentSize 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 contentSize AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 . textInputController AST#member_expression#Right AST#expression#Right ?. setContainerSize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . contentSize 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 this AST#expression#Right . contentSize 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#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private undoRecord 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 data = 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 . recordManager AST#member_expression#Right AST#expression#Right . undo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right instanceof AST#expression#Left MosaicData 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 . mosaicController AST#member_expression#Right AST#expression#Right ?. undo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right instanceof AST#expression#Left CropData 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 . undoCrop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right instanceof AST#expression#Left PaletteData 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 . paletteController AST#member_expression#Right AST#expression#Right ?. undo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left data AST#expression#Right instanceof AST#expression#Left TextInputData 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 . textNodeController AST#member_expression#Right AST#expression#Right ?. undo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildIcon AST#parameter_list#Left ( AST#parameter#Left iconRes : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr AST#primary_type#Right | AST#primary_type#Left ImageEditIconOption AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left activatedColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left normalColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left click : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rightMargin : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#parameter#Right , AST#parameter#Left item ? : AST#type_annotation#Left AST#primary_type#Left ImageEditFunctionData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isUndoButton : 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#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left { AST#ERROR#Left AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left iconRes AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { //TODO 纯粹为了解耦合造造成这样没实测,临时使用下面文本替代,开源整改后这里需要一个撤销的图标,并且没有东西可撤销时图标颜色应该置灰 /* ImageEditIconFont({ attribute: this.isActivated(item) ? { name: iconRes, size: 24, backgroundSize: 24, color: activatedColor } : { name: iconRes, size: 24, backgroundSize: 24, color: normalColor } }).margin({ right: rightMargin })*/ 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 . backgroundColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left isUndoButton AST#expression#Right ? AST#expression#Left AST#parenthesized_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 this AST#expression#Right . undoButtonActivated AST#member_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#parenthesized_expression#Right AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isActivated 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#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.common_blue1_active_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.common_white1_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left isUndoButton AST#expression#Right ? AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . undoButtonActivated AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right : AST#expression#Left '#999999' AST#expression#Right AST#conditional_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#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isActivated 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#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#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 8 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 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , 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#property_assignment#Left AST#property_name#Left bottom 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#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 iconRes AST#expression#Right instanceof AST#expression#Left ImageEditIconOption 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#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isActivated 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#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left iconRes AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ImageEditIconOption AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . selected AST#member_expression#Right AST#expression#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left iconRes AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ImageEditIconOption AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right . unSelected AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#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 rightMargin AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 } else { // 业务提供svg图标场景,由业务自己保证是svg图标 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left iconRes AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#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 rightMargin AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isActivated 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#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left activatedColor AST#expression#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left normalColor AST#primary_type#Right AST#type_annotation#Right ) ; } } AST#ERROR#Right . onClick AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left click 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#ERROR#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left private AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left isActivated ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left item AST#expression#Right ? AST#expression#Left AST#expression#Right : AST#expression#Left ImageEditFunctionData AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#ERROR#Left : boolean AST#ERROR#Right AST#container_content_body#Left { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left item AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . selected AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . undoButtonActivated AST#member_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#expression_statement#Left AST#expression#Left private AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left undoCrop AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#assignment_expression#Left data AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left CropData AST#primary_type#Right AST#type_annotation#Right ) : void { let records 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 this AST#expression#Right . cropController AST#member_expression#Right AST#expression#Right ?. onUndoCrop 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#assignment_expression#Right AST#expression#Right AST#ERROR#Right ; AST#expression_statement#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left records AST#expression#Right ) { // 根据添加操作记录反向计算逆操作 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left reverse = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left records AST#expression#Right . reverse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // 计算回退记录中回退的旋转角度同步刷新到文本控制器用于控制新文本输入的旋转矫正 AST#expression_statement#Left AST#expression#Left let AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left angle = AST#expression#Left 0 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 reverse 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 value AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#as_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 value AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left MatrixType AST#expression#Right AST#binary_expression#Right AST#expression#Right . rotate AST#member_expression#Right AST#expression#Right && AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right . option AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . RotateOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . option AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . RotateOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . angle AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_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#if_statement#Left if ( AST#expression#Left AST#as_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 value AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left MatrixType AST#expression#Right AST#binary_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right && AST#expression#Left value AST#expression#Right AST#binary_expression#Right AST#expression#Right . option AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . ScaleOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_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 . currentScale AST#member_expression#Right *= AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#non_null_assertion_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 AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . option AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left matrix4 . ScaleOption AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . x AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#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 . onScaleChanged 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 . currentScale AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInputController AST#member_expression#Right AST#expression#Right ?. onRotate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left angle 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 Logger 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'undoCrop currentScale=' AST#expression#Right + AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentScale AST#member_expression#Right AST#expression#Right + AST#expression#Left ',revert angle:' AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left angle 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#expression_statement#Left AST#expression#Left private AST#expression#Right AST#expression_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left onDone ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left : AST#ERROR#Right void { AST#property_name#Left if AST#property_name#Right ( this AST#ERROR#Right AST#modifier_chain_expression#Left . isSelectedType ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageEditFunctionType AST#expression#Right . CROP AST#member_expression#Right AST#expression#Right ) AST#ERROR#Left ) { // 裁剪页面点击完成需要退出裁剪再继续截图 this AST#ERROR#Right AST#modifier_chain_expression#Left . exitCrop ( ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ERROR#Right ; AST#method_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . snapshot AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 500 AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@ComponentV2 export struct ImageEditComponent { @Param @Require option: ImageEditOption; @Provider() imageMatrixOpt: matrix4.Matrix4Transit = matrix4.identity().scale({ x: 1, y: 1 }); @Local contentSize: EditRect = { x: 0, y: 0, width: 0, height: 0 }; @Local angle: number = 0; @Local viewDataArray: Array<ImageEditFunctionData> = []; @Local currentViewData: ImageEditFunctionData = new ImageEditFunctionData(ImageEditFunctionType.PALETTE, { text: StringUtils.getString(getContext(), $r("app.string.image_edit_photo_brush")) }, ImageEditIconFontName.icon_pen); @Local undoButtonActivated: boolean = false; @Local showCropButton: boolean = false; @Local textAreaData: TextInputData | undefined; private functionTypes: Array<ImageEditFunctionType> = []; private imageDisplayRegion?: EditRect; private cropData?: CropChangedData; private recordManager: EditRecordManager = new EditRecordManager((exist: boolean) => { if (exist !== this.undoButtonActivated) { this.undoButtonActivated = exist; } }); private textNodeController?: TextEditNodeController; private toolbarActions: ToolbarActions = { onPickColor: (color: string, rgbType: RgbColor): void => { if (this.isSelectedType(ImageEditFunctionType.PALETTE)) { this.paletteController?.refreshColor(color); } else if (this.isSelectedType(ImageEditFunctionType.TEXT)) { this.textInputController?.setSelectedColor(color); if (this.textAreaData) { this.textAreaData.color = color; } } }, onPickBrushSize: (size: number): void => { this.paletteBrushSize = size; if (this.isSelectedType(ImageEditFunctionType.PALETTE)) { this.paletteController?.refreshBrushSize(size); } }, onRotate: (angle: number): void => { this.onRotate(angle); }, onPickSize: (size: number): void => { this.mosaicController?.refreshBrushSize(size); } }; private paletteController?: PaletteController; private mosaicController?: MosaicController; private cropController?: CropController; private textInputController?: TextInputController; private currentScale: number = 1; private cropDelay: boolean = false; private paletteBrushSize: number = 3; build() { if (this.option?.pixelMap && this.option?.callback) { this.componentBuilder(); } else { Text('Invalid ImageEditOption!').fontColor(Color.Red); } } aboutToAppear(): void { Logger.i(MODULE, TAG, 'aboutToAppear vp2px(1)=' + vp2px(1) + ',option:' + JSON.stringify(this.option)); if (this.option?.pixelMap && this.option?.callback) { this.initViewData(); this.initController(); let font: Font = this.getUIContext().getFont(); font.registerFont({ familyName: 'iconfont', familySrc: $rawfile('iconfont.ttf') }) } else { Logger.e(MODULE, TAG, 'invalid option!'); } } @Builder componentBuilder() { RelativeContainer() { this.buildContent(); this.buildHeader(); this.buildToolbar(); this.buildFooter(); }.backgroundColor(Color.Black); } @Builder buildHeader() { RelativeContainer() { Text($r("app.string.image_edit_common_cancel")) .fontWeight(FontWeight.Bold) .fontColor($r("app.color.common_white2_color")) .fontSize(16) .alignRules({ start: { anchor: '__container__', align: HorizontalAlign.Start }, bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }) .onClick(() => { Logger.i(MODULE, TAG, 'user click cancel'); this.option?.callback?.onCancel(); }); Text(this.currentViewData.title.text ?? '') .fontWeight(FontWeight.Bold) .fontColor(this.currentViewData.title.fontColor ?? Color.White) .fontSize(this.currentViewData.title.fontSize ?? 16) .alignRules({ middle: { anchor: '__container__', align: HorizontalAlign.Center }, bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }); } .id('imageEditHeaderContainer') .backgroundColor($r("app.color.image_edit_container_background")) .padding(16) .width('100%') .height('10%') .expandSafeArea([SafeAreaType.SYSTEM]) .alignRules({ top: { anchor: '__container__', align: VerticalAlign.Top } }); } @Builder buildContent() { Stack({ alignContent: Alignment.Center }) { Stack({ alignContent: Alignment.Center }) { Stack({ alignContent: Alignment.Center }) { this.buildMosaic(); this.buildPalette(); }.transform(this.imageMatrixOpt); }.id('imageEditContainer').onAreaChange((oldV: Area, newV: Area) => { Logger.i(MODULE, TAG, 'onAreaChange oldV ' + JSON.stringify(oldV)); Logger.i(MODULE, TAG, 'onAreaChange newV ' + JSON.stringify(newV)); }); this.buildCrop(); this.buildNodeContainer(); } .id('rootContentContainer') .backgroundColor(this.isSelectedType(ImageEditFunctionType.CROP) ? Color.Transparent : $r("app.color.image_edit_content_background")) .alignRules({ top: { anchor: 'imageEditHeaderContainer', align: VerticalAlign.Bottom }, bottom: { anchor: 'imageEditToolbarContainer', align: VerticalAlign.Top }, start: { anchor: 'imageEditHeaderContainer', align: HorizontalAlign.Start }, end: { anchor: 'imageEditHeaderContainer', align: HorizontalAlign.End } }); } @Builder buildNodeContainer() { if (this.isSupport(ImageEditFunctionType.TEXT)) { NodeContainer(this.textNodeController) .id('imageEditNodeContainer') .width(this.contentSize.width) .height(this.contentSize.height) .onTouch((event: TouchEvent) => { this.textInputController?.onTouch(event); }) .transform(this.imageMatrixOpt) .enabled(this.isSelectedType(ImageEditFunctionType.TEXT)); if (this.textAreaData) { TextInputArea({ item: this.textAreaData }); } } } @Builder buildCrop() { if (this.isSupport(ImageEditFunctionType.CROP)) { CropComponent({ contentSize: this.contentSize, actions: { onCropRegionChanged: (data: CropChangedData) => { this.cropData = data; }, onShowCropButton: (show: boolean) => { if (this.showCropButton !== show) { this.showCropButton = show; } }, onReady: (cropController: CropController) => { this.cropController = cropController; }, onImageDisplayRegionChanged: (region: EditRect) => { this.imageDisplayRegion = region; } } }).onAreaChange((old, newV) => { if (this.cropDelay && this.isSelectedType(ImageEditFunctionType.CROP) && this.contentSize.width > 0) { this.enterCrop(); } }) .visibility(this.contentSize.width > 0 ? Visibility.Visible : Visibility.None) .enabled(this.isSelectedType(ImageEditFunctionType.CROP)); } } @Builder buildPalette() { if (this.isSupport(ImageEditFunctionType.PALETTE)) { PaletteComponent({ eventListener: { onAdd: (data: PaletteData) => { this.recordManager.addPaletteRecord(data); }, onReady: (controller: PaletteController) => { this.paletteController = controller; this.paletteController.refreshBrushSize(this.paletteBrushSize); } } }) .enabled(this.isSelectedType(ImageEditFunctionType.PALETTE)) .width(this.contentSize.width) .height(this.contentSize.height); } } @Builder buildMosaic() { if (this.isSupport(ImageEditFunctionType.MOSAIC)) { MosaicComponent({ sourcePixelMap: this.option.pixelMap, eventListener: { onAdd: (data: MosaicData) => { this.recordManager.addMosaicRecord(data); }, onContentLoadFinish: (contentSize: EditRect) => { this.onContentLoadFinish(contentSize); }, onReady: (controller: MosaicController) => { this.mosaicController = controller; }, onError: (reason: string) => { this.option.callback?.onFailure?.(new ImageEditError(1000, reason)); }, } }).enabled(this.isSelectedType(ImageEditFunctionType.MOSAIC)); } else { Image(this.option.pixelMap) .width('100%') .height('100%') .objectFit(ImageFit.Contain) .onComplete((event) => { if (event !== undefined) { if (event?.loadingStatus === 1) { this.onContentLoadFinish({ x: px2vp(event.contentOffsetX), y: px2vp(event.contentOffsetY), width: px2vp(event.contentWidth), height: px2vp(event.contentHeight) }); } } }) .onError((error: ImageError) => { this.option.callback?.onFailure?.(new ImageEditError(1001, JSON.stringify(error))); }); } } @Builder buildToolbar() { ToolBarComponent({ selectedFunctionType: this.currentViewData.type, functionTypes: this.functionTypes, actions: this.toolbarActions }).id('imageEditToolbarContainer').alignRules({ bottom: { anchor: 'imageEditFooterContainer', align: VerticalAlign.Top } }); } @Builder buildFooter() { Row({ space: 12 }) { this.buildIcon(ImageEditIconFontName.icon_wd_undo, '撤销', $r('app.color.common_blue1_active_color'), $r('app.color.common_blue2_color'), () => { this.undoRecord(); }, 0, undefined, true); if (this.viewDataArray.length > 1) { Row({ space: 0 }) { ForEach(this.viewDataArray, (item: ImageEditFunctionData) => { ListItem() { this.buildIcon(item.iconRes, item.title.text, $r('app.color.common_blue1_active_color'), $r('app.color.common_white1_color'), () => { this.onItemSwitch(item); }, item.marginEnd, item); }; }, (item: ImageEditFunctionData) => { return item.type; }); }.justifyContent(FlexAlign.SpaceBetween) .layoutWeight(1) .margin({ left: 16, right: 16 }) } Text(this.showCropButton ? $r("app.string.image_edit_photo_editor_crop") : (this.option.finishButtonText ?? $r("app.string.image_edit_common_done"))) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.common_white2_color')) .enabled(this.isFinishButtonActive()) .fontSize(20) .align(Alignment.End) .onClick(() => { Logger.i(MODULE, TAG, 'click showCropButton=' + this.showCropButton); if (this.showCropButton) { this.onConfirmCrop(); } else { this.onDone(); } }); } .id('imageEditFooterContainer') .backgroundColor($r("app.color.image_edit_container_background")) .padding(16) .width('100%') .height('10%') .expandSafeArea([SafeAreaType.SYSTEM]) .alignItems(VerticalAlign.Center) .justifyContent(FlexAlign.SpaceBetween) .alignRules({ bottom: { anchor: '__container__', align: VerticalAlign.Bottom } }); } private isFinishButtonActive(): boolean { return this.undoButtonActivated || !this.option.finishButtonDisableWhenUnModified; } private onAddTextArea(data: TextInputData): void { let newData = new TextInputData(data.textId, data.position, data.color); newData.copy(data); newData.onRemove = (uniqueId: number) => { let input = newData.text?.trim(); data.text = !input ? undefined : input; this.textAreaData = undefined; }; this.textAreaData = newData; } private onContentLoadFinish(contentSize: EditRect) { Logger.i(MODULE, TAG, 'onContentLoadFinish ' + JSON.stringify(contentSize)); this.contentSize = { x: contentSize.x, y: contentSize.y, width: contentSize.width, height: contentSize.height }; this.textInputController?.setContainerSize(this.contentSize.width, this.contentSize.height); } private undoRecord(): void { let data = this.recordManager.undo(); if (data instanceof MosaicData) { this.mosaicController?.undo(data); } else if (data instanceof CropData) { this.undoCrop(data); } else if (data instanceof PaletteData) { this.paletteController?.undo(data); } else if (data instanceof TextInputData) { this.textNodeController?.undo(); } } @Builder private buildIcon(iconRes: ResourceStr | ImageEditIconOption, text: ResourceStr, activatedColor: ResourceColor, normalColor: ResourceColor, click: () => void, rightMargin: number = 0, item?: ImageEditFunctionData, isUndoButton: boolean = false) { Stack({ alignContent: Alignment.Center }) { if (typeof iconRes === 'string') { Text(text) .backgroundColor(isUndoButton ? (this.undoButtonActivated ? Color.White : Color.Black) : (this.isActivated(item) ? $r("app.color.common_blue1_active_color") : $r("app.color.common_white1_color"))) .fontColor(isUndoButton ? (this.undoButtonActivated ? Color.Black : '#999999') : (this.isActivated(item) ? Color.White : Color.Black)) .fontSize(16) .borderRadius(8) .padding({ left: 5, right: 5, top: 5, bottom: 5 }) } else if (iconRes instanceof ImageEditIconOption) { Image(this.isActivated(item) ? (iconRes as ImageEditIconOption).selected : (iconRes as ImageEditIconOption).unSelected) .width(24) .height(24) .margin({ right: rightMargin }) .objectFit(ImageFit.Contain); } else { Image(iconRes) .width(24) .height(24) .margin({ right: rightMargin }) .objectFit(ImageFit.Contain) .fillColor(this.isActivated(item) ? activatedColor : normalColor); } }.onClick(() => { click(); }); } private isActivated(item?: ImageEditFunctionData): boolean { return item ? item.selected : this.undoButtonActivated; } private undoCrop(data: CropData): void { let records = this.cropController?.onUndoCrop(data); if (records) { let reverse = records.reverse(); let angle = 0; reverse.forEach((value) => { if (value.type === MatrixType.rotate && value.option as matrix4.RotateOption) { angle -= (value.option as matrix4.RotateOption).angle!; } else if (value.type === MatrixType.scale && value.option as matrix4.ScaleOption) { this.currentScale *= (1 / (value.option as matrix4.ScaleOption).x!); } }); this.onScaleChanged(this.currentScale); this.textInputController?.onRotate(angle); Logger.i(MODULE, TAG, 'undoCrop currentScale=' + this.currentScale + ',revert angle:' + angle); } } private onDone(): void { if (this.isSelectedType(ImageEditFunctionType.CROP)) { this.exitCrop(); this.snapshot(500); }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditComponent.ets#L89-L549
3b0eb275c38628f817db89e32e8a80f7e3d99e6f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets
arkts
str2TimeStamp
处理日期格式
function str2TimeStamp(time: string): number { let dateString = time.slice(0, 10); let timeString = time.slice(11, 19); let dateParts = dateString.split('/'); let year = Number(dateParts[0]); let month = Number(dateParts[1]); let day = Number(dateParts[2]); let timeParts = timeString.split(':'); let hour = Number(timeParts[0]); let minites = Number(timeParts[1]); let seconds = Number(timeParts[2]); let date = new Date(year, month - 1, day, hour, minites, seconds, 0); let tt = date.getTime(); return tt; }
AST#function_declaration#Left function str2TimeStamp AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left dateString = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left timeString = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left time AST#expression#Right . slice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 11 AST#expression#Right , AST#expression#Left 19 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 dateParts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left dateString 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left dateParts AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left month = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left dateParts AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 day = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left dateParts AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_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 timeParts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left timeString 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 AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hour = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left timeParts AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minites = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left timeParts AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 seconds = AST#expression#Left AST#call_expression#Left AST#expression#Left Number AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left timeParts AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_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 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 year AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left month AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left day AST#expression#Right , AST#expression#Left hour AST#expression#Right , AST#expression#Left minites AST#expression#Right , AST#expression#Left seconds AST#expression#Right , 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 tt = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left tt AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function str2TimeStamp(time: string): number { let dateString = time.slice(0, 10); let timeString = time.slice(11, 19); let dateParts = dateString.split('/'); let year = Number(dateParts[0]); let month = Number(dateParts[1]); let day = Number(dateParts[2]); let timeParts = timeString.split(':'); let hour = Number(timeParts[0]); let minites = Number(timeParts[1]); let seconds = Number(timeParts[2]); let date = new Date(year, month - 1, day, hour, minites, seconds, 0); let tt = date.getTime(); return tt; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/entry/src/main/ets/filemanager/pages/MyPhone/MyPhone.ets#L51-L69
1ade74bf351bdd589f5de917a180526b65db2058
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
isWindowSupportWideGamut
判断当前窗口是否支持广色域模式,使用Promise异步回调。 @param windowClass 不传该值,默认主窗口。 @returns
static async isWindowSupportWideGamut(windowClass: window.Window = AppUtil.getMainWindow()): Promise<boolean> { return windowClass.isWindowSupportWideGamut(); }
AST#method_declaration#Left static async isWindowSupportWideGamut AST#parameter_list#Left ( AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppUtil AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_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 windowClass AST#expression#Right . isWindowSupportWideGamut 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 isWindowSupportWideGamut(windowClass: window.Window = AppUtil.getMainWindow()): Promise<boolean> { return windowClass.isWindowSupportWideGamut(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L375-L377
5d72f8c7246502b35205535c24cd364ecae6a7fc
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/lifecycle/Lifecycle3View.ets
arkts
Lifecycle3View
@author: HZWei @date: 2024/11/7 @desc:
@Route({ name: RouterConstants.LIFECYCLE3_VIEW }) @Component export struct Lifecycle3View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE3_VIEW} ${this.hash}: ` // 1、初始化生命周期注册对象,用@Lifecycle修饰 @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); @State counter: number = 0 aboutToAppear(): void { // 2、使用addListener设置生命周期函数监听 this.lifecycle.addListener((e, r) => { console.log(this.tag, '--1--',e, r?.name ?? "", r?.navDestinationId ?? "") switch (e) { case LifecycleEvent.ABOUT_TO_APPEAR: break } }) this.lifecycle.addListener((e, r) => { console.log(this.tag ,'--2--' , e, r?.name ?? "", r?.navDestinationId ?? "") }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( 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 RouterConstants AST#expression#Right . LIFECYCLE3_VIEW AST#member_expression#Right 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 Lifecycle3View AST#component_body#Left { AST#property_declaration#Left private hash : 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 util AST#expression#Right . getHash AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left private tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#template_literal#Left ` LifecycleMgr AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . LIFECYCLE3_VIEW 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 this AST#expression#Right . hash AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right : ` AST#template_literal#Right AST#expression#Right // 1、初始化生命周期注册对象,用@Lifecycle修饰 AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Lifecycle AST#decorator#Right lifecycle : AST#type_annotation#Left AST#primary_type#Left LifecycleRegistry 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 LifecycleRegistry AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right counter : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 0 AST#expression#Right AST#ERROR#Left aboutToAppear AST#ERROR#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#ERROR#Right AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left AST#object_literal#Left { // 2、使用addListener设置生命周期函数监听 AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . lifecycle AST#member_expression#Right AST#expression#Right . addListener AST#member_expression#Right AST#expression#Right AST#ERROR#Left ( AST#parameter_list#Left ( AST#parameter#Left e AST#parameter#Right , AST#parameter#Left r AST#parameter#Right ) AST#parameter_list#Right => { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right , AST#expression#Left '--1--' AST#expression#Right , AST#expression#Left e AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left r 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" 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 switch AST#expression#Right AST#argument_list#Left ( 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#property_name#Left case AST#property_name#Right Lifecycle Event AST#ERROR#Right . ABOUT_TO_APPEAR AST#member_expression#Right AST#expression#Right AST#ERROR#Left : break } } ) this AST#ERROR#Right . lifecycle AST#member_expression#Right AST#expression#Right . addListener 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 e AST#parameter#Right , AST#parameter#Left r 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 this AST#expression#Right . tag AST#member_expression#Right AST#expression#Right , AST#expression#Left '--2--' AST#expression#Right , AST#expression#Left e AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left r 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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left r AST#expression#Right ?. navDestinationId AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" 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#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Route({ name: RouterConstants.LIFECYCLE3_VIEW }) @Component export struct Lifecycle3View { private hash: number = util.getHash(this) private tag: string = `LifecycleMgr ${RouterConstants.LIFECYCLE3_VIEW} ${this.hash}: ` @Lifecycle lifecycle: LifecycleRegistry = LifecycleRegistry.create(this); @State counter: number = 0 aboutToAppear(): void { this.lifecycle.addListener((e, r) => { console.log(this.tag, '--1--',e, r?.name ?? "", r?.navDestinationId ?? "") switch (e) { case LifecycleEvent.ABOUT_TO_APPEAR: break } }) this.lifecycle.addListener((e, r) => { console.log(this.tag ,'--2--' , e, r?.name ?? "", r?.navDestinationId ?? "") }) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/Lifecycle3View.ets#L11-L33
910f0266da725c77a4646873c17fc3df4f63f5ef
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/SystemCheckService.ets
arkts
checkAll
执行所有系统检查
static async checkAll(): Promise<SystemCheckAllResult> { const fsResult = await SystemCheckService.checkFileSystem(); const dbResult = await SystemCheckService.checkDatabase(); const agvResult = await SystemCheckService.checkAgv(); const camResult = await SystemCheckService.checkCamera(); const allPassed = fsResult.success && dbResult.success && agvResult.success && camResult.success; const result: SystemCheckAllResult = { fs: fsResult, db: dbResult, agv: agvResult, cam: camResult, allPassed: allPassed }; return result; }
AST#method_declaration#Left static async checkAll 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 SystemCheckAllResult 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 fsResult = 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 SystemCheckService AST#expression#Right AST#await_expression#Right AST#expression#Right . checkFileSystem 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 dbResult = 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 SystemCheckService AST#expression#Right AST#await_expression#Right AST#expression#Right . checkDatabase 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 agvResult = 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 SystemCheckService AST#expression#Right AST#await_expression#Right AST#expression#Right . checkAgv 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 camResult = 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 SystemCheckService AST#expression#Right AST#await_expression#Right AST#expression#Right . checkCamera 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 allPassed = 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 fsResult AST#expression#Right . success AST#member_expression#Right AST#expression#Right && AST#expression#Left dbResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . success AST#member_expression#Right AST#expression#Right && AST#expression#Left agvResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . success AST#member_expression#Right AST#expression#Right && AST#expression#Left camResult AST#expression#Right AST#binary_expression#Right AST#expression#Right . success 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 result : AST#type_annotation#Left AST#primary_type#Left SystemCheckAllResult AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left fs AST#property_name#Right : AST#expression#Left fsResult AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left db AST#property_name#Right : AST#expression#Left dbResult AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left agv AST#property_name#Right : AST#expression#Left agvResult AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left cam AST#property_name#Right : AST#expression#Left camResult AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left allPassed AST#property_name#Right : AST#expression#Left allPassed 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#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
static async checkAll(): Promise<SystemCheckAllResult> { const fsResult = await SystemCheckService.checkFileSystem(); const dbResult = await SystemCheckService.checkDatabase(); const agvResult = await SystemCheckService.checkAgv(); const camResult = await SystemCheckService.checkCamera(); const allPassed = fsResult.success && dbResult.success && agvResult.success && camResult.success; const result: SystemCheckAllResult = { fs: fsResult, db: dbResult, agv: agvResult, cam: camResult, allPassed: allPassed }; return result; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/SystemCheckService.ets#L118-L135
1d1ee6372072846d38a9c091ffdf746b091a3e9d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
create
创建session对象 @returns
create(): EfRcp { if (this.efRcp) { this.efRcp.close(); this.efRcp = undefined; } this.efRcp = rcp.createSession(this.cfg); return this; }
AST#method_declaration#Left create AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . efRcp AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . efRcp AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . efRcp AST#member_expression#Right = AST#expression#Left undefined AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . efRcp AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left rcp AST#expression#Right . createSession 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 . cfg 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 return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left this AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
create(): EfRcp { if (this.efRcp) { this.efRcp.close(); this.efRcp = undefined; } this.efRcp = rcp.createSession(this.cfg); return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L100-L107
ef32853b42a5aba15f29368bfc1499ec84368b09
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets
arkts
时间处理工具类
export class TimeUtils { // 毫秒转换为“HH:mm:ss”字符串格式 static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; // 显示两位数判断 let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND)); let hourStr = hours + ':'; if (hours < FLAG_NUMBER) { // 10 显示两位数 hourStr = '0' + hourStr; } let minSecTime = timeMs % (SECONDS_ONE_HOUR * MS_ONE_SECOND); let minutes = Math.floor(minSecTime / (SECONDS_ONE_MIN * MS_ONE_SECOND)); let minStr = minutes + ':'; if (minutes < FLAG_NUMBER) { // 10 显示两位数 minStr = '0' + minStr; } let seconds = timeMs % (SECONDS_ONE_MIN * MS_ONE_SECOND); seconds = Math.round(seconds); // 乘以1000 然后round seconds = Math.floor(seconds / MS_ONE_SECOND); // 最后除以1000 再次floor 精确度到小数点后3位 let secStr = seconds + ''; if (seconds < FLAG_NUMBER) { secStr = '0' + secStr; } return hourStr + minStr + secStr; } /** * 格式化日期 * @param date 日期 * @param format 格式字符串,例如:'yyyy-MM-dd HH:mm:ss' * @returns 格式化后的字符串 */ static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.getHours().toString().padStart(MAX_LENGTH, '0'); let minute = date.getMinutes().toString().padStart(MAX_LENGTH, '0'); let second = date.getSeconds().toString().padStart(MAX_LENGTH, '0'); let result = format.replace('yyyy', year); result = result.replace('MM', month); result = result.replace('dd', day); result = result.replace('HH', hour); result = result.replace('mm', minute); result = result.replace('ss', second); return result; } static fillNum(num: number): string { if (num < 10) { return `0${num}`; } return num.toString(); } // 视频时长转换 static getTimeString(time: number): string { if (time === -1 || time === undefined) { time = 0; } const TIMESTAMP: number = 1000; const TIME_UNIT: number = 60; const MAX_HOURS: number = 24; let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNIT * TIME_UNIT)); let minute = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT) / (TIMESTAMP * TIME_UNIT)); let second = Math.floor(time % (TIMESTAMP * TIME_UNIT) / TIMESTAMP); if (hour > 0) { return `${TimeUtils.fillNum(hour)}:${TimeUtils.fillNum(minute)}:${TimeUtils.fillNum(second)}`; } return `${TimeUtils.fillNum(minute)}:${TimeUtils.fillNum(second)}`; } // 获取当前时间 static getCurrentTime(): string { const now = new Date(); const currentYear: number = now.getFullYear(); let currentMonth: number = now.getMonth() + 1; let currentDay: number = now.getDate(); return `${currentYear}-${currentMonth}-${currentDay}`; } }
AST#export_declaration#Left export AST#class_declaration#Left class TimeUtils AST#class_body#Left { // 毫秒转换为“HH:mm:ss”字符串格式 AST#method_declaration#Left static msToHHMMSS AST#parameter_list#Left ( AST#parameter#Left timeMs : 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left MS_ONE_SECOND : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 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 SECONDS_ONE_HOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 3600 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 SECONDS_ONE_MIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 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 FLAG_NUMBER : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 显示两位数判断 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hours = 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 timeMs AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left SECONDS_ONE_HOUR AST#expression#Right * AST#expression#Left MS_ONE_SECOND 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hourStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right + AST#expression#Left ':' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hours AST#expression#Right < AST#expression#Left FLAG_NUMBER AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 10 显示两位数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hourStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left '0' AST#expression#Right + AST#expression#Left hourStr 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#variable_declaration#Left let AST#variable_declarator#Left minSecTime = AST#expression#Left AST#binary_expression#Left AST#expression#Left timeMs AST#expression#Right % AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left SECONDS_ONE_HOUR AST#expression#Right * AST#expression#Left MS_ONE_SECOND 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minutes = 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 minSecTime AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left SECONDS_ONE_MIN AST#expression#Right * AST#expression#Left MS_ONE_SECOND 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left minutes AST#expression#Right + AST#expression#Left ':' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left minutes AST#expression#Right < AST#expression#Left FLAG_NUMBER AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 10 显示两位数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left minStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left '0' AST#expression#Right + AST#expression#Left minStr 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#variable_declaration#Left let AST#variable_declarator#Left seconds = AST#expression#Left AST#binary_expression#Left AST#expression#Left timeMs AST#expression#Right % AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left SECONDS_ONE_MIN AST#expression#Right * AST#expression#Left MS_ONE_SECOND 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left seconds = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left seconds 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 // 乘以1000 然后round AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left seconds = 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 seconds AST#expression#Right / AST#expression#Left MS_ONE_SECOND AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 最后除以1000 再次floor 精确度到小数点后3位 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left secStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left seconds AST#expression#Right + AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left seconds AST#expression#Right < AST#expression#Left FLAG_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 secStr = AST#expression#Left AST#binary_expression#Left AST#expression#Left '0' AST#expression#Right + AST#expression#Left secStr 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left hourStr AST#expression#Right + AST#expression#Left minStr AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left secStr 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 /** * 格式化日期 * @param date 日期 * @param format 格式字符串,例如:'yyyy-MM-dd HH:mm:ss' * @returns 格式化后的字符串 */ AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'yyyy_MM_dd_HHmmss' 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#variable_declaration#Left const AST#variable_declarator#Left MAX_LENGTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 2 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left year = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left date AST#expression#Right . getFullYear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left month = 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#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 . getMonth 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 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_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 . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , 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 day = 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 date 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 . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , 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 hour = 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 date AST#expression#Right . getHours AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , 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 minute = 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 date AST#expression#Right . getMinutes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , 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 second = 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 date AST#expression#Right . getSeconds AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left MAX_LENGTH AST#expression#Right , 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left format AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'yyyy' AST#expression#Right , AST#expression#Left year 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'MM' AST#expression#Right , AST#expression#Left month 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'dd' AST#expression#Right , AST#expression#Left day 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'HH' AST#expression#Right , AST#expression#Left hour 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'mm' AST#expression#Right , AST#expression#Left minute 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left result AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ss' AST#expression#Right , AST#expression#Left second 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 result AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static fillNum AST#parameter_list#Left ( AST#parameter#Left num : 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 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#binary_expression#Left AST#expression#Left num AST#expression#Right < AST#expression#Left 10 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#template_literal#Left ` 0 AST#template_substitution#Left $ { AST#expression#Left num 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#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 num AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right // 视频时长转换 AST#method_declaration#Left static getTimeString AST#parameter_list#Left ( AST#parameter#Left time : 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 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left time 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#expression#Left AST#binary_expression#Left AST#expression#Left time AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left time = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left TIMESTAMP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1000 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 TIME_UNIT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 60 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 MAX_HOURS : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hour = 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#binary_expression#Left AST#expression#Left time AST#expression#Right % 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 TIMESTAMP AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left MAX_HOURS AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left TIMESTAMP AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left TIME_UNIT 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left minute = 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#binary_expression#Left AST#expression#Left time AST#expression#Right % AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left TIMESTAMP AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left TIMESTAMP AST#expression#Right * AST#expression#Left TIME_UNIT 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left second = 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#binary_expression#Left AST#expression#Left time AST#expression#Right % AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left TIMESTAMP AST#expression#Right * AST#expression#Left TIME_UNIT AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left TIMESTAMP AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left hour 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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . fillNum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hour 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 AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . fillNum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left minute 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 AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . fillNum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left second 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#if_statement#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 AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . fillNum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left minute 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 AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . fillNum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left second 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#method_declaration#Right // 获取当前时间 AST#method_declaration#Left static getCurrentTime 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#variable_declaration#Left const AST#variable_declarator#Left now = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentYear : 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 now AST#expression#Right . getFullYear 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 currentMonth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left now AST#expression#Right . getMonth 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 1 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 currentDay : 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 now 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#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 currentYear AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left currentMonth AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left currentDay 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#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TimeUtils { static msToHHMMSS(timeMs: number): string { const MS_ONE_SECOND: number = 1000; const SECONDS_ONE_HOUR: number = 3600; const SECONDS_ONE_MIN: number = 60; const FLAG_NUMBER: number = 10; let hours = Math.floor(timeMs / (SECONDS_ONE_HOUR * MS_ONE_SECOND)); let hourStr = hours + ':'; if (hours < FLAG_NUMBER) { hourStr = '0' + hourStr; } let minSecTime = timeMs % (SECONDS_ONE_HOUR * MS_ONE_SECOND); let minutes = Math.floor(minSecTime / (SECONDS_ONE_MIN * MS_ONE_SECOND)); let minStr = minutes + ':'; if (minutes < FLAG_NUMBER) { minStr = '0' + minStr; } let seconds = timeMs % (SECONDS_ONE_MIN * MS_ONE_SECOND); seconds = Math.round(seconds); seconds = Math.floor(seconds / MS_ONE_SECOND); let secStr = seconds + ''; if (seconds < FLAG_NUMBER) { secStr = '0' + secStr; } return hourStr + minStr + secStr; } static format(date: Date, format: string = 'yyyy_MM_dd_HHmmss'): string { const MAX_LENGTH: number = 2; let year = date.getFullYear().toString(); let month = (date.getMonth() + 1).toString().padStart(MAX_LENGTH, '0'); let day = date.getDate().toString().padStart(MAX_LENGTH, '0'); let hour = date.getHours().toString().padStart(MAX_LENGTH, '0'); let minute = date.getMinutes().toString().padStart(MAX_LENGTH, '0'); let second = date.getSeconds().toString().padStart(MAX_LENGTH, '0'); let result = format.replace('yyyy', year); result = result.replace('MM', month); result = result.replace('dd', day); result = result.replace('HH', hour); result = result.replace('mm', minute); result = result.replace('ss', second); return result; } static fillNum(num: number): string { if (num < 10) { return `0${num}`; } return num.toString(); } static getTimeString(time: number): string { if (time === -1 || time === undefined) { time = 0; } const TIMESTAMP: number = 1000; const TIME_UNIT: number = 60; const MAX_HOURS: number = 24; let hour = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT * MAX_HOURS) / (TIMESTAMP * TIME_UNIT * TIME_UNIT)); let minute = Math.floor(time % (TIMESTAMP * TIME_UNIT * TIME_UNIT) / (TIMESTAMP * TIME_UNIT)); let second = Math.floor(time % (TIMESTAMP * TIME_UNIT) / TIMESTAMP); if (hour > 0) { return `${TimeUtils.fillNum(hour)}:${TimeUtils.fillNum(minute)}:${TimeUtils.fillNum(second)}`; } return `${TimeUtils.fillNum(minute)}:${TimeUtils.fillNum(second)}`; } static getCurrentTime(): string { const now = new Date(); const currentYear: number = now.getFullYear(); let currentMonth: number = now.getMonth() + 1; let currentDay: number = now.getDate(); return `${currentYear}-${currentMonth}-${currentDay}`; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/utils/TimeUtils.ets#L19-L103
096d95a739ee88bf13dd2aa9f164a3d460d5f753
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/view/HomeComponent.ets
arkts
onConfirm
confirm clockL
onConfirm(task: TaskInfo) { this.homeStore.taskClock(task).then((res: AchievementInfo) => { if (res.showAchievement) { let achievementLevel = res.achievementLevel; if (achievementLevel) { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel); } else { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG); } } }) }
AST#method_declaration#Left onConfirm AST#parameter_list#Left ( AST#parameter#Left task : AST#type_annotation#Left AST#primary_type#Left TaskInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . homeStore AST#member_expression#Right AST#expression#Right . taskClock AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left task AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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 AchievementInfo 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 res AST#expression#Right . showAchievement AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left achievementLevel = AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . achievementLevel 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 achievementLevel 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 . broadCast AST#member_expression#Right AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left BroadCastType AST#expression#Right . SHOW_ACHIEVEMENT_DIALOG AST#member_expression#Right AST#expression#Right , AST#expression#Left achievementLevel AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . broadCast AST#member_expression#Right AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left BroadCastType AST#expression#Right . SHOW_ACHIEVEMENT_DIALOG 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#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
onConfirm(task: TaskInfo) { this.homeStore.taskClock(task).then((res: AchievementInfo) => { if (res.showAchievement) { let achievementLevel = res.achievementLevel; if (achievementLevel) { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG, achievementLevel); } else { this.broadCast.emit(BroadCastType.SHOW_ACHIEVEMENT_DIALOG); } } }) }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/view/HomeComponent.ets#L91-L102
ad3df6e9d430792bfddaf9bdaa2ab783f8ab6a02
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets
arkts
获取能力文件
export async function getLocalCapabilities(): Promise<void> { try { let fileData = await backup.getLocalCapabilities(); Logger.info('getLocalCapabilities success'); let fpath = filesDir + '/localCapabilities.json'; fs.copyFileSync(fileData.fd, fpath); // [StartExclude get_local_cap_ability] let file = fs.openSync(fpath, fs.OpenMode.READ_WRITE); // 从文件中读取一段内容 let arrayBuffer = new ArrayBuffer(BUFFER); let readOptions: ReadOptions = { offset: 0, // 从文件的开头开始读取 length: arrayBuffer.byteLength }; let readLen = fs.readSync(file.fd, arrayBuffer, readOptions); // 这个 buf 对象是 arrayBuffer 中从位置 0 开始的前 readLen 字节 let buf = buffer.from(arrayBuffer, 0, readLen); Logger.info('the content of file: ' + buf.toString()); // [EndExclude get_local_cap_ability] fs.closeSync(fileData.fd); } catch (error) { Logger.error('getLocalCapabilities failed with err: ' + JSON.stringify(error)); } }
AST#export_declaration#Left export AST#function_declaration#Left async function getLocalCapabilities 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#variable_declaration#Left let AST#variable_declarator#Left fileData = 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 backup AST#expression#Right AST#await_expression#Right AST#expression#Right . getLocalCapabilities 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 Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'getLocalCapabilities success' 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 fpath = AST#expression#Left AST#binary_expression#Left AST#expression#Left filesDir AST#expression#Right + AST#expression#Left '/localCapabilities.json' 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 fs AST#expression#Right . copyFileSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left fileData AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left fpath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [StartExclude get_local_cap_ability] 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 fpath AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . OpenMode AST#member_expression#Right AST#expression#Right . READ_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#variable_declaration#Left let AST#variable_declarator#Left arrayBuffer = 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 BUFFER AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left readOptions : AST#type_annotation#Left AST#primary_type#Left ReadOptions AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , // 从文件的开头开始读取 AST#property_assignment#Left AST#property_name#Left length AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left arrayBuffer AST#expression#Right . byteLength 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#variable_declaration#Left let AST#variable_declarator#Left readLen = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . readSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left file AST#expression#Right . fd AST#member_expression#Right AST#expression#Right , AST#expression#Left arrayBuffer AST#expression#Right , AST#expression#Left readOptions 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 // 这个 buf 对象是 arrayBuffer 中从位置 0 开始的前 readLen 字节 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 arrayBuffer AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left readLen AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'the content of file: ' AST#expression#Right + AST#expression#Left buf 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#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // [EndExclude get_local_cap_ability] 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 AST#member_expression#Left AST#expression#Left fileData AST#expression#Right . fd AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 'getLocalCapabilities failed with err: ' AST#expression#Right + AST#expression#Left JSON AST#expression#Right AST#binary_expression#Right AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error 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#function_declaration#Right AST#export_declaration#Right
export async function getLocalCapabilities(): Promise<void> { try { let fileData = await backup.getLocalCapabilities(); Logger.info('getLocalCapabilities success'); let fpath = filesDir + '/localCapabilities.json'; fs.copyFileSync(fileData.fd, fpath); let file = fs.openSync(fpath, fs.OpenMode.READ_WRITE); let arrayBuffer = new ArrayBuffer(BUFFER); let readOptions: ReadOptions = { offset: 0, length: arrayBuffer.byteLength }; let readLen = fs.readSync(file.fd, arrayBuffer, readOptions); let buf = buffer.from(arrayBuffer, 0, readLen); Logger.info('the content of file: ' + buf.toString()); fs.closeSync(fileData.fd); } catch (error) { Logger.error('getLocalCapabilities failed with err: ' + JSON.stringify(error)); } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/AppFileBackup/entry/src/main/ets/backuprestore/BackupRestore.ets#L39-L62
8768b5b60b652ff553ab8af71838cf770f0ee071
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets
arkts
handle
应用约束7: 使用private关键字代替#私有字段 应用约束10: 显式指定类型参数
handle(packet: any): void { // 需替换any为具体类型,这里保留any用于示例演示 const client = this.packetManager.client; const data = packet.d; // 应用约束21: 使用Map的get方法代替属性访问 const guild = client.guilds.get(data.guild_id); const user = client.users.get(data.user.id); // 应用约束30: 使用as进行类型断言 if (guild && user) client.emit(Constants.Events.GUILD_BAN_ADD as string, guild, user); }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left any 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 { // 需替换any为具体类型,这里保留any用于示例演示 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left client = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . packetManager AST#member_expression#Right AST#expression#Right . client 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 data = AST#expression#Left AST#member_expression#Left AST#expression#Left packet AST#expression#Right . d AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 应用约束21: 使用Map的get方法代替属性访问 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left guild = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . guilds AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . guild_id 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 user = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . users AST#member_expression#Right AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . user AST#member_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 应用约束30: 使用as进行类型断言 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left guild AST#expression#Right && AST#expression#Left user AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left client AST#expression#Right . emit AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Events AST#member_expression#Right AST#expression#Right . GUILD_BAN_ADD 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#expression#Left guild AST#expression#Right , AST#expression#Left user AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
handle(packet: any): void { const client = this.packetManager.client; const data = packet.d; const guild = client.guilds.get(data.guild_id); const user = client.users.get(data.user.id); if (guild && user) client.emit(Constants.Events.GUILD_BAN_ADD as string, guild, user); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildBanAdd.ets#L9-L17
3d69865327fab75dd33b26dfb3303e9996671e26
github
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildHeader
构建头部统计信息
@Builder buildHeader() { Row() { Column() { Text('周任务时间安排') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`总任务数: ${this.weeklyTaskTimeRangeList.length} | 已完成: ${this.getCompletedCount()} | 进行中: ${this.getInProgressCount()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Button('清空') .type(ButtonType.Normal) .backgroundColor('#DC3545') .fontColor(Color.White) .onClick(() => { this.clearAllTasks(); }) } .margin({ bottom: 20 }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#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 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 总任务数: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weeklyTaskTimeRangeList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right | 已完成: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getCompletedCount 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_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getInProgressCount 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#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#666666' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left '清空' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#DC3545' 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#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clearAllTasks AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 bottom AST#property_name#Right : AST#expression#Left 20 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildHeader() { Row() { Column() { Text('周任务时间安排') .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor('#333333') Text(`总任务数: ${this.weeklyTaskTimeRangeList.length} | 已完成: ${this.getCompletedCount()} | 进行中: ${this.getInProgressCount()}`) .fontSize(14) .fontColor('#666666') } .alignItems(HorizontalAlign.Start) .layoutWeight(1) Button('清空') .type(ButtonType.Normal) .backgroundColor('#DC3545') .fontColor(Color.White) .onClick(() => { this.clearAllTasks(); }) } .margin({ bottom: 20 }) }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L33-L58
feafa8617b19362fd5e04a5509d220826a9cdc7f
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/container/queue_field_sensitive_002_F.ets
arkts
Introduction Queue域敏感
export function queue_field_sensitive_002_F(taint_src : string) { let s = new Queue<string>(); s.add("clean"); s.add(taint_src); taint.Sink(s.getFirst()); }
AST#export_declaration#Left export AST#function_declaration#Left function queue_field_sensitive_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left s = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Queue 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "clean" 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 s AST#expression#Right . add 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#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left s AST#expression#Right . getFirst 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#function_declaration#Right AST#export_declaration#Right
export function queue_field_sensitive_002_F(taint_src : string) { let s = new Queue<string>(); s.add("clean"); s.add(taint_src); taint.Sink(s.getFirst()); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/queue_field_sensitive_002_F.ets#L7-L12
fa6564f859387f40a99a78389235cc0724b330ca
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets
arkts
device info util @since 2024-5-11
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; /** * whether the device type is phone * * @returns true if is phone */ static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_DEFAULT); } /** * whether the device type is tablet * * @returns true if is tablet */ public static isTablet(): boolean { return DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_TABLET; } /** * Check if is foldable * * @returns true if is foldable */ static isFold(): boolean { let isFold: boolean = false; try { isFold = display.isFoldable(); } catch (e) { hilog.error(0x0000, TAG, 'isFold -> isFoldable try error:', e); } return isFold; } /** * Check if is expanded * * @returns true if is expanded */ static isExpanded(): boolean { let isExpanded: boolean = false; try { isExpanded = display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED; } catch (e) { hilog.error(0x0000, TAG, 'isExpanded -> try error:', e); } return isExpanded; } /** * Check if is column * * @returns true if is column */ static isColumn(): boolean { let isColumn: boolean = false; try { isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED || display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED); } catch (e) { hilog.error(0x0000, TAG, 'isColumn -> try error:', e); } return isColumn; } /** * Check if is straight product * * @returns true if is straight product */ public static isStraightProduct(): boolean { return DeviceHelper.isPhone() && !DeviceHelper.isFold(); } }
AST#export_declaration#Left export AST#class_declaration#Left class DeviceHelper AST#class_body#Left { AST#property_declaration#Left static readonly TYPE_DEFAULT = AST#expression#Left 'default' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TYPE_PHONE = AST#expression#Left 'phone' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly TYPE_TABLET = AST#expression#Left 'tablet' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly DEVICE_TYPE = AST#expression#Left AST#member_expression#Left AST#expression#Left deviceInfo AST#expression#Right . deviceType AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * whether the device type is phone * * @returns true if is phone */ AST#method_declaration#Left static isPhone AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 DeviceHelper AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right === AST#expression#Left DeviceHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_PHONE AST#member_expression#Right AST#expression#Right || AST#expression#Left DeviceHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right === AST#expression#Left DeviceHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_DEFAULT AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * whether the device type is tablet * * @returns true if is tablet */ AST#method_declaration#Left public static isTablet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceHelper AST#expression#Right . DEVICE_TYPE AST#member_expression#Right AST#expression#Right === AST#expression#Left DeviceHelper AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_TABLET AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Check if is foldable * * @returns true if is foldable */ AST#method_declaration#Left static isFold AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isFold : 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#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#assignment_expression#Left isFold = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable 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#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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'isFold -> isFoldable try 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#return_statement#Left return AST#expression#Left isFold AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Check if is expanded * * @returns true if is expanded */ AST#method_declaration#Left static isExpanded AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isExpanded : 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#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#assignment_expression#Left isExpanded = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getFoldStatus 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 display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_EXPANDED 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#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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'isExpanded -> try 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#return_statement#Left return AST#expression#Left isExpanded AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Check if is column * * @returns true if is column */ AST#method_declaration#Left static isColumn AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isColumn : 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#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#assignment_expression#Left isColumn = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable 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#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#call_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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . getFoldStatus 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 display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_EXPANDED AST#member_expression#Right AST#expression#Right || AST#expression#Left display AST#expression#Right AST#binary_expression#Right AST#expression#Right . getFoldStatus 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 display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_HALF_FOLDED 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#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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'isColumn -> try 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#return_statement#Left return AST#expression#Left isColumn AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * Check if is straight product * * @returns true if is straight product */ AST#method_declaration#Left public static isStraightProduct AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DeviceHelper AST#expression#Right . isPhone 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#unary_expression#Left ! AST#expression#Left DeviceHelper AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isFold 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 } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class DeviceHelper { static readonly TYPE_DEFAULT = 'default'; static readonly TYPE_PHONE = 'phone'; static readonly TYPE_TABLET = 'tablet'; static readonly DEVICE_TYPE = deviceInfo.deviceType; static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_DEFAULT); } public static isTablet(): boolean { return DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_TABLET; } static isFold(): boolean { let isFold: boolean = false; try { isFold = display.isFoldable(); } catch (e) { hilog.error(0x0000, TAG, 'isFold -> isFoldable try error:', e); } return isFold; } static isExpanded(): boolean { let isExpanded: boolean = false; try { isExpanded = display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED; } catch (e) { hilog.error(0x0000, TAG, 'isExpanded -> try error:', e); } return isExpanded; } static isColumn(): boolean { let isColumn: boolean = false; try { isColumn = display.isFoldable() && (display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED || display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_HALF_FOLDED); } catch (e) { hilog.error(0x0000, TAG, 'isColumn -> try error:', e); } return isColumn; } public static isStraightProduct(): boolean { return DeviceHelper.isPhone() && !DeviceHelper.isFold(); } }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets#L27-L105
e631e46b43345567e49e1ca2b7c436f3fc330263
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets
arkts
getSwiperImages
获取swiper组件图像数据。 @return {Array<Resource>} swiperImages.
getSwiperImages(): Array<Resource> { let swiperImages: Resource[] = [ $r('app.media.ic_swiper1'), $r('app.media.ic_swiper2'), $r('app.media.ic_swiper3'), $r('app.media.ic_swiper4') ]; 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.ic_swiper1' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_swiper2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_swiper3' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_swiper4' 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.ic_swiper1'), $r('app.media.ic_swiper2'), $r('app.media.ic_swiper3'), $r('app.media.ic_swiper4') ]; return swiperImages; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/viewmodel/WindowViewModel.ets#L26-L34
384a1522357a36c3bd3ed22f2cd3b5afef6f8c9d
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets
arkts
updatePersonInfo
更新个人信息 @param {Record<string, unknown>} params - 更新参数 @returns {Promise<NetworkResponse<Unknown>>} 更新结果
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePerson", params); return resp.data; }
AST#method_declaration#Left async updatePersonInfo AST#parameter_list#Left ( AST#parameter#Left params : 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 Unknown 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 NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown 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 resp : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AxiosResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Unknown 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#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 NetworkClient AST#expression#Right AST#await_expression#Right AST#expression#Right . http AST#member_expression#Right AST#expression#Right . post AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "user/info/updatePerson" 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left resp AST#expression#Right . data AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
async updatePersonInfo(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePerson", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L16-L20
df0e59a4e7805bad891d9e22e5145f17dc455550
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
container type enum
export const enum CONTAINER { FLEX = 'Flex', ROW = 'Row', COLUMN = 'Column', STACK = 'Stack', };
AST#export_declaration#Left export AST#enum_declaration#Left const enum CONTAINER AST#enum_body#Left { AST#enum_member#Left FLEX = AST#expression#Left 'Flex' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ROW = AST#expression#Left 'Row' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COLUMN = AST#expression#Left 'Column' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left STACK = AST#expression#Left 'Stack' AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum_declaration#Right ; AST#export_declaration#Right
export const enum CONTAINER { FLEX = 'Flex', ROW = 'Row', COLUMN = 'Column', STACK = 'Stack', };
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L74-L79
c6a2de3435e416d31e836fb59b6074a25a10b6d6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
窗口管理模型
export default class WindowModel { // 默认的顶部导航栏高度 public static readonly STATUS_BAR_HEIGHT = 38.8; // 默认的底部导航条高度 public static readonly BOTTOM_AVOID_HEIGHT = 10; private constructor() { } // WindowModel 单例 private static instance?: WindowModel; // 键值对 private objects = new Map<string, Object>(); /** * 获取WindowModel单例实例 * @returns {WindowModel} WindowModel */ static getInstance(): WindowModel { if (!WindowModel.instance) { WindowModel.instance = new WindowModel(); } return WindowModel.instance; } // 缓存的当前WindowStage实例 private windowStage?: window.WindowStage; /** * 缓存windowStage * @param windowStage 当前WindowStage实例 * @returns {void} */ setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; } /** * 当前主窗口是否开启沉浸模式 * @param enable 是否开启 * @returns {void} */ setMainWindowImmersive(enable: boolean): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } windowClass.setWindowLayoutFullScreen(enable, (err) => { if (err.code) { logger.error(`Failed to set full-screen mode. Code:${err.code}, message:${err.message}`); return; } }); }); } /** * 获取主窗口顶部导航栏高度 * @returns {callback((statusBarHeight: number) => void))} */ getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } try { const type = window.AvoidAreaType.TYPE_SYSTEM; const avoidArea = windowClass.getWindowAvoidArea(type); const height = avoidArea.topRect.height; logger.info("Successful get statusHeight" + height); callback(height); } catch (err) { callback(WindowModel.STATUS_BAR_HEIGHT); logger.info("Failed to get statusHeight"); } }); } /** * 获取主窗口底部导航条高度 * @returns {callback: ((bottomAvoidHeight: number) => void)} */ getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } try { const type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; const avoidArea = windowClass.getWindowAvoidArea(type); const height = avoidArea.bottomRect.height; logger.info('Successful get bottomAvoidHeight ==' + height); callback(height); } catch (err) { callback(WindowModel.BOTTOM_AVOID_HEIGHT); logger.info("Failed to get bottomAvoidHeight"); } }); } /** * 获取手机物理逻辑密度 * @returns {Promise<number>} */ async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays(); WindowModel.getInstance().setObject('display', globalDisplays); return globalDisplays[0].densityPixels;
AST#export_declaration#Left export default AST#ERROR#Left class WindowModel { // 默认的顶部导航栏高度 AST#property_declaration#Left public static readonly STATUS_BAR_HEIGHT = AST#expression#Left 38.8 AST#expression#Right ; AST#property_declaration#Right // 默认的底部导航条高度 AST#property_declaration#Left public static readonly BOTTOM_AVOID_HEIGHT = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right // WindowModel 单例 AST#property_declaration#Left private static instance ? : AST#type_annotation#Left AST#primary_type#Left WindowModel AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 键值对 AST#property_declaration#Left private objects = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Map AST#expression#Right AST#new_expression#Right AST#expression#Right AST#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#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 获取WindowModel单例实例 * @returns {WindowModel} WindowModel */ AST#method_declaration#Left static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left WindowModel AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left WindowModel AST#expression#Right AST#unary_expression#Right AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left WindowModel AST#expression#Right . instance AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left WindowModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WindowModel AST#expression#Right . instance AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right // 缓存的当前WindowStage实例 AST#property_declaration#Left private windowStage ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * 缓存windowStage * @param windowStage 当前WindowStage实例 * @returns {void} */ AST#method_declaration#Left setWindowStage AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 . windowStage AST#member_expression#Right = AST#expression#Left windowStage AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 当前主窗口是否开启沉浸模式 * @param enable 是否开启 * @returns {void} */ AST#method_declaration#Left setMainWindowImmersive AST#parameter_list#Left ( AST#parameter#Left enable : 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#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 . windowStage AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowStage is undefined.' 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 . windowStage AST#member_expression#Right AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to obtain the main window. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 windowClass AST#expression#Right . setWindowLayoutFullScreen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left enable AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to set full-screen mode. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 /** * 获取主窗口顶部导航栏高度 * @returns {callback((statusBarHeight: number) => void))} */ AST#method_declaration#Left getStatusBarHeight AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left statusBarHeight : 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#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . windowStage AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowStage is undefined.' 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 . windowStage AST#member_expression#Right AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to obtain the main window. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left type = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_SYSTEM AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avoidArea = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type 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 height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidArea AST#expression#Right . topRect AST#member_expression#Right 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#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#binary_expression#Left AST#expression#Left "Successful get statusHeight" AST#expression#Right + AST#expression#Left height 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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left height AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WindowModel AST#expression#Right . STATUS_BAR_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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "Failed to get statusHeight" 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#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取主窗口底部导航条高度 * @returns {callback: ((bottomAvoidHeight: number) => void)} */ AST#method_declaration#Left getBottomAvoidHeight AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left bottomAvoidHeight : 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#parenthesized_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . windowStage AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowStage is undefined.' 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 . windowStage AST#member_expression#Right AST#expression#Right . getMainWindow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Window AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to obtain the main window. Code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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 { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left type = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left avoidArea = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowClass AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left type 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 height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left avoidArea AST#expression#Right . bottomRect AST#member_expression#Right 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#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#binary_expression#Left AST#expression#Left 'Successful get bottomAvoidHeight ==' AST#expression#Right + AST#expression#Left height 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 callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left height AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left WindowModel AST#expression#Right . BOTTOM_AVOID_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 logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "Failed to get bottomAvoidHeight" 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#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 获取手机物理逻辑密度 * @returns {Promise<number>} */ AST#method_declaration#Left async getDisplay 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 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#extend_function_body#Left { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left globalDisplays = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left WindowModel AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'display' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Array AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right < AST#expression#Left DisplayType AST#expression#Right AST#binary_expression#Right AST#expression#Right > AST#expression#Left if AST#expression#Right AST#binary_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 ArrayUtil AST#expression#Right . isNotNullEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left globalDisplays 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#ERROR#Left AST#property_name#Left return AST#property_name#Right globalDisplays AST#ERROR#Right AST#property_name#Left [ AST#expression#Left 0 AST#expression#Right ] AST#property_name#Right AST#ERROR#Right AST#modifier_chain_expression#Left . densityPixels AST#modifier_chain_expression#Right AST#ERROR#Left ; AST#ERROR#Right } AST#extend_function_body#Right AST#method_declaration#Right AST#property_declaration#Left globalDisplays = 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 display AST#expression#Right AST#await_expression#Right AST#expression#Right . getAllDisplays 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#method_declaration#Left WindowModel AST#ERROR#Left . getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right . setObject AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 'display' , globalDisplays AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right return globalDisplays AST#ERROR#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right . densityPixels AST#member_expression#Right AST#expression#Right ; AST#export_declaration#Right
export default class WindowModel { public static readonly STATUS_BAR_HEIGHT = 38.8; public static readonly BOTTOM_AVOID_HEIGHT = 10; private constructor() { } private static instance?: WindowModel; private objects = new Map<string, Object>(); static getInstance(): WindowModel { if (!WindowModel.instance) { WindowModel.instance = new WindowModel(); } return WindowModel.instance; } private windowStage?: window.WindowStage; setWindowStage(windowStage: window.WindowStage): void { this.windowStage = windowStage; } setMainWindowImmersive(enable: boolean): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } windowClass.setWindowLayoutFullScreen(enable, (err) => { if (err.code) { logger.error(`Failed to set full-screen mode. Code:${err.code}, message:${err.message}`); return; } }); }); } getStatusBarHeight(callback: ((statusBarHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } try { const type = window.AvoidAreaType.TYPE_SYSTEM; const avoidArea = windowClass.getWindowAvoidArea(type); const height = avoidArea.topRect.height; logger.info("Successful get statusHeight" + height); callback(height); } catch (err) { callback(WindowModel.STATUS_BAR_HEIGHT); logger.info("Failed to get statusHeight"); } }); } getBottomAvoidHeight(callback: ((bottomAvoidHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to obtain the main window. Code:${err.code}, message:${err.message}`); return; } try { const type = window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR; const avoidArea = windowClass.getWindowAvoidArea(type); const height = avoidArea.bottomRect.height; logger.info('Successful get bottomAvoidHeight ==' + height); callback(height); } catch (err) { callback(WindowModel.BOTTOM_AVOID_HEIGHT); logger.info("Failed to get bottomAvoidHeight"); } }); } async getDisplay(): Promise<number> { let globalDisplays = WindowModel.getInstance().getObject('display') as Array<DisplayType> if (ArrayUtil.isNotNullEmpty(globalDisplays)) { return globalDisplays[0].densityPixels; } globalDisplays = await display.getAllDisplays(); WindowModel.getInstance().setObject('display', globalDisplays); return globalDisplays[0].densityPixels;
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets#L27-L154
1c647a71f04bf867159a5e0a2a5c01e542f6cbe4
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setEnableCustomYAxisLabels
Set whether to fully use custom labels @param numbers labels
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
AST#method_declaration#Left public setEnableCustomYAxisLabels AST#parameter_list#Left ( AST#parameter#Left enableCustomYAxisLabels : 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 . enableCustomYAxisLabels AST#member_expression#Right = AST#expression#Left enableCustomYAxisLabels AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L175-L177
ccb6f9fc1030a76059736f834e7664e224d5dcc5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getWeekDay
获取给定的日期是星期几 @returns 周几
static getWeekDay(date: number | string | Date): number { return DateUtil.getFormatDate(date).getDay(); }
AST#method_declaration#Left static getWeekDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date 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 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#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 DateUtil AST#expression#Right . getFormatDate 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 . getDay 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 getWeekDay(date: number | string | Date): number { return DateUtil.getFormatDate(date).getDay(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L333-L335
627deb4558a014423d9ee4ccb48751d7284228b5
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Transformer.ets
arkts
generateTransformedValuesCandle
Transforms an List of Entry into a float array containing the x and y values transformed with all matrices for the CANDLESTICKCHART. @param data @return
public generateTransformedValuesCandle(data: ICandleDataSet, phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] { const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesCandle.length != count) { this.valuePointsForGenerateTransformedValuesCandle = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesCandle; for (let j = 0; j < count; j += 2) { let e: CandleEntry | null = data.getEntryForIndex(j / 2 + fromValue); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getHigh() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
AST#method_declaration#Left public generateTransformedValuesCandle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ICandleDataSet AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fromValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toValue : 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#array_type#Left number [ ] 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 count : 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#binary_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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left toValue AST#expression#Right - AST#expression#Left fromValue AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left phaseX AST#expression#Right AST#binary_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 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesCandle AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left count 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 . valuePointsForGenerateTransformedValuesCandle AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array AST#expression#Right AST#new_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 count 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#variable_declaration#Left let AST#variable_declarator#Left valuePoints : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . valuePointsForGenerateTransformedValuesCandle AST#member_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 j = 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 j AST#expression#Right < AST#expression#Left count AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left j += AST#expression#Left 2 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left e : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CandleEntry 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . getEntryForIndex 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 j AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left fromValue AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left e AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getX 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#binary_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 valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = e AST#ERROR#Right . getHigh 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 phaseY AST#expression#Right AST#binary_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#subscript_expression#Left AST#expression#Left valuePoints AST#expression#Right [ AST#expression#Left j 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 0 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 valuePoints AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left j AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 0 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getValueToPixelMatrix AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . mapPoints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left valuePoints 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 valuePoints AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public generateTransformedValuesCandle(data: ICandleDataSet, phaseX: number, phaseY: number, fromValue: number, toValue: number): number[] { const count: number = Math.floor(((toValue - fromValue) * phaseX + 1) * 2); if (this.valuePointsForGenerateTransformedValuesCandle.length != count) { this.valuePointsForGenerateTransformedValuesCandle = new Array<number>(count); } let valuePoints: number[] = this.valuePointsForGenerateTransformedValuesCandle; for (let j = 0; j < count; j += 2) { let e: CandleEntry | null = data.getEntryForIndex(j / 2 + fromValue); if (e != null) { valuePoints[j] = e.getX(); valuePoints[j + 1] = e.getHigh() * phaseY; } else { valuePoints[j] = 0; valuePoints[j + 1] = 0; } } this.getValueToPixelMatrix().mapPoints(valuePoints); return valuePoints; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Transformer.ets#L218-L244
6c09c469ee8ca442b4849dd714dba64882c02a82
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
isSM
是否为小断点 @returns {boolean} 是否小断点
isSM(): boolean { return this.current === BreakpointType.SM; }
AST#method_declaration#Left isSM AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current AST#member_expression#Right AST#expression#Right === AST#expression#Left BreakpointType AST#expression#Right AST#binary_expression#Right AST#expression#Right . SM AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
isSM(): boolean { return this.current === BreakpointType.SM; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L97-L99
992f6cb7e3e119457118dafc021f3343ed7e029f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/RegexUtil.ets
arkts
TODO 正则工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class RegexUtil { /** * 英文字母 、数字和下划线 */ static readonly REG_GENERAL: string = "^\\w+$"; /** * 数字 */ static readonly REG_NUMBERS: string = "^\\d+$"; /** * 字母 */ static readonly REG_WORD: string = "^[a-zA-Z]+$"; /** * 单个中文汉字 * 参照维基百科汉字Unicode范围(https://zh.wikipedia.org/wiki/%E6%B1%89%E5%AD%97) */ static readonly REG_CHINESE: string = "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uDC00-\uD869\uDEDF\uD869\uDF00-\uD86D\uDF3F\uD86D\uDF40-\uD86E\uDC1F\uD86E\uDC20-\uD873\uDEAF\uD87E\uDC00-\uD87E\uDE1F]$"; /** * 中文汉字 */ static readonly REG_CHINESES: string = RegexUtil.REG_CHINESE + "+"; /** * 分组 */ static readonly REG_GROUP_VAR: string = "^\\$(\\d+)$"; /** * IP v4 采用分组方式便于解析地址的每一个段 */ static readonly REG_IPV4: string = "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)$"; /** * IP v6 */ static readonly REG_IPV6: string = "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))$"; /** * 货币 */ static readonly REG_MONEY: string = "^(\\d+(?:\\.\\d+)?)$"; /** * 邮件,符合RFC 5322规范,正则来自:http://emailregex.com/ */ static readonly REG_EMAIL: string = "^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])$"; /** * 移动电话 */ static readonly REG_MOBILE: string = "^(?:0|86|\\+86)?1[3-9]\\d{9}$"; /** * 中国香港移动电话 * eg: 中国香港: +852 5100 4810, 三位区域码+10位数字, 中国香港手机号码8位数 * eg: 中国大陆: +86 180 4953 1399,2位区域码标示+13位数字 * 中国大陆 +86 Mainland China * 中国香港 +852 Hong Kong * 中国澳门 +853 Macao * 中国台湾 +886 Taiwan */ static readonly REG_MOBILE_HK: string = "^(?:0|852|\\+852)?\\d{8}$"; /** * 中国台湾移动电话 * eg: 中国台湾: +886 09 60 000000, 三位区域码+号码以数字09开头 + 8位数字, 中国台湾手机号码10位数 * 中国台湾 +886 Taiwan 国际域名缩写:TW */ static readonly REG_MOBILE_TW: string = "^(?:0|886|\\+886)?(?:|-)09\\d{8}$"; /** * 中国澳门移动电话 * eg: 中国台湾: +853 68 00000, 三位区域码 +号码以数字6开头 + 7位数字, 中国台湾手机号码8位数 * 中国澳门 +853 Macao 国际域名缩写:MO */ static readonly REG_MOBILE_MO: string = "^(?:0|853|\\+853)?(?:|-)6\\d{7}$"; /** * 座机号码 */ static readonly REG_TEL: string = "^(010|02\\d|0[3-9]\\d{2})-?(\\d{6,8})$"; /** * 座机号码+400+800电话 */ static readonly REG_TEL_400_800: string = "^0\\d{2,3}[\\- ]?[1-9]\\d{6,7}|[48]00[\\- ]?[1-9]\\d{6}$"; /** * 18位身份证号码 */ static readonly REG_CITIZEN_ID: string = "^[1-9]\\d{5}[1-2]\\d{3}((0\\d)|(1[0-2]))(([012]\\d)|3[0-1])\\d{3}(\\d|X|x)$"; /** * 邮编,兼容港澳台 */ static readonly REG_ZIP_CODE: string = "^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[0-7]|6[0-7]|7[0-5]|8[0-9]|9[0-8])\\d{4}|99907[78]$"; /** * 生日 */ static readonly REG_BIRTHDAY: string = "^(\\d{2,4})([/\\-.年]?)(\\d{1,2})([/\\-.月]?)(\\d{1,2})日?$"; /** * URI * 定义见:https://www.ietf.org/rfc/rfc3986.html#appendix-B */ static readonly REG_URI: string = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"; /** * URL */ static readonly REG_URL: string = "^[a-zA-Z]+://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$"; /** * Http URL(来自:http://urlregex.com/) * 此正则同时支持FTP、File等协议的URL */ static readonly REG_URL_HTTP: string = "^(https?|ftp|file)://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$"; /** * 中文字、英文字母、数字和下划线 */ static readonly REG_GENERAL_WITH_CHINESE: string = "^[\u4E00-\u9FFF\\w]+$"; /** * UUID */ static readonly REG_UUID: string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; /** * 不带横线的UUID */ static readonly REG_UUID_SIMPLE: string = "^[0-9a-fA-F]{32}$"; /** * MAC地址正则 */ static readonly REG_MAC_ADDRESS: string = "^((?:[a-fA-F0-9]{1,2}[:-]){5}[a-fA-F0-9]{1,2})|0x(\\d{12}).+ETHER$"; /** * 16进制字符串 */ static readonly REG_HEX: string = "^[a-fA-F0-9]+$"; /** * 时间正则 */ static readonly REG_TIME: string = "^\\d{1,2}:\\d{1,2}(:\\d{1,2})?$"; /** * 中国车牌号码(兼容新能源车牌) */ static readonly REG_PLATE_NUMBER: string = "^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[ABCDEFGHJK])|([ABCDEFGHJK]([A-HJ-NP-Z0-9])[0-9]{4})))|" + "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]\\d{3}\\d{1,3}[领])|" + "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$"; /** * 社会统一信用代码 * 第一部分:登记管理部门代码1位 (数字或大写英文字母) * 第二部分:机构类别代码1位 (数字或大写英文字母) * 第三部分:登记管理机关行政区划码6位 (数字) * 第四部分:主体标识码(组织机构代码)9位 (数字或大写英文字母) * 第五部分:校验码1位 (数字或大写英文字母) */ static readonly REG_CREDIT_CODE: string = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$"; /** * 车架号 * 别名:车辆识别代号 车辆识别码 * 十七位码、车架号 * 车辆的唯一标示 */ static readonly REG_CAR_VIN: string = "^[A-HJ-NPR-Z0-9]{8}[0-9X][A-HJ-NPR-Z0-9]{2}\\d{6}$"; /** * 驾驶证 别名:驾驶证档案编号、行驶证编号 * 12位数字字符串 * 仅限:中国驾驶证档案编号 */ static readonly REG_CAR_DRIVING_LICENCE: string = "^[0-9]{12}$"; /** * 中文姓名 */ static readonly REG_CHINESE_NAME: string = "^[\u2E80-\u9FFF·]{2,60}$"; /** * 判断字符串是否包含表情(匹配单个emoji或多个组合emoji的正则表达式) * 注意:这个正则表达式可能不是完美的,因为新的emoji不断被添加到Unicode标准中 */ static readonly REG_EMOJI: string = "/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g"; /** * 给定内容是否匹配正则(配合RegexUtil里的正则常量一起使用) * @param content 内容 * @param regex 正则 */ static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } } /** * 判断传入的电话号码格式是否正确。 * @param phone 电话号码 */ static isPhone(phone: string): boolean { return FormatUtil.isPhone(phone); } /** * 检查字符串是否只包含数字字符 * @param str - 要检查的字符串 * @returns 如果字符串只包含数字则返回 true,否则返回 false */ static isDigits(str: string): boolean { if (typeof str !== 'string' || str.length === 0) { return false; } return RegexUtil.isMatch(str, RegexUtil.REG_NUMBERS); } /** * 判断传入的邮箱格式是否正确 * @param content * @returns */ static isEmail(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMAIL); } /** * 判断字符串是否包含表情(匹配单个emoji或多个组合emoji的正则表达式) * 注意:这个正则表达式可能不是完美的,因为新的emoji不断被添加到Unicode标准中 * @param content * @returns */ static isEmoji(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMOJI); } /** * 验证身份证号码的有效性 * @param id * @returns */ static isValidCard(id: string): boolean { if (id.length === 18) { const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; id = id.toUpperCase(); const lastChar = id.charAt(17).toUpperCase(); let sum = 0; id.substring(0, 17).split('').forEach((value, index) => { sum += factor[index] * parseInt(value, 10); }); const mod = sum % lastLetter.length; return lastLetter[mod] === lastChar; } else if (id.length === 15) { const regex15 = "^[1-9]\\d{5}\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}$"; return RegexUtil.isMatch(id, regex15); } return false; } }
AST#export_declaration#Left export AST#class_declaration#Left class RegexUtil AST#class_body#Left { /** * 英文字母 、数字和下划线 */ AST#property_declaration#Left static readonly REG_GENERAL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\w+$" AST#expression#Right ; AST#property_declaration#Right /** * 数字 */ AST#property_declaration#Left static readonly REG_NUMBERS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\d+$" AST#expression#Right ; AST#property_declaration#Right /** * 字母 */ AST#property_declaration#Left static readonly REG_WORD : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[a-zA-Z]+$" AST#expression#Right ; AST#property_declaration#Right /** * 单个中文汉字 * 参照维基百科汉字Unicode范围(https://zh.wikipedia.org/wiki/%E6%B1%89%E5%AD%97) */ AST#property_declaration#Left static readonly REG_CHINESE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uDC00-\uD869\uDEDF\uD869\uDF00-\uD86D\uDF3F\uD86D\uDF40-\uD86E\uDC1F\uD86E\uDC20-\uD873\uDEAF\uD87E\uDC00-\uD87E\uDE1F]$" AST#expression#Right ; AST#property_declaration#Right /** * 中文汉字 */ AST#property_declaration#Left static readonly REG_CHINESES : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . REG_CHINESE AST#member_expression#Right AST#expression#Right + AST#expression#Left "+" AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 分组 */ AST#property_declaration#Left static readonly REG_GROUP_VAR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\$(\\d+)$" AST#expression#Right ; AST#property_declaration#Right /** * IP v4 采用分组方式便于解析地址的每一个段 */ AST#property_declaration#Left static readonly REG_IPV4 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)$" AST#expression#Right ; AST#property_declaration#Right /** * IP v6 */ AST#property_declaration#Left static readonly REG_IPV6 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))$" AST#expression#Right ; AST#property_declaration#Right /** * 货币 */ AST#property_declaration#Left static readonly REG_MONEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(\\d+(?:\\.\\d+)?)$" AST#expression#Right ; AST#property_declaration#Right /** * 邮件,符合RFC 5322规范,正则来自:http://emailregex.com/ */ AST#property_declaration#Left static readonly REG_EMAIL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])$" AST#expression#Right ; AST#property_declaration#Right /** * 移动电话 */ AST#property_declaration#Left static readonly REG_MOBILE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(?:0|86|\\+86)?1[3-9]\\d{9}$" AST#expression#Right ; AST#property_declaration#Right /** * 中国香港移动电话 * eg: 中国香港: +852 5100 4810, 三位区域码+10位数字, 中国香港手机号码8位数 * eg: 中国大陆: +86 180 4953 1399,2位区域码标示+13位数字 * 中国大陆 +86 Mainland China * 中国香港 +852 Hong Kong * 中国澳门 +853 Macao * 中国台湾 +886 Taiwan */ AST#property_declaration#Left static readonly REG_MOBILE_HK : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(?:0|852|\\+852)?\\d{8}$" AST#expression#Right ; AST#property_declaration#Right /** * 中国台湾移动电话 * eg: 中国台湾: +886 09 60 000000, 三位区域码+号码以数字09开头 + 8位数字, 中国台湾手机号码10位数 * 中国台湾 +886 Taiwan 国际域名缩写:TW */ AST#property_declaration#Left static readonly REG_MOBILE_TW : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(?:0|886|\\+886)?(?:|-)09\\d{8}$" AST#expression#Right ; AST#property_declaration#Right /** * 中国澳门移动电话 * eg: 中国台湾: +853 68 00000, 三位区域码 +号码以数字6开头 + 7位数字, 中国台湾手机号码8位数 * 中国澳门 +853 Macao 国际域名缩写:MO */ AST#property_declaration#Left static readonly REG_MOBILE_MO : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(?:0|853|\\+853)?(?:|-)6\\d{7}$" AST#expression#Right ; AST#property_declaration#Right /** * 座机号码 */ AST#property_declaration#Left static readonly REG_TEL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(010|02\\d|0[3-9]\\d{2})-?(\\d{6,8})$" AST#expression#Right ; AST#property_declaration#Right /** * 座机号码+400+800电话 */ AST#property_declaration#Left static readonly REG_TEL_400_800 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^0\\d{2,3}[\\- ]?[1-9]\\d{6,7}|[48]00[\\- ]?[1-9]\\d{6}$" AST#expression#Right ; AST#property_declaration#Right /** * 18位身份证号码 */ AST#property_declaration#Left static readonly REG_CITIZEN_ID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[1-9]\\d{5}[1-2]\\d{3}((0\\d)|(1[0-2]))(([012]\\d)|3[0-1])\\d{3}(\\d|X|x)$" AST#expression#Right ; AST#property_declaration#Right /** * 邮编,兼容港澳台 */ AST#property_declaration#Left static readonly REG_ZIP_CODE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[0-7]|6[0-7]|7[0-5]|8[0-9]|9[0-8])\\d{4}|99907[78]$" AST#expression#Right ; AST#property_declaration#Right /** * 生日 */ AST#property_declaration#Left static readonly REG_BIRTHDAY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(\\d{2,4})([/\\-.年]?)(\\d{1,2})([/\\-.月]?)(\\d{1,2})日?$" AST#expression#Right ; AST#property_declaration#Right /** * URI * 定义见:https://www.ietf.org/rfc/rfc3986.html#appendix-B */ AST#property_declaration#Left static readonly REG_URI : 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 /** * URL */ AST#property_declaration#Left static readonly REG_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[a-zA-Z]+://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$" AST#expression#Right ; AST#property_declaration#Right /** * Http URL(来自:http://urlregex.com/) * 此正则同时支持FTP、File等协议的URL */ AST#property_declaration#Left static readonly REG_URL_HTTP : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^(https?|ftp|file)://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$" AST#expression#Right ; AST#property_declaration#Right /** * 中文字、英文字母、数字和下划线 */ AST#property_declaration#Left static readonly REG_GENERAL_WITH_CHINESE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[\u4E00-\u9FFF\\w]+$" AST#expression#Right ; AST#property_declaration#Right /** * UUID */ AST#property_declaration#Left static readonly REG_UUID : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" AST#expression#Right ; AST#property_declaration#Right /** * 不带横线的UUID */ AST#property_declaration#Left static readonly REG_UUID_SIMPLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[0-9a-fA-F]{32}$" AST#expression#Right ; AST#property_declaration#Right /** * MAC地址正则 */ AST#property_declaration#Left static readonly REG_MAC_ADDRESS : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^((?:[a-fA-F0-9]{1,2}[:-]){5}[a-fA-F0-9]{1,2})|0x(\\d{12}).+ETHER$" AST#expression#Right ; AST#property_declaration#Right /** * 16进制字符串 */ AST#property_declaration#Left static readonly REG_HEX : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[a-fA-F0-9]+$" AST#expression#Right ; AST#property_declaration#Right /** * 时间正则 */ AST#property_declaration#Left static readonly REG_TIME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^\\d{1,2}:\\d{1,2}(:\\d{1,2})?$" AST#expression#Right ; AST#property_declaration#Right /** * 中国车牌号码(兼容新能源车牌) */ AST#property_declaration#Left static readonly REG_PLATE_NUMBER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[ABCDEFGHJK])|([ABCDEFGHJK]([A-HJ-NP-Z0-9])[0-9]{4})))|" AST#expression#Right + AST#expression#Left "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]\\d{3}\\d{1,3}[领])|" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$" AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right /** * 社会统一信用代码 * 第一部分:登记管理部门代码1位 (数字或大写英文字母) * 第二部分:机构类别代码1位 (数字或大写英文字母) * 第三部分:登记管理机关行政区划码6位 (数字) * 第四部分:主体标识码(组织机构代码)9位 (数字或大写英文字母) * 第五部分:校验码1位 (数字或大写英文字母) */ AST#property_declaration#Left static readonly REG_CREDIT_CODE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$" AST#expression#Right ; AST#property_declaration#Right /** * 车架号 * 别名:车辆识别代号 车辆识别码 * 十七位码、车架号 * 车辆的唯一标示 */ AST#property_declaration#Left static readonly REG_CAR_VIN : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[A-HJ-NPR-Z0-9]{8}[0-9X][A-HJ-NPR-Z0-9]{2}\\d{6}$" AST#expression#Right ; AST#property_declaration#Right /** * 驾驶证 别名:驾驶证档案编号、行驶证编号 * 12位数字字符串 * 仅限:中国驾驶证档案编号 */ AST#property_declaration#Left static readonly REG_CAR_DRIVING_LICENCE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[0-9]{12}$" AST#expression#Right ; AST#property_declaration#Right /** * 中文姓名 */ AST#property_declaration#Left static readonly REG_CHINESE_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "^[\u2E80-\u9FFF·]{2,60}$" AST#expression#Right ; AST#property_declaration#Right /** * 判断字符串是否包含表情(匹配单个emoji或多个组合emoji的正则表达式) * 注意:这个正则表达式可能不是完美的,因为新的emoji不断被添加到Unicode标准中 */ AST#property_declaration#Left static readonly REG_EMOJI : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g" AST#expression#Right ; AST#property_declaration#Right /** * 给定内容是否匹配正则(配合RegexUtil里的正则常量一起使用) * @param content 内容 * @param regex 正则 */ AST#method_declaration#Left static isMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left regex : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left RegExp AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left content AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left content 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#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left regex AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#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#new_expression#Left new AST#expression#Left RegExp AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left regex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#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 regex AST#expression#Right . test AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 判断传入的电话号码格式是否正确。 * @param phone 电话号码 */ AST#method_declaration#Left static isPhone AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FormatUtil AST#expression#Right . isPhone AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left phone 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 str - 要检查的字符串 * @returns 如果字符串只包含数字则返回 true,否则返回 false */ AST#method_declaration#Left static isDigits 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left str AST#expression#Right AST#unary_expression#Right AST#expression#Right !== AST#expression#Left 'string' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left str AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . isMatch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . REG_NUMBERS AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 判断传入的邮箱格式是否正确 * @param content * @returns */ AST#method_declaration#Left static isEmail 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 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 RegexUtil AST#expression#Right . isMatch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . REG_EMAIL AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 判断字符串是否包含表情(匹配单个emoji或多个组合emoji的正则表达式) * 注意:这个正则表达式可能不是完美的,因为新的emoji不断被添加到Unicode标准中 * @param content * @returns */ AST#method_declaration#Left static isEmoji 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 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 RegexUtil AST#expression#Right . isMatch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left content AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left RegexUtil AST#expression#Right . REG_EMOJI AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 验证身份证号码的有效性 * @param id * @returns */ AST#method_declaration#Left static isValidCard 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#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left id AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 18 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left factor = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 7 AST#expression#Right , AST#expression#Left 9 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 8 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 6 AST#expression#Right , AST#expression#Left 3 AST#expression#Right , AST#expression#Left 7 AST#expression#Right , AST#expression#Left 9 AST#expression#Right , AST#expression#Left 10 AST#expression#Right , AST#expression#Left 5 AST#expression#Right , AST#expression#Left 8 AST#expression#Right , AST#expression#Left 4 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left lastLetter = AST#expression#Left AST#array_literal#Left [ AST#expression#Left "1" AST#expression#Right , AST#expression#Left "0" AST#expression#Right , AST#expression#Left "X" AST#expression#Right , AST#expression#Left "9" AST#expression#Right , AST#expression#Left "8" AST#expression#Right , AST#expression#Left "7" AST#expression#Right , AST#expression#Left "6" AST#expression#Right , AST#expression#Left "5" AST#expression#Right , AST#expression#Left "4" AST#expression#Right , AST#expression#Left "3" AST#expression#Right , AST#expression#Left "2" 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#assignment_expression#Left id = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left id 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#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 lastChar = 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 id AST#expression#Right . charAt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 17 AST#expression#Right ) AST#argument_list#Right AST#call_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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sum = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left id AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 17 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right 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 . 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 value AST#parameter#Right , AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left sum += AST#expression#Left AST#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left factor AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right * AST#expression#Left parseInt AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left value AST#expression#Right , AST#expression#Left 10 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left mod = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left sum AST#expression#Right % AST#expression#Left lastLetter AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left lastLetter AST#expression#Right [ AST#expression#Left mod AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right === AST#expression#Left lastChar AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left id AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 15 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left regex15 = AST#expression#Left "^[1-9]\\d{5}\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}$" 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 RegexUtil AST#expression#Right . isMatch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left id AST#expression#Right , AST#expression#Left regex15 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#if_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#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class RegexUtil { static readonly REG_GENERAL: string = "^\\w+$"; static readonly REG_NUMBERS: string = "^\\d+$"; static readonly REG_WORD: string = "^[a-zA-Z]+$"; static readonly REG_CHINESE: string = "^[\u2E80-\u2EFF\u2F00-\u2FDF\u31C0-\u31EF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\uD840\uDC00-\uD869\uDEDF\uD869\uDF00-\uD86D\uDF3F\uD86D\uDF40-\uD86E\uDC1F\uD86E\uDC20-\uD873\uDEAF\uD87E\uDC00-\uD87E\uDE1F]$"; static readonly REG_CHINESES: string = RegexUtil.REG_CHINESE + "+"; static readonly REG_GROUP_VAR: string = "^\\$(\\d+)$"; static readonly REG_IPV4: string = "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)$"; static readonly REG_IPV6: string = "^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))$"; static readonly REG_MONEY: string = "^(\\d+(?:\\.\\d+)?)$"; static readonly REG_EMAIL: string = "^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)])$"; static readonly REG_MOBILE: string = "^(?:0|86|\\+86)?1[3-9]\\d{9}$"; static readonly REG_MOBILE_HK: string = "^(?:0|852|\\+852)?\\d{8}$"; static readonly REG_MOBILE_TW: string = "^(?:0|886|\\+886)?(?:|-)09\\d{8}$"; static readonly REG_MOBILE_MO: string = "^(?:0|853|\\+853)?(?:|-)6\\d{7}$"; static readonly REG_TEL: string = "^(010|02\\d|0[3-9]\\d{2})-?(\\d{6,8})$"; static readonly REG_TEL_400_800: string = "^0\\d{2,3}[\\- ]?[1-9]\\d{6,7}|[48]00[\\- ]?[1-9]\\d{6}$"; static readonly REG_CITIZEN_ID: string = "^[1-9]\\d{5}[1-2]\\d{3}((0\\d)|(1[0-2]))(([012]\\d)|3[0-1])\\d{3}(\\d|X|x)$"; static readonly REG_ZIP_CODE: string = "^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[0-7]|6[0-7]|7[0-5]|8[0-9]|9[0-8])\\d{4}|99907[78]$"; static readonly REG_BIRTHDAY: string = "^(\\d{2,4})([/\\-.年]?)(\\d{1,2})([/\\-.月]?)(\\d{1,2})日?$"; static readonly REG_URI: string = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"; static readonly REG_URL: string = "^[a-zA-Z]+://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$"; static readonly REG_URL_HTTP: string = "^(https?|ftp|file)://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]$"; static readonly REG_GENERAL_WITH_CHINESE: string = "^[\u4E00-\u9FFF\\w]+$"; static readonly REG_UUID: string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"; static readonly REG_UUID_SIMPLE: string = "^[0-9a-fA-F]{32}$"; static readonly REG_MAC_ADDRESS: string = "^((?:[a-fA-F0-9]{1,2}[:-]){5}[a-fA-F0-9]{1,2})|0x(\\d{12}).+ETHER$"; static readonly REG_HEX: string = "^[a-fA-F0-9]+$"; static readonly REG_TIME: string = "^\\d{1,2}:\\d{1,2}(:\\d{1,2})?$"; static readonly REG_PLATE_NUMBER: string = "^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[ABCDEFGHJK])|([ABCDEFGHJK]([A-HJ-NP-Z0-9])[0-9]{4})))|" + "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领]\\d{3}\\d{1,3}[领])|" + "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$"; static readonly REG_CREDIT_CODE: string = "^[0-9A-HJ-NPQRTUWXY]{2}\\d{6}[0-9A-HJ-NPQRTUWXY]{10}$"; static readonly REG_CAR_VIN: string = "^[A-HJ-NPR-Z0-9]{8}[0-9X][A-HJ-NPR-Z0-9]{2}\\d{6}$"; static readonly REG_CAR_DRIVING_LICENCE: string = "^[0-9]{12}$"; static readonly REG_CHINESE_NAME: string = "^[\u2E80-\u9FFF·]{2,60}$"; static readonly REG_EMOJI: string = "/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g"; static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } } static isPhone(phone: string): boolean { return FormatUtil.isPhone(phone); } static isDigits(str: string): boolean { if (typeof str !== 'string' || str.length === 0) { return false; } return RegexUtil.isMatch(str, RegexUtil.REG_NUMBERS); } static isEmail(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMAIL); } static isEmoji(content: string): boolean { return RegexUtil.isMatch(content, RegexUtil.REG_EMOJI); } static isValidCard(id: string): boolean { if (id.length === 18) { const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; id = id.toUpperCase(); const lastChar = id.charAt(17).toUpperCase(); let sum = 0; id.substring(0, 17).split('').forEach((value, index) => { sum += factor[index] * parseInt(value, 10); }); const mod = sum % lastLetter.length; return lastLetter[mod] === lastChar; } else if (id.length === 15) { const regex15 = "^[1-9]\\d{5}\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}$"; return RegexUtil.isMatch(id, regex15); } return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/RegexUtil.ets#L25-L278
fb704dfce8aee2fbb3409c23f4ef7d530891bd7a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/Index.ets
arkts
UserState
@file state 模块统一导出 @author Joker.X
export { UserState, getUserState } from "./src/main/ets/UserState";
AST#export_declaration#Left export { UserState , getUserState } from "./src/main/ets/UserState" ; AST#export_declaration#Right
export { UserState, getUserState } from "./src/main/ets/UserState";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/Index.ets#L6-L8
e67ac408b61ef5797dd5edf9e99987a0b8f9c00f
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/EditSchedule.ets
arkts
RepeatIntervalMenu
更改重复周期相关组件绑定的菜单栏。
@Builder private RepeatIntervalMenu(): void { List() { ListItem() { Row() { Image($r('app.media.repeat_daily')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每天') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [true, true, true, true, true, true, true]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekdays')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('工作日') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [true, true, true, true, true, false, false]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekends')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('周末') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [false, false, false, false, false, true, true]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekly')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每周' + CommonConstants.WEEK_DAYS[(this.currentTime.getDay() + 6) % 7]) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [ 0 === (this.currentTime.getDay() + 6) % 7, 1 === (this.currentTime.getDay() + 6) % 7, 2 === (this.currentTime.getDay() + 6) % 7, 3 === (this.currentTime.getDay() + 6) % 7, 4 === (this.currentTime.getDay() + 6) % 7, 5 === (this.currentTime.getDay() + 6) % 7, 6 === (this.currentTime.getDay() + 6) % 7, ]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.pick_date')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('自定义') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatIntervalDialogController.open(); this.getRepeatButtonText(); }); } .size({ height: '4%' }); } .margin('2%'); } .padding('2%') .size({ width: '84%' }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RepeatIntervalMenu 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 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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.repeat_daily' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( 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#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 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#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 . repeatInterval AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#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 true AST#boolean_literal#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 true AST#boolean_literal#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 true AST#boolean_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#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 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#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 . margin ( AST#expression#Left '2%' 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 ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.repeat_weekdays' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( 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#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 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#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 . repeatInterval AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#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 true AST#boolean_literal#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 true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#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 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#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 . margin ( AST#expression#Left '2%' 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 ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.repeat_weekends' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( 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#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 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#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 . repeatInterval AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#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 true AST#boolean_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#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 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#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 . margin ( AST#expression#Left '2%' 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 ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.repeat_weekly' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( 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#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 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#subscript_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 CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . WEEK_DAYS 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#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 . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#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 . repeatInterval AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left 0 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 3 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 4 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 5 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 6 AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTime AST#member_expression#Right AST#expression#Right . getDay 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 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right % AST#expression#Left 7 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#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 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#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 . margin ( AST#expression#Left '2%' 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 ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.pick_date' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fillColor ( 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#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 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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#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 . repeatIntervalDialogController AST#member_expression#Right AST#expression#Right . open 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 . getRepeatButtonText AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#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 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#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 . margin ( AST#expression#Left '2%' 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 . padding ( AST#expression#Left '2%' 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 '84%' 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#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private RepeatIntervalMenu(): void { List() { ListItem() { Row() { Image($r('app.media.repeat_daily')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每天') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [true, true, true, true, true, true, true]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekdays')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('工作日') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [true, true, true, true, true, false, false]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekends')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('周末') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [false, false, false, false, false, true, true]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.repeat_weekly')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('每周' + CommonConstants.WEEK_DAYS[(this.currentTime.getDay() + 6) % 7]) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatInterval = [ 0 === (this.currentTime.getDay() + 6) % 7, 1 === (this.currentTime.getDay() + 6) % 7, 2 === (this.currentTime.getDay() + 6) % 7, 3 === (this.currentTime.getDay() + 6) % 7, 4 === (this.currentTime.getDay() + 6) % 7, 5 === (this.currentTime.getDay() + 6) % 7, 6 === (this.currentTime.getDay() + 6) % 7, ]; }); } .size({ height: '4%' }); } .margin('2%'); ListItem() { Row() { Image($r('app.media.pick_date')) .fillColor($r('app.color.font_black')) .size({ width: 24, height: 24 }); Text('自定义') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor($r('app.color.font_black')) .onClick(() => { this.repeatIntervalDialogController.open(); this.getRepeatButtonText(); }); } .size({ height: '4%' }); } .margin('2%'); } .padding('2%') .size({ width: '84%' }); }
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/EditSchedule.ets#L765-L864
08be5aa63a7f1b9991afee85093ee84af3c3b0ae
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
stop
结束播放 @returns {void}
stop(): void { this.avplayerModel.stop(); }
AST#method_declaration#Left stop 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 . avplayerModel AST#member_expression#Right AST#expression#Right . stop AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
stop(): void { this.avplayerModel.stop(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L237-L239
7492938c64a6524a1ac7782dbebf71c916757ca5
gitee
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/index.ets
arkts
Visitor
Visitor 接口 用于实现 Visitor 模式,遍历消息字段
export { Visitor } from './Visitor'
AST#export_declaration#Left export { Visitor } from './Visitor' AST#export_declaration#Right
export { Visitor } from './Visitor'
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/index.ets#L37-L37
93b31a84017963a93e18a4d019dbcee470db62e6
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/http/FileUtil.ets
arkts
getFileExtention
根据文件名获取文件后缀 @param fileName 例如: test.txt test.doc @returns
static getFileExtention(fileName: string) { if (StringUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
AST#method_declaration#Left static getFileExtention AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left StringUtils AST#expression#Right . isNotEmpty AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left fileName AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left fileName AST#expression#Right AST#binary_expression#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "." AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileName AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileName AST#expression#Right . lastIndexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "." AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static getFileExtention(fileName: string) { if (StringUtils.isNotEmpty(fileName) && fileName.includes(".")) { return fileName.substring(fileName.lastIndexOf(".") + 1); } return ''; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/http/FileUtil.ets#L177-L182
6b46a623cf1b2f5e94d8f5c66a992c12eb3da4c8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets
arkts
toValuesBucket
Get inserted account data. @return Return account data.
toValuesBucket(): DataRdb.ValuesBucket { return { distributedAccountName: this.distributedAccountName, distributedAccountID: this.distributedAccountID, localId: this.localId }; }
AST#method_declaration#Left toValuesBucket AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left DataRdb . ValuesBucket 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 distributedAccountName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . distributedAccountName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left distributedAccountID AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . distributedAccountID AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left localId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . localId 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
toValuesBucket(): DataRdb.ValuesBucket { return { distributedAccountName: this.distributedAccountName, distributedAccountID: this.distributedAccountID, localId: this.localId }; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/database/Account.ets#L42-L48
f2c8e5320922244321d67c38959e910ff6a48421
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/state/src/main/ets/BreakpointState.ets
arkts
resolveBreakpoint
根据窗口宽度计算断点 @param {number} windowWidthVp - 窗口宽度(vp) @returns {BreakpointType} 断点名称
resolveBreakpoint(windowWidthVp: number): BreakpointType { for (const rule of BREAKPOINT_RULES) { if (windowWidthVp < rule.maxWidthVp) { return rule.name; } } return BreakpointType.LG; }
AST#method_declaration#Left resolveBreakpoint AST#parameter_list#Left ( AST#parameter#Left windowWidthVp : 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 BreakpointType AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( const rule of AST#expression#Left BREAKPOINT_RULES 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 windowWidthVp AST#expression#Right < AST#expression#Left rule AST#expression#Right AST#binary_expression#Right AST#expression#Right . maxWidthVp AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left rule AST#expression#Right . name AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left BreakpointType AST#expression#Right . LG AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
resolveBreakpoint(windowWidthVp: number): BreakpointType { for (const rule of BREAKPOINT_RULES) { if (windowWidthVp < rule.maxWidthVp) { return rule.name; } } return BreakpointType.LG; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/BreakpointState.ets#L76-L83
32235dd6d3dd02ba7e8f07e685eba099aa94f0d1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets
arkts
跑马灯滚动动画属性 @param {number} [iterations] - 动画播放次数。默认播放一次,设置为-1时表示无限次播放。设置为0时表示无动画效果 @param {number} [duration] - 动画持续时间,单位为毫秒 @param {number} [tempo] - 动画播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果 @param {PlayMode} [playMode] - 控制跑马灯向左还是向右滚动。方向向右的时候,文本需要取反,如牌匾 -> 匾牌,这样可以给用户良好的阅读体验 @param {number} [delayTime] - 动画延迟播放时间,单位为ms(毫秒),默认延时1s播放
export class MarqueeAnimationModifier { iterations: number; duration: number; tempo: number; playMode: PlayMode; delayTime: number; constructor(iterations: number = -1, duration: number = Constants.ANIMATION_DURATION, tempo: number = 1, playMode: PlayMode = PlayMode.Normal, delayTime: number = Constants.DELAY_TIME) { this.iterations = iterations; this.duration = duration; this.tempo = tempo; this.playMode = playMode; this.delayTime = delayTime; } }
AST#export_declaration#Left export AST#class_declaration#Left class MarqueeAnimationModifier AST#class_body#Left { AST#property_declaration#Left iterations : 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 duration : 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 tempo : 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 playMode : AST#type_annotation#Left AST#primary_type#Left PlayMode AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left delayTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left iterations : 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#parameter#Right , AST#parameter#Left duration : 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 Constants AST#expression#Right . ANIMATION_DURATION AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left tempo : 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#parameter#Right , AST#parameter#Left playMode : AST#type_annotation#Left AST#primary_type#Left PlayMode AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#parameter#Right , AST#parameter#Left delayTime : 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 Constants AST#expression#Right . DELAY_TIME AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . iterations AST#member_expression#Right = AST#expression#Left iterations 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 . duration AST#member_expression#Right = AST#expression#Left duration 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 . tempo AST#member_expression#Right = AST#expression#Left tempo 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 . playMode AST#member_expression#Right = AST#expression#Left playMode 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 . delayTime AST#member_expression#Right = AST#expression#Left delayTime 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 MarqueeAnimationModifier { iterations: number; duration: number; tempo: number; playMode: PlayMode; delayTime: number; constructor(iterations: number = -1, duration: number = Constants.ANIMATION_DURATION, tempo: number = 1, playMode: PlayMode = PlayMode.Normal, delayTime: number = Constants.DELAY_TIME) { this.iterations = iterations; this.duration = duration; this.tempo = tempo; this.playMode = playMode; this.delayTime = delayTime; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets#L53-L68
bb99e3c3bd712b359539ed456c5635f47b289159
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets
arkts
VideoThumbListView
时间轴小图展示
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; build() { Column() { List() { // 需要展示全部的视频每秒的小图,不需要使用LazyForEach ForEach(this.mVideoThumbOption.videoThumbs, (item:ThumbContent) => { ListItem() { Image(item.pixelMap ? item.pixelMap : item.framePlaceholder) .objectFit(ImageFit.CENTER) .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_create_gif_full_width')) } .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_create_gif_full_width')) .backgroundColor(Color.Black) }, (item: ThumbContent, index: number) => `${index}`) } .listDirection(Axis.Horizontal) .height($r('app.string.video_create_gif_full_width')) .width($r('app.string.video_create_gif_full_width')) .scrollBar(BarState.Off) }.width($r('app.string.video_create_gif_full_width')) .height($r('app.string.video_create_gif_full_width')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoThumbListView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { // 需要展示全部的视频每秒的小图,不需要使用LazyForEach AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbs 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 ThumbContent 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 Image ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right : AST#expression#Left item AST#expression#Right AST#conditional_expression#Right AST#expression#Right . framePlaceholder AST#member_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 . CENTER AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_create_gif_full_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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mVideoThumbOption AST#member_expression#Right AST#expression#Right . videoThumbWidth AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_create_gif_full_width' 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 . Black 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_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 ThumbContent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left index AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_create_gif_full_width' 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.video_create_gif_full_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.string.video_create_gif_full_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.video_create_gif_full_width' 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
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; build() { Column() { List() { ForEach(this.mVideoThumbOption.videoThumbs, (item:ThumbContent) => { ListItem() { Image(item.pixelMap ? item.pixelMap : item.framePlaceholder) .objectFit(ImageFit.CENTER) .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_create_gif_full_width')) } .width(this.mVideoThumbOption.videoThumbWidth) .height($r('app.string.video_create_gif_full_width')) .backgroundColor(Color.Black) }, (item: ThumbContent, index: number) => `${index}`) } .listDirection(Axis.Horizontal) .height($r('app.string.video_create_gif_full_width')) .width($r('app.string.video_create_gif_full_width')) .scrollBar(BarState.Off) }.width($r('app.string.video_create_gif_full_width')) .height($r('app.string.video_create_gif_full_width')) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/VideoThumbListView.ets#L29-L57
49c171ed5d921ea4a72636008e1066aca78310fa
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets
arkts
jumpToAdvertisingPage
Jump to advertising page.
jumpToAdvertisingPage(): void { this.timerId = setTimeout(() => { this.isJumpToAdvertising = true; router.pushUrl({ url: CommonConstants.ADVERTISING_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(error)); }); }, CommonConstants.LAUNCHER_DELAY_TIME); }
AST#method_declaration#Left jumpToAdvertisingPage 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 . timerId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isJumpToAdvertising 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left router AST#expression#Right . pushUrl 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 url AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ADVERTISING_PAGE_URL 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 . 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 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 Logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LAUNCHER_PAGE_TAG 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#binary_expression#Left AST#expression#Left 'LauncherPage pushUrl error ' 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 error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LAUNCHER_DELAY_TIME 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#builder_function_body#Right AST#method_declaration#Right
jumpToAdvertisingPage(): void { this.timerId = setTimeout(() => { this.isJumpToAdvertising = true; router.pushUrl({ url: CommonConstants.ADVERTISING_PAGE_URL }).catch((error: Error) => { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'LauncherPage pushUrl error ' + JSON.stringify(error)); }); }, CommonConstants.LAUNCHER_DELAY_TIME); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/FirstStartDemo/entry/src/main/ets/pages/LauncherPage.ets#L74-L83
dfdd8779d9cb8f3fa43127391e4bb24d879ffcce
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets
arkts
CardSwiperComponent
功能描述: 1. 卡片组件滚动切换,展示缩略图缩略图,两侧展示偏移量为 swiperMargin 的上一页和下一页的缩略图(缩放为原始缩略图的80%) 2. 卡片滑动时组件跟手对应的图片缩放,滑入的图片放大至缩略图的原始大小,滑出的图片缩小至原始大小的80% 3. 卡片滑动手指释放时根据 index 变化,展示对应 index 的子组件(图片) 4. 边缘渐变开启时,滑动边缘为渐变白色 5. 背景渐变开启时,背景色为图片主题渐变色 实现原理: 1. 卡片基于Swiper组件实现容器视图居中完全展示,两边等长露出,并且跟手滑动缩放效果 2. 通过onGestureSwiper、onAnimationStart、onChange回调实现滑动跟手缩放实现 3. 共享元素转场结合全屏模态实现图片的查看 4. 在Swiper组件上通过overlay加一层渐变遮罩,回调onChange在Swiper组件index变化时更新遮罩色,实现边缘渐变效果 5. 在Swiper组件的同Stack下做一层底层的叠底,回调onAnimationStart时更新背景色,实现主题渐变效果 @param {CardInfo[]} initCardsList - 传入初始化数据列表 数据格式为: { src: ${图片路径}, width: ${展示宽度}, height: ${展示高度} } 示例: { src: $r('app.media.panda'), width: this.CARD_UNIT_LENGTH, height: this.CARD_UNIT_LENGTH } @param {boolean} [isEdgeFading] - 边缘渐变开关 @param {boolean} [isBackgroundColorChange] - 背景色跟随主题色渐变开关
@Component export struct CardSwiperComponent { // 初始化数据列表 (可以传入本地图片资源或者网络图片地址) initCardsList: CardInfo[] = []; // 是否开启边缘渐变 isEdgeFading: boolean = true; // 是否开启背景跟随主题色转换 isBackgroundColorChange: boolean = true; // 是否开启预览大图 isShowPreviewImage: boolean = true; // 边缘渐变起始和终止颜色 @State private linearGradientBeginColor: string = Constants.BEGIN_COLOR; @State private linearGradientEndColor: string = Constants.END_COLOR; // 初始背景色 @State private bgColor: string = Constants.BACKGROUND_END_COLOR; // 背景叠底位置 private backgroundMaskZIndex: number = -1; // 卡片数据源 private data: CardsSource = new CardsSource([]); // 卡片数据列表 @State private cardsList: CardInfo[] = []; // 卡片偏移度列表 @State private cardsOffset: number[] = []; // 屏幕宽度 private displayWidth: number = 0; // Swiper 两侧的偏移量 private swiperMargin: number = Constants.SWIPER_MARGIN; // Swiper 当前索引值 @State private currentSwiperIndex: number = 0; // 数据源对应的缩放数组 @State scaleList: number[] = []; // 最大缩放 private MAX_SCALE: number = 1; // 最小缩放 private MIN_SCALE: number = 0.8; // 手势触发时的offset @State startSwiperOffset: number = 0; // 图片缩放的比例 @State proportion: number = 0; aboutToAppear(): void { // 获取屏幕大小,初始化displayWidth,用于后续计算卡片的偏移量 const displayData: display.Display = display.getDefaultDisplaySync(); this.displayWidth = px2vp(displayData.width); if ((display.isFoldable() && display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED) || this.displayWidth >= Constants.DEVICESIZE) { this.displayWidth = px2vp(displayData.width) / 2; } logger.info(TAG, `Display width ${this.displayWidth}`); // 传入数据添加至卡片数据,并初始化偏移量列表,初始化缩放系数数组 this.initCardsListAndOffset(this.initCardsList); // 初始化懒加载列表 this.data = new CardsSource(this.cardsList); // 计算当前卡片及关联卡片的偏移量 this.calculateOffset(0); } /** * 初始化 cardsList, cardsOffset 及 scaleList。读取传入的case,并添加卡片数据,初始化偏移量列表和缩放系数数组。 * @param {CardInfo[]} initCardsList - 初始化数据列表 */ private initCardsListAndOffset(initCardsList: CardInfo[]) { // 传入case为空时,使用预置用例 if (initCardsList === undefined || initCardsList.length === 0) { initCardsList = Constants.CARD_TEST_CASE } // 将初始化list传入卡片数据列表、卡片偏移度列表 initCardsList.forEach((item, index) => { this.cardsList.push(item); this.cardsOffset.push(0); // 初始化数据源对应的缩放系数存入数组 this.scaleList.push(index === 0 ? this.MAX_SCALE : this.MIN_SCALE); }) // 初始化背景色 this.initBackground(); } /** * 初始化背景。 */ private async initBackground() { // TODO 知识点:初始化页面获取第一张图片的颜色 const context = getContext(this); const resourceMgr: resourceManager.ResourceManager = context.resourceManager; const fileData: Uint8Array = await resourceMgr.getMediaContent(this.cardsList[0].src as Resource); const buffer = fileData.buffer as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(buffer); const pixelMap: image.PixelMap = await imageSource.createPixelMap(); // TODO 知识点:智能取色器接口使用,初始化背景色 effectKit.createColorPicker(pixelMap, (err, colorPicker) => { let color = colorPicker.getMainColorSync(); // 将取色器选取的color示例转换为十六进制颜色代码 this.bgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16) }) } build() { Column() { Stack() { // 渐变背景叠底 Column() { } .width($r('app.string.card_swiper_full_size')) .height($r('app.integer.card_swiper_swiper_height')) .zIndex(this.backgroundMaskZIndex) .visibility(this.isBackgroundColorChange ? Visibility.Visible : Visibility.Hidden) .linearGradient({ // 渐变方向,从上至下 angle: Constants.LINEAR_GRADIENT_ANGLE, // 数组末尾元素占比小于1时,满足重复着色的效果 colors: [ [this.bgColor, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[0]], [Constants.BACKGROUND_END_COLOR, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[1]], [Constants.BACKGROUND_END_COLOR, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[2]], [this.bgColor, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[3]] ] }) // 卡片 Swiper() { LazyForEach(this.data, (item: CardInfo, index: number) => { /** * 卡片子组件 * cardInfo: 卡片数据源/集 * cardOffset: 卡片偏移量 * cardIndex: 当前卡片序号 * showingCard: Swiper当前显示的卡片序号 * scaleList: 数据源对应的缩放数组 * isShowPreviewImage: 是否开启预览 */ CardComponent({ cardInfo: item, cardOffset: this.cardsOffset[index], cardIndex: index, showingCard: this.currentSwiperIndex, scaleList: this.scaleList, isShowPreviewImage: this.isShowPreviewImage, }) }) } .index($$this.currentSwiperIndex) .loop(false) .prevMargin(this.swiperMargin) .nextMargin(this.swiperMargin) .duration(Constants.DURATION) .curve(Constants.DEFAULT_ANIMATION_CURVE) .cachedCount(Constants.SWIPER_CACHE_COUNT) .overlay(this.fadingOverlay(), { align: Alignment.Center }) .onChange((index) => { this.calculateOffset(index); // index发生变化时,修改数组中对应的缩放系数 this.currentSwiperIndex = index; this.scaleList[this.currentSwiperIndex] = this.MAX_SCALE; // 若index为第一张图时,最后一张图片缩放系数为MIN_SCALE,否则index-1缩放系数为MIN_SCALE if (this.currentSwiperIndex === 0) { this.scaleList[this.scaleList.length - 1] = this.MIN_SCALE; // 第一张时的渐变遮罩色 this.linearGradientBeginColor = Constants.BEGIN_COLOR; this.linearGradientEndColor = Constants.END_COLOR; } else { this.scaleList[this.currentSwiperIndex - 1] = this.MIN_SCALE; } // 若index为最后一张图时,第一张图缩放系数为MIN_SCALE,否则index+1缩放系数为MIN_SCALE if (this.currentSwiperIndex === this.scaleList.length - 1) { this.scaleList[0] = this.MIN_SCALE; // 最后一张时的渐变遮罩色 this.linearGradientBeginColor = Constants.END_COLOR; this.linearGradientEndColor = Constants.BEGIN_COLOR; } else { this.scaleList[this.currentSwiperIndex + 1] = this.MIN_SCALE; } // 若index为中间的图片时,展示边缘渐变 if (this.currentSwiperIndex != 0 && this.currentSwiperIndex != this.scaleList.length - 1) { this.linearGradientBeginColor = Constants.END_COLOR; this.linearGradientEndColor = Constants.END_COLOR; } }) .onGestureSwipe((index, event) => { const currentOffset = event.currentOffset; // 获取当前卡片(居中)的原始偏移量 const maxOffset = this.getMaxOffset(index) * this.proportion / 2; // 实时维护卡片的偏移量列表,做到跟手效果 if (currentOffset < 0) { // 向左偏移 /* * 此处计算原理为:按照比例设置卡片的偏移量。 * 当前卡片居中,向左滑动后将在左边,此时卡片偏移量即为 maxOffset * 2(因为向右对齐)。 * 所以手指能够滑动的最大距离(this.displayWidth)所带来的偏移量即为 maxOffset。 * 易得公式:卡片实时偏移量 = (手指滑动长度 / 屏幕宽度) * 卡片最大可偏移量 + 当前偏移量。 * 之后的计算原理相同,将不再赘述。 */ this.cardsOffset[index] = (-currentOffset / this.displayWidth) * maxOffset + maxOffset; if (this.isIndexValid(index + 1)) { // 下一个卡片的偏移量 const maxOffset = this.getMaxOffset(index + 1) / 2 * this.proportion; this.cardsOffset[index + 1] = (-currentOffset / this.displayWidth) * maxOffset; } if (this.isIndexValid(index - 1)) { // 上一个卡片的偏移量 const maxOffset = this.getMaxOffset(index - 1) / 2 * this.proportion; this.cardsOffset[index - 1] = (currentOffset / this.displayWidth) * maxOffset + 2 * maxOffset; } } else if (currentOffset > 0) { // 向右滑动 this.cardsOffset[index] = maxOffset - (currentOffset / this.displayWidth) * maxOffset; if (this.isIndexValid(index + 1)) { const maxOffset = this.getMaxOffset(index + 1) / 2 * this.proportion; this.cardsOffset[index + 1] = (currentOffset / this.displayWidth) * maxOffset; } if (this.isIndexValid(index - 1)) { const maxOffset = this.getMaxOffset(index - 1) / 2 * this.proportion; this.cardsOffset[index - 1] = 2 * maxOffset - (currentOffset / this.displayWidth) * maxOffset; } } // 页面跟手滑动过程中触发回调,动态计算卡片滑动距离实时计算缩放系数。 this.calculateScaling(index, currentOffset); }) .onAnimationStart((index, targetIndex) => { this.calculateOffset(targetIndex); // 计算手指离开屏幕时卡片的缩放系数 if (index === targetIndex) { let nextIndex: number = (index === this.scaleList.length - 1 ? 0 : index + 1); let preIndex: number = (index === 0 ? this.scaleList.length - 1 : index - 1); this.scaleList[index] = this.MAX_SCALE; this.scaleList[nextIndex] = this.MIN_SCALE; this.scaleList[preIndex] = this.MIN_SCALE; } else { let nextIndex: number = (targetIndex === this.scaleList.length - 1 ? 0 : targetIndex + 1); let preIndex: number = (targetIndex === 0 ? this.scaleList.length - 1 : targetIndex - 1); this.scaleList[targetIndex] = this.MAX_SCALE; this.scaleList[nextIndex] = this.MIN_SCALE; this.scaleList[preIndex] = this.MIN_SCALE; } // 滚动中获取当前颜色均值 this.getAverageColor(this.cardsList[targetIndex].src) }) .onAnimationEnd(() => { this.startSwiperOffset = 0; }) .height($r('app.integer.card_swiper_swiper_height')) .width($r('app.string.card_swiper_full_size')) } } .width(Constants.CARD_SWIPER_FULL_SIZE) .height(Constants.CARD_SWIPER_FULL_SIZE) .justifyContent(FlexAlign.Center) } /** * 计算卡片偏移量,并维护偏移量列表。 * @param { number } targetIndex - swiper target card's index. */ private calculateOffset(target: number) { let left = target - 1; let right = target + 1; // 计算上一张卡片的偏移值 if (this.isIndexValid(left)) { this.cardsOffset[left] = this.getMaxOffset(left) - this.cardsList[left].width * (1 - this.MIN_SCALE) / 2; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CardSwiperComponent AST#component_body#Left { // 初始化数据列表 (可以传入本地图片资源或者网络图片地址) AST#property_declaration#Left initCardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] 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 isEdgeFading : 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 isBackgroundColorChange : 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 isShowPreviewImage : 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 AST#decorator#Left @ State AST#decorator#Right private linearGradientBeginColor : 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 Constants AST#expression#Right . BEGIN_COLOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private linearGradientEndColor : 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 Constants AST#expression#Right . END_COLOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 初始背景色 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private bgColor : 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 Constants AST#expression#Right . BACKGROUND_END_COLOR AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // 背景叠底位置 AST#property_declaration#Left private backgroundMaskZIndex : 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#property_declaration#Left private data : AST#type_annotation#Left AST#primary_type#Left CardsSource 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 CardsSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right // 卡片数据列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private cardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] 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 AST#decorator#Left @ State AST#decorator#Right private cardsOffset : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 屏幕宽度 AST#property_declaration#Left private displayWidth : 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 // Swiper 两侧的偏移量 AST#property_declaration#Left private swiperMargin : 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 Constants AST#expression#Right . SWIPER_MARGIN AST#member_expression#Right AST#expression#Right ; AST#property_declaration#Right // Swiper 当前索引值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private currentSwiperIndex : 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 @ State AST#decorator#Right scaleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 最大缩放 AST#property_declaration#Left private MAX_SCALE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; AST#property_declaration#Right // 最小缩放 AST#property_declaration#Left private MIN_SCALE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0.8 AST#expression#Right ; AST#property_declaration#Right // 手势触发时的offset AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right startSwiperOffset : 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 @ State AST#decorator#Right proportion : 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#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 { // 获取屏幕大小,初始化displayWidth,用于后续计算卡片的偏移量 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left displayData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display 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 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayWidth AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left displayData 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#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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left display AST#expression#Right . isFoldable 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 display AST#expression#Right AST#binary_expression#Right AST#expression#Right . getFoldStatus 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 display AST#expression#Right AST#binary_expression#Right AST#expression#Right . FoldStatus AST#member_expression#Right AST#expression#Right . FOLD_STATUS_EXPANDED AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right >= AST#expression#Left Constants AST#expression#Right AST#binary_expression#Right AST#expression#Right . DEVICESIZE 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 . displayWidth AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left displayData AST#expression#Right . width AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Display width AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 传入数据添加至卡片数据,并初始化偏移量列表,初始化缩放系数数组 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initCardsListAndOffset 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 . initCardsList 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 . data AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CardsSource AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsList AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 计算当前卡片及关联卡片的偏移量 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateOffset 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#statement#Right } AST#block_statement#Right AST#method_declaration#Right /** * 初始化 cardsList, cardsOffset 及 scaleList。读取传入的case,并添加卡片数据,初始化偏移量列表和缩放系数数组。 * @param {CardInfo[]} initCardsList - 初始化数据列表 */ AST#method_declaration#Left private initCardsListAndOffset AST#parameter_list#Left ( AST#parameter#Left initCardsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CardInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { // 传入case为空时,使用预置用例 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left initCardsList AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left initCardsList AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left initCardsList = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . CARD_TEST_CASE AST#member_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 // 将初始化list传入卡片数据列表、卡片偏移度列表 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left initCardsList 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#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsList AST#member_expression#Right 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#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 . cardsOffset AST#member_expression#Right AST#expression#Right . push 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#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 . scaleList AST#member_expression#Right AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . MAX_SCALE AST#member_expression#Right AST#expression#Right : AST#expression#Left this AST#expression#Right AST#conditional_expression#Right AST#expression#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // 初始化背景色 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . initBackground AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right /** * 初始化背景。 */ AST#method_declaration#Left private async initBackground AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:初始化页面获取第一张图片的颜色 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left AST#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left resourceMgr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left resourceManager . ResourceManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left context AST#expression#Right . resourceManager 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 fileData : 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#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left resourceMgr AST#expression#Right AST#await_expression#Right AST#expression#Right . getMediaContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . src AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Resource 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left buffer = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fileData AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left imageSource : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . ImageSource 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 image AST#expression#Right . createImageSource AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left buffer AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left pixelMap : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left imageSource AST#expression#Right AST#await_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#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 effectKit AST#expression#Right . createColorPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left pixelMap AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right , AST#parameter#Left colorPicker AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left color = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left colorPicker AST#expression#Right . getMainColorSync 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 // 将取色器选取的color示例转换为十六进制颜色代码 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 . bgColor 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 AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "#" AST#expression#Right + AST#expression#Left color AST#expression#Right AST#binary_expression#Right AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left color AST#expression#Right AST#binary_expression#Right AST#expression#Right . red AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left color AST#expression#Right AST#binary_expression#Right AST#expression#Right . green AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#expression#Left color AST#expression#Right AST#binary_expression#Right AST#expression#Right . blue AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 16 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#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) 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#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.card_swiper_full_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.card_swiper_swiper_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . zIndex ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . backgroundMaskZIndex AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . visibility ( 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 . isBackgroundColorChange AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left Visibility AST#expression#Right . Visible AST#member_expression#Right AST#expression#Right : AST#expression#Left Visibility AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Hidden AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . linearGradient ( 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 Constants AST#expression#Right . LINEAR_GRADIENT_ANGLE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 数组末尾元素占比小于1时,满足重复着色的效果 AST#property_assignment#Left AST#property_name#Left colors AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BACKGROUND_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_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 Constants AST#expression#Right . BACKGROUND_END_COLOR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BACKGROUND_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_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 Constants AST#expression#Right . BACKGROUND_END_COLOR AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BACKGROUND_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_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 this AST#expression#Right . bgColor AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BACKGROUND_LINEAR_GRADIENT_COLOR_POS AST#member_expression#Right AST#expression#Right [ AST#expression#Left 3 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right ] AST#array_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#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 Swiper ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . data 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 CardInfo 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 { /** * 卡片子组件 * cardInfo: 卡片数据源/集 * cardOffset: 卡片偏移量 * cardIndex: 当前卡片序号 * showingCard: Swiper当前显示的卡片序号 * scaleList: 数据源对应的缩放数组 * isShowPreviewImage: 是否开启预览 */ AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left CardComponent ( AST#component_parameters#Left { AST#component_parameter#Left cardInfo : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cardOffset : AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cardIndex : AST#expression#Left index AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left showingCard : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scaleList : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isShowPreviewImage : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShowPreviewImage AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . index ( AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . loop ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . prevMargin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . nextMargin ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . swiperMargin AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . duration ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DURATION AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . curve ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DEFAULT_ANIMATION_CURVE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . cachedCount ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SWIPER_CACHE_COUNT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . overlay ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fadingOverlay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left align AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateOffset 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 // index发生变化时,修改数组中对应的缩放系数 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 . currentSwiperIndex AST#member_expression#Right = AST#expression#Left index AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MAX_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 若index为第一张图时,最后一张图片缩放系数为MIN_SCALE,否则index-1缩放系数为MIN_SCALE 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 . currentSwiperIndex 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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList 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#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_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 . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BEGIN_COLOR 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 . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . END_COLOR 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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex 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#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 若index为最后一张图时,第一张图缩放系数为MIN_SCALE,否则index+1缩放系数为MIN_SCALE AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scaleList 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_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 . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . END_COLOR 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 . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BEGIN_COLOR 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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex 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#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 若index为中间的图片时,展示边缘渐变 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right != AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . currentSwiperIndex AST#member_expression#Right AST#expression#Right != AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scaleList 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#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 . linearGradientBeginColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . END_COLOR 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 . linearGradientEndColor AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . END_COLOR 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#Left . onGestureSwipe ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index AST#parameter#Right , AST#parameter#Left event AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left currentOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . currentOffset 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 maxOffset = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset 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#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . proportion AST#member_expression#Right AST#expression#Right / AST#expression#Left 2 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 currentOffset AST#expression#Right < AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 向左偏移 /* * 此处计算原理为:按照比例设置卡片的偏移量。 * 当前卡片居中,向左滑动后将在左边,此时卡片偏移量即为 maxOffset * 2(因为向右对齐)。 * 所以手指能够滑动的最大距离(this.displayWidth)所带来的偏移量即为 maxOffset。 * 易得公式:卡片实时偏移量 = (手指滑动长度 / 屏幕宽度) * 卡片最大可偏移量 + 当前偏移量。 * 之后的计算原理相同,将不再赘述。 */ AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left currentOffset AST#expression#Right AST#unary_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIndexValid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // 下一个卡片的偏移量 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . proportion 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left currentOffset AST#expression#Right AST#unary_expression#Right AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIndexValid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { // 上一个卡片的偏移量 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . proportion 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left currentOffset AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_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 currentOffset 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#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = maxOffset AST#ERROR#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 currentOffset AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIndexValid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . proportion 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left currentOffset AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIndexValid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left maxOffset = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . proportion 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 2 AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_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 currentOffset AST#expression#Right / AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . displayWidth AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left maxOffset AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calculateScaling AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index AST#expression#Right , AST#expression#Left currentOffset 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 . onAnimationStart ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index AST#parameter#Right , AST#parameter#Left targetIndex 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 this AST#expression#Right . calculateOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left targetIndex 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 index AST#expression#Right === AST#expression#Left targetIndex 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 nextIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scaleList 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#expression#Left 0 AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_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 preIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#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 . scaleList 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#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MAX_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left nextIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left preIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_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 nextIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_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 AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . scaleList 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#expression#Left 0 AST#expression#Right : AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_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 preIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList 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#expression#Left AST#binary_expression#Left AST#expression#Left targetIndex AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#parenthesized_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#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left targetIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MAX_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left nextIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scaleList AST#member_expression#Right AST#expression#Right [ AST#expression#Left preIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = this AST#ERROR#Right . MIN_SCALE AST#member_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 this AST#expression#Right . getAverageColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsList AST#member_expression#Right AST#expression#Right [ AST#expression#Left targetIndex AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . src AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAnimationEnd ( 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 . startSwiperOffset AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.card_swiper_swiper_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.string.card_swiper_full_size' 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#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#member_expression#Left AST#expression#Left Constants AST#expression#Right . CARD_SWIPER_FULL_SIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . CARD_SWIPER_FULL_SIZE 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#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 /** * 计算卡片偏移量,并维护偏移量列表。 * @param { number } targetIndex - swiper target card's index. */ AST#property_declaration#Left private calculateOffset AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left target : 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#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left left = AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left right = AST#expression#Left AST#binary_expression#Left AST#expression#Left target AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 计算上一张卡片的偏移值 if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isIndexValid AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left left AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cardsOffset AST#member_expression#Right AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#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 AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getMaxOffset AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left left AST#expression#Right ) 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 . cardsList AST#member_expression#Right AST#expression#Right [ AST#expression#Left left AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . 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#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . MIN_SCALE AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right / AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct CardSwiperComponent { initCardsList: CardInfo[] = []; isEdgeFading: boolean = true; isBackgroundColorChange: boolean = true; isShowPreviewImage: boolean = true; @State private linearGradientBeginColor: string = Constants.BEGIN_COLOR; @State private linearGradientEndColor: string = Constants.END_COLOR; @State private bgColor: string = Constants.BACKGROUND_END_COLOR; private backgroundMaskZIndex: number = -1; private data: CardsSource = new CardsSource([]); @State private cardsList: CardInfo[] = []; @State private cardsOffset: number[] = []; private displayWidth: number = 0; private swiperMargin: number = Constants.SWIPER_MARGIN; @State private currentSwiperIndex: number = 0; @State scaleList: number[] = []; private MAX_SCALE: number = 1; private MIN_SCALE: number = 0.8; @State startSwiperOffset: number = 0; @State proportion: number = 0; aboutToAppear(): void { const displayData: display.Display = display.getDefaultDisplaySync(); this.displayWidth = px2vp(displayData.width); if ((display.isFoldable() && display.getFoldStatus() === display.FoldStatus.FOLD_STATUS_EXPANDED) || this.displayWidth >= Constants.DEVICESIZE) { this.displayWidth = px2vp(displayData.width) / 2; } logger.info(TAG, `Display width ${this.displayWidth}`); this.initCardsListAndOffset(this.initCardsList); this.data = new CardsSource(this.cardsList); this.calculateOffset(0); } private initCardsListAndOffset(initCardsList: CardInfo[]) { if (initCardsList === undefined || initCardsList.length === 0) { initCardsList = Constants.CARD_TEST_CASE } initCardsList.forEach((item, index) => { this.cardsList.push(item); this.cardsOffset.push(0); this.scaleList.push(index === 0 ? this.MAX_SCALE : this.MIN_SCALE); }) this.initBackground(); } private async initBackground() { const context = getContext(this); const resourceMgr: resourceManager.ResourceManager = context.resourceManager; const fileData: Uint8Array = await resourceMgr.getMediaContent(this.cardsList[0].src as Resource); const buffer = fileData.buffer as ArrayBuffer; const imageSource: image.ImageSource = image.createImageSource(buffer); const pixelMap: image.PixelMap = await imageSource.createPixelMap(); effectKit.createColorPicker(pixelMap, (err, colorPicker) => { let color = colorPicker.getMainColorSync(); this.bgColor = "#" + color.alpha.toString(16) + color.red.toString(16) + color.green.toString(16) + color.blue.toString(16) }) } build() { Column() { Stack() { Column() { } .width($r('app.string.card_swiper_full_size')) .height($r('app.integer.card_swiper_swiper_height')) .zIndex(this.backgroundMaskZIndex) .visibility(this.isBackgroundColorChange ? Visibility.Visible : Visibility.Hidden) .linearGradient({ angle: Constants.LINEAR_GRADIENT_ANGLE, colors: [ [this.bgColor, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[0]], [Constants.BACKGROUND_END_COLOR, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[1]], [Constants.BACKGROUND_END_COLOR, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[2]], [this.bgColor, Constants.BACKGROUND_LINEAR_GRADIENT_COLOR_POS[3]] ] }) Swiper() { LazyForEach(this.data, (item: CardInfo, index: number) => { CardComponent({ cardInfo: item, cardOffset: this.cardsOffset[index], cardIndex: index, showingCard: this.currentSwiperIndex, scaleList: this.scaleList, isShowPreviewImage: this.isShowPreviewImage, }) }) } .index($$this.currentSwiperIndex) .loop(false) .prevMargin(this.swiperMargin) .nextMargin(this.swiperMargin) .duration(Constants.DURATION) .curve(Constants.DEFAULT_ANIMATION_CURVE) .cachedCount(Constants.SWIPER_CACHE_COUNT) .overlay(this.fadingOverlay(), { align: Alignment.Center }) .onChange((index) => { this.calculateOffset(index); this.currentSwiperIndex = index; this.scaleList[this.currentSwiperIndex] = this.MAX_SCALE; if (this.currentSwiperIndex === 0) { this.scaleList[this.scaleList.length - 1] = this.MIN_SCALE; this.linearGradientBeginColor = Constants.BEGIN_COLOR; this.linearGradientEndColor = Constants.END_COLOR; } else { this.scaleList[this.currentSwiperIndex - 1] = this.MIN_SCALE; } if (this.currentSwiperIndex === this.scaleList.length - 1) { this.scaleList[0] = this.MIN_SCALE; this.linearGradientBeginColor = Constants.END_COLOR; this.linearGradientEndColor = Constants.BEGIN_COLOR; } else { this.scaleList[this.currentSwiperIndex + 1] = this.MIN_SCALE; } if (this.currentSwiperIndex != 0 && this.currentSwiperIndex != this.scaleList.length - 1) { this.linearGradientBeginColor = Constants.END_COLOR; this.linearGradientEndColor = Constants.END_COLOR; } }) .onGestureSwipe((index, event) => { const currentOffset = event.currentOffset; const maxOffset = this.getMaxOffset(index) * this.proportion / 2; if (currentOffset < 0) { this.cardsOffset[index] = (-currentOffset / this.displayWidth) * maxOffset + maxOffset; if (this.isIndexValid(index + 1)) { const maxOffset = this.getMaxOffset(index + 1) / 2 * this.proportion; this.cardsOffset[index + 1] = (-currentOffset / this.displayWidth) * maxOffset; } if (this.isIndexValid(index - 1)) { const maxOffset = this.getMaxOffset(index - 1) / 2 * this.proportion; this.cardsOffset[index - 1] = (currentOffset / this.displayWidth) * maxOffset + 2 * maxOffset; } } else if (currentOffset > 0) { this.cardsOffset[index] = maxOffset - (currentOffset / this.displayWidth) * maxOffset; if (this.isIndexValid(index + 1)) { const maxOffset = this.getMaxOffset(index + 1) / 2 * this.proportion; this.cardsOffset[index + 1] = (currentOffset / this.displayWidth) * maxOffset; } if (this.isIndexValid(index - 1)) { const maxOffset = this.getMaxOffset(index - 1) / 2 * this.proportion; this.cardsOffset[index - 1] = 2 * maxOffset - (currentOffset / this.displayWidth) * maxOffset; } } this.calculateScaling(index, currentOffset); }) .onAnimationStart((index, targetIndex) => { this.calculateOffset(targetIndex); if (index === targetIndex) { let nextIndex: number = (index === this.scaleList.length - 1 ? 0 : index + 1); let preIndex: number = (index === 0 ? this.scaleList.length - 1 : index - 1); this.scaleList[index] = this.MAX_SCALE; this.scaleList[nextIndex] = this.MIN_SCALE; this.scaleList[preIndex] = this.MIN_SCALE; } else { let nextIndex: number = (targetIndex === this.scaleList.length - 1 ? 0 : targetIndex + 1); let preIndex: number = (targetIndex === 0 ? this.scaleList.length - 1 : targetIndex - 1); this.scaleList[targetIndex] = this.MAX_SCALE; this.scaleList[nextIndex] = this.MIN_SCALE; this.scaleList[preIndex] = this.MIN_SCALE; } this.getAverageColor(this.cardsList[targetIndex].src) }) .onAnimationEnd(() => { this.startSwiperOffset = 0; }) .height($r('app.integer.card_swiper_swiper_height')) .width($r('app.string.card_swiper_full_size')) } } .width(Constants.CARD_SWIPER_FULL_SIZE) .height(Constants.CARD_SWIPER_FULL_SIZE) .justifyContent(FlexAlign.Center) } private calculateOffset(target: number) { let left = target - 1; let right = target + 1; if (this.isIndexValid(left)) { this.cardsOffset[left] = this.getMaxOffset(left) - this.cardsList[left].width * (1 - this.MIN_SCALE) / 2; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardSwiperComponent.ets#L47-L307
bd2e4fe5cdce7d8c5df745f721db82ef49641bc3
gitee
magongshou/harmony-cordova
4b26bb5eeb3a9fd8ceb40165e6ac98b244474ee6
oh_modules/.ohpm/@magongshou+harmony-cordova@1.3.1/oh_modules/@magongshou/harmony-cordova/src/main/ets/components/PluginResult.d.ets
arkts
将Cordova消息状态枚举值转换为文字描述 @param status 状态枚举 @returns 状态描述
export declare function convertMessageStatusDesc(status: MessageStatus): string; export declare class PluginResult { private readonly status; private readonly messageType; private keepCallback; private readonly message; private readonly multipartMessages; constructor(status: MessageStatus, type: MessageType, message: string); static create(status: MessageStatus): PluginResult; static createByString(status: MessageStatus, message: string): PluginResult; static createByJson(status: MessageStatus, message: object): PluginResult; static createByNumber(status: MessageStatus, message: number): PluginResult; static createByBoolean(status: MessageStatus, message: boolean): PluginResult; static createByArrayBuffer(status: MessageStatus, message: Uint8Array): PluginResult; static createByBinaryString(status: MessageStatus, message: Uint8Array): PluginResult; static createByMessageList(status: MessageStatus, message: PluginResult[]): PluginResult; getKeepCallback(): boolean; setKeepCallback(keepCallback: boolean): void; getStatus(): MessageStatus; getMessageType(): MessageType; getMessage(): string; getMultipartMessagesSize(): number; getMultipartMessage(index: number): PluginResult; }
AST#export_declaration#Left export AST#ERROR#Left declare function convertMessageStatusDesc AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus 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 ; export declare AST#ERROR#Right AST#class_declaration#Left class PluginResult AST#class_body#Left { AST#property_declaration#Left private readonly status ; AST#property_declaration#Right AST#property_declaration#Left private readonly messageType ; AST#property_declaration#Right AST#property_declaration#Left private keepCallback ; AST#property_declaration#Right AST#property_declaration#Left private readonly message ; AST#property_declaration#Right AST#property_declaration#Left private readonly multipartMessages ; AST#property_declaration#Right AST#ERROR#Left constructor AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left MessageType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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#ERROR#Right AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByString AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByJson AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByNumber AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByBoolean AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByArrayBuffer AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByBinaryString AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left static createByMessageList AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left PluginResult [ ] 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left getKeepCallback AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left setKeepCallback AST#parameter_list#Left ( AST#parameter#Left keepCallback : 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 AST#method_declaration#Left getStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MessageStatus AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left getMessageType AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MessageType AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left getMessage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right AST#method_declaration#Left getMultipartMessagesSize 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#method_declaration#Right AST#method_declaration#Left getMultipartMessage 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 PluginResult AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export declare function convertMessageStatusDesc(status: MessageStatus): string; export declare class PluginResult { private readonly status; private readonly messageType; private keepCallback; private readonly message; private readonly multipartMessages; constructor(status: MessageStatus, type: MessageType, message: string); static create(status: MessageStatus): PluginResult; static createByString(status: MessageStatus, message: string): PluginResult; static createByJson(status: MessageStatus, message: object): PluginResult; static createByNumber(status: MessageStatus, message: number): PluginResult; static createByBoolean(status: MessageStatus, message: boolean): PluginResult; static createByArrayBuffer(status: MessageStatus, message: Uint8Array): PluginResult; static createByBinaryString(status: MessageStatus, message: Uint8Array): PluginResult; static createByMessageList(status: MessageStatus, message: PluginResult[]): PluginResult; getKeepCallback(): boolean; setKeepCallback(keepCallback: boolean): void; getStatus(): MessageStatus; getMessageType(): MessageType; getMessage(): string; getMultipartMessagesSize(): number; getMultipartMessage(index: number): PluginResult; }
https://github.com/magongshou/harmony-cordova/blob/4b26bb5eeb3a9fd8ceb40165e6ac98b244474ee6/oh_modules/.ohpm/@magongshou+harmony-cordova@1.3.1/oh_modules/@magongshou/harmony-cordova/src/main/ets/components/PluginResult.d.ets#L65-L88
8ce9541c55f3041e7eeeed2743e160022f4c635b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets
arkts
finishPlayCallback
设置播放完成监听。
async finishPlayCallback() { this.soundPool!.on('playFinished', () => { console.info('receive play finished message'); // 可进行下次播放。 }) }
AST#method_declaration#Left async finishPlayCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . soundPool AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'playFinished' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'receive play finished message' 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
async finishPlayCallback() { this.soundPool!.on('playFinished', () => { console.info('receive play finished message'); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/SoundPool/SoundPoolArkTS/entry/src/main/ets/pages/Index.ets#L91-L96
690ccee6c314fb19479a135075033bd36fa46dc3
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/manager/StateManager.ets
arkts
状态--升级中 @since 2022-06-10
export class Upgrading extends Installing { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.UPGRADING; this.percent = 100; this.isButtonClickable = false; this.downloadStateText = $r('app.string.new_version_status_installing'); } async notify(context?: common.Context): Promise<void> { AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); } }
AST#export_declaration#Left export AST#class_declaration#Left class Upgrading extends AST#type_annotation#Left AST#primary_type#Left Installing AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super 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 . actionSet 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 UpdateAction AST#expression#Right . SHOW_NEW_VERSION 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 . actionSet 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 UpdateAction AST#expression#Right . SHOW_PROCESS_VIEW 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 . state AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left UpdateState AST#expression#Right . UPGRADING 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 . percent AST#member_expression#Right = AST#expression#Left 100 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 . isButtonClickable 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 . downloadStateText AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.new_version_status_installing' 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#block_statement#Right AST#constructor_declaration#Right AST#method_declaration#Left async notify AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 AppStorage AST#expression#Right . Set AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'installStatusRefresh' AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . otaStatus AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class Upgrading extends Installing { constructor() { super(); this.actionSet.push(UpdateAction.SHOW_NEW_VERSION); this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW); this.state = UpdateState.UPGRADING; this.percent = 100; this.isButtonClickable = false; this.downloadStateText = $r('app.string.new_version_status_installing'); } async notify(context?: common.Context): Promise<void> { AppStorage.Set('installStatusRefresh', JSON.stringify(this.otaStatus)); } }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L592-L606
d2a419aabe73ba299a858769e83b2a4ab0f0b712
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MainPage.ets
arkts
tabBarItem
Tabs 的底部导航项 @param {number} index - 索引 @returns {void} 无返回值
@Builder private tabBarItem(index: number) { ColumnCenter() { Lottie({ loop: false, autoPlay: this.vm.currentPageIndex === index, controller: this.vm.lottieControllers[index], animationData: this.vm.tabItems[index].animationData }) .attributeModifier(size(bp({ sm: 24, md: 28, lg: 32, }))) .onAppear(() => this.vm.handleTabAppear(index)); SpaceVerticalXSmall(); Text(this.vm.tabItems[index].title) .fontSize(bp({ sm: $r("app.float.body_medium"), md: $r("app.float.body_large"), lg: $r("app.float.headline_large") })) .fontColor(this.vm.currentPageIndex === index ? $r("app.color.primary") : $r("app.color.text_subtitle")) .textAlign(TextAlign.Center); }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private tabBarItem 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnCenter ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Lottie ( AST#component_parameters#Left { 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 autoPlay : 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 . vm AST#member_expression#Right AST#expression#Right . currentPageIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left controller : AST#expression#Left AST#subscript_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 . lottieControllers AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left animationData : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . tabItems AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . animationData AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . attributeModifier ( AST#expression#Left AST#call_expression#Left AST#expression#Left size AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left bp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left sm AST#property_name#Right : AST#expression#Left 24 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left md AST#property_name#Right : AST#expression#Left 28 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lg AST#property_name#Right : AST#expression#Left 32 AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . handleTabAppear 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#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#expression_statement#Left AST#expression#Left AST#expression#Right ; AST#expression_statement#Right AST#ui_custom_component_statement#Left SpaceVerticalXSmall ( ) ; AST#ui_custom_component_statement#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . tabItems AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#call_expression#Left AST#expression#Left bp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left sm AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left md AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.body_large" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left lg AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.headline_large" 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#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . currentPageIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.primary" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.text_subtitle" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ERROR#Left ; AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder private tabBarItem(index: number) { ColumnCenter() { Lottie({ loop: false, autoPlay: this.vm.currentPageIndex === index, controller: this.vm.lottieControllers[index], animationData: this.vm.tabItems[index].animationData }) .attributeModifier(size(bp({ sm: 24, md: 28, lg: 32, }))) .onAppear(() => this.vm.handleTabAppear(index)); SpaceVerticalXSmall(); Text(this.vm.tabItems[index].title) .fontSize(bp({ sm: $r("app.float.body_medium"), md: $r("app.float.body_large"), lg: $r("app.float.headline_large") })) .fontColor(this.vm.currentPageIndex === index ? $r("app.color.primary") : $r("app.color.text_subtitle")) .textAlign(TextAlign.Center); }; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MainPage.ets#L96-L125
b7a5405fb02c3f214c6013181c44a2ddc6805a79
github
Leeson-Wong/ark-layer.git
9efa3553414a6b1eee890e3858c8cdcb308535d7
core/PhaseConfig.ets
arkts
阶段比较器 用于排序阶段列表
export function comparePhases(a: Phase, b: Phase): number { return a.priority - b.priority }
AST#export_declaration#Left export AST#function_declaration#Left function comparePhases AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left Phase AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left Phase 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . priority AST#member_expression#Right AST#expression#Right - AST#expression#Left b AST#expression#Right AST#binary_expression#Right AST#expression#Right . priority AST#member_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 comparePhases(a: Phase, b: Phase): number { return a.priority - b.priority }
https://github.com/Leeson-Wong/ark-layer.git/blob/9efa3553414a6b1eee890e3858c8cdcb308535d7/core/PhaseConfig.ets#L48-L50
13e1f61aed935f5502c365d2c121471aa3848c08
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
arkts
initCompressFile
将待压缩文件写入到应用沙箱目录 @param compressZipName 待压缩文件所处路径 @returns
initCompressFile(beCompressFileDir: string): void { //获取rawfile下的所有待压缩文件名 this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`, (error: BusinessError, value: Uint8Array) => { if (error !== undefined) { logger.error(TAG, `getRawFileContent failed, error message: ${error.message}, error code: ${error.code}`); } else { const rawFile: Uint8Array = value; this.pathDir = this.context.filesDir; // 获取应用沙箱目录 this.rawfilePath = `${this.pathDir}/${beCompressFileDir}`; // 设置rawfile压缩文件的应用沙箱路径 if (!fs.accessSync(this.rawfilePath)) { fs.mkdirSync(this.rawfilePath); } // 在指定路径以同步方法打开或创建文件 const file = fs.openSync(`${this.rawfilePath}/${fileName}`, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); // 使用fs.write接口将字节数组形式的rawfile的文件内容写入到指定沙箱路径filePath中 fs.write(file.fd, rawFile.buffer).then((writeLen: number) => { logger.info(TAG, `write data to file succeed and size is: ${writeLen}`); }).catch((err: BusinessError) => { logger.error(TAG, `write data to file failed with error message: ${err.message}, error code: ${err.code}`); }).finally(() => { logger.info(TAG, 'write finished'); fs.closeSync(file); // 以同步方法关闭文件。 }); } }); }) }
AST#method_declaration#Left initCompressFile AST#parameter_list#Left ( AST#parameter#Left beCompressFileDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { //获取rawfile下的所有待压缩文件名 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFiles 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#member_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileListSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left beCompressFileDir AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . beCompressFiles 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 fileName : 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#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 . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left beCompressFileDir AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , 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#Left value : 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#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left error AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 ` getRawFileContent failed, error message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right , error code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` 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 else AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left rawFile : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left value 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 . pathDir 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 . context AST#member_expression#Right AST#expression#Right . filesDir 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 . rawfilePath AST#member_expression#Right = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pathDir AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left beCompressFileDir 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 // 设置rawfile压缩文件的应用沙箱路径 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . rawfilePath AST#member_expression#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 fs AST#expression#Right . mkdirSync 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 . rawfilePath 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#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left file = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . openSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . rawfilePath AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right / AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right 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 . READ_WRITE 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 . CREATE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 使用fs.write接口将字节数组形式的rawfile的文件内容写入到指定沙箱路径filePath中 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . write 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 AST#member_expression#Left AST#expression#Left rawFile AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left writeLen : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` write data to file succeed and size is: AST#template_substitution#Left $ { AST#expression#Left writeLen 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 . 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 ` write data to file 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 . finally AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left TAG AST#expression#Right , AST#expression#Left 'write finished' 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
initCompressFile(beCompressFileDir: string): void { this.beCompressFiles = this.context.resourceManager.getRawFileListSync(beCompressFileDir); this.beCompressFiles.forEach((fileName: string) => { this.context.resourceManager.getRawFileContent(`${beCompressFileDir}/${fileName}`, (error: BusinessError, value: Uint8Array) => { if (error !== undefined) { logger.error(TAG, `getRawFileContent failed, error message: ${error.message}, error code: ${error.code}`); } else { const rawFile: Uint8Array = value; this.pathDir = this.context.filesDir; this.rawfilePath = `${this.pathDir}/${beCompressFileDir}`; if (!fs.accessSync(this.rawfilePath)) { fs.mkdirSync(this.rawfilePath); } const file = fs.openSync(`${this.rawfilePath}/${fileName}`, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); fs.write(file.fd, rawFile.buffer).then((writeLen: number) => { logger.info(TAG, `write data to file succeed and size is: ${writeLen}`); }).catch((err: BusinessError) => { logger.error(TAG, `write data to file failed with error message: ${err.message}, error code: ${err.code}`); }).finally(() => { logger.info(TAG, 'write finished'); fs.closeSync(file); }); } }); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L108-L139
3cbf2ac68d383c44bd1f0e6113a3850770565a54
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets
arkts
CourseItem
每个分类的内容主体
@Builder CourseItem(item: BookSourcePart, i: number, j: number) { Column() { Row() { Text(item.bookSourceName) .fontSize(16) .lineHeight(24) .fontWeight(FontWeight.Medium) .textOverflow({ overflow: TextOverflow.Ellipsis, }) .maxLines(1) if (item.hasLoginUrl) { Tag({ text: '登录', color: '#188BFF', bgColor: '#1F188BFF' }) } if (item.hasExploreUrl) { Tag({ text: '发现', color: this.theme.mainColor, bgColor: this.theme.secondColor }) } Blank() if (this.isBatch) { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.activeNameMap[item.bookSourceUrl] ?? false) .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.activeNameMap[item.bookSourceUrl] = val }) } else { Image($r('app.media.more_vertical')) .width(24).fillColor('#73000000') .bindMenu( this.showRightDialogMap[item.bookSourceUrl], this.rightDialogBuilder(this.Item_Right_Dialog_Data, async (index: number) => { switch (index) { case 0: router.pushUrl({ url: 'pages/view/Find/BookSource/AddSourcePage', params: { id: item.bookSourceUrl } }) break; case 1: this.dialogItem = JSON.parse(JSON.stringify(item)) as BookSourcePart this.dialogController.open() break; case 2: case 3: showMessage(this.Item_Right_Dialog_Data[index].title) break; case 4: router.pushUrl({ url: 'pages/view/Find/BookSource/AddSourcePage', params: { id: item.bookSourceUrl, type: 1 } }) break; case 5: await BookSourceDao.delete(item.bookSourceUrl) showMessage('删除成功') this.getList() break; } }), { onDisappear: () => { this.showRightDialogMap[item.bookSourceUrl] = false } }) .onClick(() => { this.showRightDialogMap[item.bookSourceUrl] = true }) } } .width('100%') .justifyContent(FlexAlign.SpaceBetween) Row() { Score({ grade: item.bookSourceGrade, score: item.bookSourceScore }) } .width('100%') .margin({ top: 10 }) .justifyContent(FlexAlign.Start) Row() { Text(dayjs(item.lastUpdateTime).format('YYYY-MM-DD HH:mm')) .fontSize(12) .lineHeight(20) .fontColor('rgba(0, 0, 0, 0.45)') Text('导入') .padding({ left: 4 }) .fontSize(12) .lineHeight(20) .fontColor('rgba(0, 0, 0, 0.45)') Blank() Toggle({ type: ToggleType.Switch, isOn: item.enabled }) .selectedColor(this.theme.mainColor) .onChange(async (val: boolean) => { item.enabled = val await BookSourceDao.updateFlow(item) }) } .width('100%') .margin({ top: 3 }) .justifyContent(FlexAlign.SpaceBetween) if (j === 1) { Row() { Text('搜索不到时可以尝试以下格式搜索 ##完整书名 每隔八小时访问一遍签到(搜索的时候访问) 登录注意事项: 1、如果app有重新登录过,就要重新抓token 2、每次重新登录,那么书籍就要更新目录,刷新正文') .fontSize(12) .fontColor('#73000000') .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(this.clickNameMap[item.bookSourceUrl] ? 99 : 1) .layoutWeight(1) .animation({ duration: 300 }) .onClick(() => { this.clickNameMap[item.bookSourceUrl] = !this.clickNameMap[item.bookSourceUrl] }) Image($r('app.media.down_arrow')) .margin({ top: 4 }) .width(8) } .margin({ top: 10 }) .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .alignItems(VerticalAlign.Top) .width('100%') .justifyContent(FlexAlign.SpaceBetween) .backgroundColor('rgba(0, 0, 0, 0.04)') } } .width('100%') .margin({ bottom: 12 }) .borderRadius(12) .padding({ left: 16, right: 16, top: 12, bottom: 12 }) .backgroundColor(Color.White) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CourseItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left BookSourcePart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left j : 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceName AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . hasLoginUrl AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tag ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left '登录' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left color : AST#expression#Left '#188BFF' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left bgColor : AST#expression#Left '#1F188BFF' 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#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . hasExploreUrl AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Tag ( AST#component_parameters#Left { AST#component_parameter#Left text : AST#expression#Left '发现' AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left color : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . theme AST#member_expression#Right AST#expression#Right . mainColor 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . theme AST#member_expression#Right AST#expression#Right . secondColor AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isBatch AST#member_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 AST#binary_expression#Left AST#expression#Left 'checkbox' AST#expression#Right + AST#expression#Left j AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left group : AST#expression#Left AST#binary_expression#Left AST#expression#Left 'checkboxGroup' AST#expression#Right + AST#expression#Left i AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . select ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeNameMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ?? AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . theme AST#member_expression#Right AST#expression#Right . mainColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . activeNameMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = val AST#ERROR#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } else { 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.more_vertical' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left '#73000000' AST#expression#Right ) AST#modifier_chain_expression#Left . bindMenu ( AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showRightDialogMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_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 . rightDialogBuilder AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Item_Right_Dialog_Data AST#member_expression#Right AST#expression#Right AST#ERROR#Left , async 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#ERROR#Left => { AST#ERROR#Left AST#property_assignment#Left AST#property_name#Left switch AST#property_name#Right AST#parameter_list#Left ( AST#parameter#Left index 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 0 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left router . pushUrl AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ( AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left url AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : 'pages/view/Find/BookSource/AddSourcePage' , params : AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#property_assignment#Right ) AST#ERROR#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 1 AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left this . dialogItem AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = JSON AST#ERROR#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left BookSourcePart AST#ERROR#Left this AST#ERROR#Right . dialogController AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right . open AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right break ; case 2 : case AST#expression#Left AST#call_expression#Left AST#expression#Left 3 AST#expression#Right AST#ERROR#Left : showMessage AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . Item_Right_Dialog_Data AST#member_expression#Right AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right break ; case AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 4 AST#expression#Right AST#ERROR#Left : router AST#ERROR#Right . pushUrl 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 url AST#property_name#Right : AST#expression#Left 'pages/view/Find/BookSource/AddSourcePage' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left params AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left type AST#property_name#Right : AST#expression#Left 1 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 break ; case AST#expression#Left 5 AST#expression#Right : AST#ERROR#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left BookSourceDao AST#expression#Right AST#await_expression#Right AST#expression#Right . delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left showMessage AST#ERROR#Right AST#argument_list#Left ( AST#expression#Left '删除成功' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#ERROR#Left this AST#ERROR#Right . getList 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 break ; } } AST#ERROR#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onDisappear AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showRightDialogMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showRightDialogMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left = AST#ERROR#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Score ( AST#component_parameters#Left { AST#component_parameter#Left grade : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceGrade AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left score : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceScore AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#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#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left dayjs AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . lastUpdateTime AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . format AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'YYYY-MM-DD HH:mm' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0, 0, 0, 0.45)' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '导入' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left 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 . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . lineHeight ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 'rgba(0, 0, 0, 0.45)' 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 Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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_parameter#Left isOn : AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . enabled AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . theme AST#member_expression#Right AST#expression#Right . mainColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . enabled AST#member_expression#Right = AST#expression#Left val 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 BookSourceDao AST#expression#Right AST#await_expression#Right AST#expression#Right . updateFlow 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 3 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 j AST#expression#Right === AST#expression#Left 1 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#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '搜索不到时可以尝试以下格式搜索 ##完整书名 每隔八小时访问一遍签到(搜索的时候访问) 登录注意事项: 1、如果app有重新登录过,就要重新抓token 2、每次重新登录,那么书籍就要更新目录,刷新正文' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#73000000' AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clickNameMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ? AST#expression#Left 99 AST#expression#Right : AST#expression#Left 1 AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . animation ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration 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#non_null_assertion_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clickNameMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left = AST#ERROR#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . clickNameMap AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . bookSourceUrl AST#member_expression#Right AST#expression#Right ] AST#subscript_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#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.down_arrow' 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 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 8 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom 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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Top AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'rgba(0, 0, 0, 0.04)' 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 12 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 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 16 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#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#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 CourseItem(item: BookSourcePart, i: number, j: number) { Column() { Row() { Text(item.bookSourceName) .fontSize(16) .lineHeight(24) .fontWeight(FontWeight.Medium) .textOverflow({ overflow: TextOverflow.Ellipsis, }) .maxLines(1) if (item.hasLoginUrl) { Tag({ text: '登录', color: '#188BFF', bgColor: '#1F188BFF' }) } if (item.hasExploreUrl) { Tag({ text: '发现', color: this.theme.mainColor, bgColor: this.theme.secondColor }) } Blank() if (this.isBatch) { Checkbox({ name: 'checkbox' + j, group: 'checkboxGroup' + i }) .select(this.activeNameMap[item.bookSourceUrl] ?? false) .selectedColor(this.theme.mainColor) .onChange((val: boolean) => { this.activeNameMap[item.bookSourceUrl] = val }) } else { Image($r('app.media.more_vertical')) .width(24).fillColor('#73000000') .bindMenu( this.showRightDialogMap[item.bookSourceUrl], this.rightDialogBuilder(this.Item_Right_Dialog_Data, async (index: number) => { switch (index) { case 0: router.pushUrl({ url: 'pages/view/Find/BookSource/AddSourcePage', params: { id: item.bookSourceUrl } }) break; case 1: this.dialogItem = JSON.parse(JSON.stringify(item)) as BookSourcePart this.dialogController.open() break; case 2: case 3: showMessage(this.Item_Right_Dialog_Data[index].title) break; case 4: router.pushUrl({ url: 'pages/view/Find/BookSource/AddSourcePage', params: { id: item.bookSourceUrl, type: 1 } }) break; case 5: await BookSourceDao.delete(item.bookSourceUrl) showMessage('删除成功') this.getList() break; } }), { onDisappear: () => { this.showRightDialogMap[item.bookSourceUrl] = false } }) .onClick(() => { this.showRightDialogMap[item.bookSourceUrl] = true }) } } .width('100%') .justifyContent(FlexAlign.SpaceBetween) Row() { Score({ grade: item.bookSourceGrade, score: item.bookSourceScore }) } .width('100%') .margin({ top: 10 }) .justifyContent(FlexAlign.Start) Row() { Text(dayjs(item.lastUpdateTime).format('YYYY-MM-DD HH:mm')) .fontSize(12) .lineHeight(20) .fontColor('rgba(0, 0, 0, 0.45)') Text('导入') .padding({ left: 4 }) .fontSize(12) .lineHeight(20) .fontColor('rgba(0, 0, 0, 0.45)') Blank() Toggle({ type: ToggleType.Switch, isOn: item.enabled }) .selectedColor(this.theme.mainColor) .onChange(async (val: boolean) => { item.enabled = val await BookSourceDao.updateFlow(item) }) } .width('100%') .margin({ top: 3 }) .justifyContent(FlexAlign.SpaceBetween) if (j === 1) { Row() { Text('搜索不到时可以尝试以下格式搜索 ##完整书名 每隔八小时访问一遍签到(搜索的时候访问) 登录注意事项: 1、如果app有重新登录过,就要重新抓token 2、每次重新登录,那么书籍就要更新目录,刷新正文') .fontSize(12) .fontColor('#73000000') .textOverflow({ overflow: TextOverflow.Ellipsis }) .maxLines(this.clickNameMap[item.bookSourceUrl] ? 99 : 1) .layoutWeight(1) .animation({ duration: 300 }) .onClick(() => { this.clickNameMap[item.bookSourceUrl] = !this.clickNameMap[item.bookSourceUrl] }) Image($r('app.media.down_arrow')) .margin({ top: 4 }) .width(8) } .margin({ top: 10 }) .padding({ left: 8, right: 8, top: 4, bottom: 4 }) .alignItems(VerticalAlign.Top) .width('100%') .justifyContent(FlexAlign.SpaceBetween) .backgroundColor('rgba(0, 0, 0, 0.04)') } } .width('100%') .margin({ bottom: 12 }) .borderRadius(12) .padding({ left: 16, right: 16, top: 12, bottom: 12 }) .backgroundColor(Color.White) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/Find/BookSource/components/SourceView.ets#L801-L955
7d869ad62964de483e9e2eb5874418cd3bea1a29
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/pages/WatchVodPage.ets
arkts
onStartAnnouncement
@description 获取公告
onStartAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('获取公告:', msgModel) }
AST#method_declaration#Left onStartAnnouncement AST#parameter_list#Left ( AST#parameter#Left msgModel ? : AST#type_annotation#Left AST#primary_type#Left VHAnnouncementMessage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '获取公告:' AST#expression#Right , AST#expression#Left msgModel 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
onStartAnnouncement(msgModel?: VHAnnouncementMessage) { console.log('获取公告:', msgModel) }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/pages/WatchVodPage.ets#L155-L157
e81a22832b7a88e095d53633e3d2e8c704e28c68
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/objects/ExtWebNode.ets
arkts
update
Update?
update(ext: extension) { if (this.builderNode) { try { this.builderNode.update(ext); console.log(`[WebNode][update] ext.storage.get('my_window_id')=${ext.storage?.get('my_window_id') as string}`); } catch (e) { console.error(`[WebNode][update] Failed: ${e}!`); } } }
AST#method_declaration#Left update AST#parameter_list#Left ( AST#parameter#Left ext : AST#type_annotation#Left AST#primary_type#Left extension AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderNode AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . builderNode AST#member_expression#Right AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ext AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` [WebNode][update] ext.storage.get('my_window_id')= AST#template_substitution#Left $ { AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ext AST#expression#Right . storage AST#member_expression#Right AST#expression#Right ?. get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'my_window_id' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right } AST#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 ( 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#template_literal#Left ` [WebNode][update] Failed: 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
update(ext: extension) { if (this.builderNode) { try { this.builderNode.update(ext); console.log(`[WebNode][update] ext.storage.get('my_window_id')=${ext.storage?.get('my_window_id') as string}`); } catch (e) { console.error(`[WebNode][update] Failed: ${e}!`); } } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/objects/ExtWebNode.ets#L96-L105
c74b278e469c32774b7cca0b1838a191a6957da2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/utils/FunctionDescription.ets
arkts
FunctionDescription
模块功能描述组件 @param title 标题 @param context 内容
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.secondarylinkage_text_size_headline')) .fontWeight(FontWeight.Medium) .textOverflow({overflow:TextOverflow.Ellipsis}) .maxLines(1) } .margin({ bottom: $r('app.string.secondarylinkage_elements_margin_vertical_m') }) Row(){ Text(this.content) .wordBreak(WordBreak.BREAK_ALL) } .width('100%') } .width('100%') .backgroundColor($r('app.color.secondarylinkage_color_sub_background')) .borderRadius($r('app.string.secondarylinkage_corner_radius_default_m')) .padding($r('app.string.secondarylinkage_card_padding_start')) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FunctionDescription AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_text_size_headline' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textOverflow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left overflow AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left TextOverflow AST#expression#Right . Ellipsis AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_elements_margin_vertical_m' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 . content AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . wordBreak ( AST#expression#Left AST#member_expression#Left AST#expression#Left WordBreak AST#expression#Right . BREAK_ALL 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#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 . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.secondarylinkage_color_sub_background' 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.string.secondarylinkage_corner_radius_default_m' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.secondarylinkage_card_padding_start' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct FunctionDescription { private title: ResourceStr = ''; private content: ResourceStr = ''; build() { Column() { Row() { Text(this.title) .fontSize($r('app.string.secondarylinkage_text_size_headline')) .fontWeight(FontWeight.Medium) .textOverflow({overflow:TextOverflow.Ellipsis}) .maxLines(1) } .margin({ bottom: $r('app.string.secondarylinkage_elements_margin_vertical_m') }) Row(){ Text(this.content) .wordBreak(WordBreak.BREAK_ALL) } .width('100%') } .width('100%') .backgroundColor($r('app.color.secondarylinkage_color_sub_background')) .borderRadius($r('app.string.secondarylinkage_corner_radius_default_m')) .padding($r('app.string.secondarylinkage_card_padding_start')) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/utils/FunctionDescription.ets#L21-L47
b13ed137856c393c8fd1049846e505a3ccc2675b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
resetTracking
RESET PERFORMANCE TRACKING FIELDS
public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; }
AST#method_declaration#Left public resetTracking 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 . totalTime AST#member_expression#Right = AST#expression#Left 0 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 . drawCycles AST#member_expression#Right = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public resetTracking(): void { this.totalTime = 0; this.drawCycles = 0; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L432-L435
bbc037bd5f297182419d674911ae3412eae79968
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/DashboardPage.ets
arkts
buildTabContent
构建标签内容
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildOverviewTab(); break; case 1: this.buildReportsTab();
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedTab AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left 0 AST#expression#Right AST#expression_statement#Right : AST#ERROR#Left AST#qualified_type#Left this . buildOverviewTab AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#break_statement#Left break ; AST#break_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left 1 AST#expression#Right AST#expression_statement#Right AST#statement#Right : AST#ERROR#Left AST#qualified_type#Left this . buildReportsTab AST#qualified_type#Right AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Right ; AST#method_declaration#Right
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildOverviewTab(); break; case 1: this.buildReportsTab();
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/DashboardPage.ets#L324-L331
263bc9977c37cdc624bf2680815f8da850199f30
github
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/pages/LoginPage.ets
arkts
imageButton
图片按钮 @param src 图片url
@Builder imageButton(src: Resource) { Button({ type: ButtonType.Circle, stateEffect: true }) { Image(src) } .width($r('app.float.other_login_image_size')) .height($r('app.float.other_login_image_size')) .backgroundColor($r('app.color.background')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right imageButton AST#parameter_list#Left ( AST#parameter#Left src : 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#component_parameters#Left { AST#component_parameter#Left type : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_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#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left src 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#resource_expression#Left $r ( AST#expression#Left 'app.float.other_login_image_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.float.other_login_image_size' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.background' 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#builder_function_body#Right AST#method_declaration#Right
@Builder imageButton(src: Resource) { Button({ type: ButtonType.Circle, stateEffect: true }) { Image(src) } .width($r('app.float.other_login_image_size')) .height($r('app.float.other_login_image_size')) .backgroundColor($r('app.color.background')) }
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/pages/LoginPage.ets#L52-L62
a4a19f2a1d6e3edc08b6e154b4b6d3a229b20e94
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppDefines.ets
arkts
export const dWrongFlag = "\u274c";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dWrongFlag = AST#expression#Left "\u274c" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const dWrongFlag = "\u274c";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppDefines.ets#L64-L64
09380700a76edcbd3c9a1ef3088ee7b272f5ebc0
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets
arkts
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.
export class TimeTableDataSource implements IDataSource { private list: TimeTable[] = []; private listeners: DataChangeListener[] = []; constructor(list: TimeTable[]) { this.list = list; } totalCount(): number { return this.list.length; } getData(index: number): TimeTable { return this.list[index]; } 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); } } // 通知控制器数据变化 notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); } // 通知控制器数据删除 notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); } // 通知控制器添加数据 notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); } // 在指定索引位置删除一个元素 public deleteItem(index: number): void { this.list.splice(index, 1); this.notifyDataDelete(index); } // 修改第一个元素 public change1stItem(temp: TimeTable): void { this.list[0] = temp; this.notifyDataChange(0); }
AST#export_declaration#Left export AST#class_declaration#Left class TimeTableDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TimeTable [ ] 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 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#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TimeTable [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . list AST#member_expression#Right = AST#expression#Left list 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 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 . list 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 AST#method_declaration#Left 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 TimeTable 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 . list 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 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 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 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 listener => 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 // 通知控制器数据删除 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 listener => 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 // 通知控制器添加数据 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 listener => 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 // 在指定索引位置删除一个元素 AST#method_declaration#Left public deleteItem 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 . list 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 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataDelete 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#property_declaration#Left public change1stItem AST#ERROR#Left AST#parameter_list#Left ( AST#parameter#Left temp : AST#type_annotation#Left AST#primary_type#Left TimeTable AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . list AST#member_expression#Right AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Right = AST#expression#Left temp AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left this AST#ERROR#Left . not if yDataChange AST#ERROR#Right AST#parameter_list#Left ( AST#ERROR#Left 0 AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class TimeTableDataSource implements IDataSource { private list: TimeTable[] = []; private listeners: DataChangeListener[] = []; constructor(list: TimeTable[]) { this.list = list; } totalCount(): number { return this.list.length; } getData(index: number): TimeTable { return this.list[index]; } 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); } } notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); } notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); } notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); } public deleteItem(index: number): void { this.list.splice(index, 1); this.notifyDataDelete(index); } public change1stItem(temp: TimeTable): void { this.list[0] = temp; this.notifyDataChange(0); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_scroll/ace_ets_module_scroll_api20/entry/src/main/ets/MainAbility/pages/List/ListDataSource.ets#L15-L75
ad4622eaf563b13227ccf667ede8a0ca4a2de81a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
convertPemPubKeyFromStr
将非对称加密pem格式字符串pubKey转换为symKey对象 @param publicKey字符串key-pem格式 @param symAlgName 秘钥规格 @returns
static convertPemPubKeyFromStr(publicKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(publicKey, null); return symKey; }
AST#method_declaration#Left static convertPemPubKeyFromStr AST#parameter_list#Left ( AST#parameter#Left publicKey : 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_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left aesGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createAsyKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symAlgName 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 symKey = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left aesGenerator AST#expression#Right . convertPemKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left publicKey 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left symKey AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static convertPemPubKeyFromStr(publicKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(publicKey, null); return symKey; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L50-L54
c86bb363ede401b8390673dc06d4b451f37542dc
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/select/selectOnSelect.ets
arkts
SelectOnSelectBuilder
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 SelectOnSelectBuilder(name: string, param: Object) { OnSelectExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SelectOnSelectBuilder 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 OnSelectExample ( ) 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 SelectOnSelectBuilder(name: string, param: Object) { OnSelectExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/select/selectOnSelect.ets#L16-L19
271b7ebddaea80bfe3dfb61e931fc371b170b786
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
concatDate
Modify the format of the year, month, and day @param year @param month @param date
concatDate(year: number, month: number, date: number): string { return `${year}${this.fill(month)}${this.fill(date)}`; }
AST#method_declaration#Left concatDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : 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 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#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left year 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 this AST#expression#Right . fill AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left month 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . fill 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#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
concatDate(year: number, month: number, date: number): string { return `${year}${this.fill(month)}${this.fill(date)}`; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L62-L64
6f9932f9fcb12473b346e27d703cb6583e4917a3
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
setSpaceMax
Sets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum`
public setSpaceMax(mSpaceMax: number): void { this.mSpaceMax = mSpaceMax; }
AST#method_declaration#Left public setSpaceMax AST#parameter_list#Left ( AST#parameter#Left mSpaceMax : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mSpaceMax AST#member_expression#Right = AST#expression#Left mSpaceMax AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
public setSpaceMax(mSpaceMax: number): void { this.mSpaceMax = mSpaceMax; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L823-L825
45b5c9f7e72560d78c86a7a17071ab182972f819
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
用户ID接口
export interface UserIdParam { id: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserIdParam AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export interface UserIdParam { id: string; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L73-L75
7b88003d2cf65c419bd2a34f97744ba1e3b45fc7
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets
arkts
CommonItemInput
TextInput of change panel @param inputValue change inputValue
@Component export struct CommonItemInput { @Link inputValue: string; private name: Resource = $r('app.string.divider_color_blue'); private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.placeholder }) .size(TOOL_WIDTH) .onChange(value => { this.inputValue = value }).id('test_input') .enableKeyboardOnFocus(false) } .size({ width: '100%', height: 70 }) .padding({ left: 12, right: 12 }) .borderRadius(24) .backgroundColor($r('app.color.white')) .margin({ top: 12, bottom: 12 }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemInput AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right inputValue : 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 private name : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.divider_color_blue' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private placeholder ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' 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 . name AST#member_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 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Blank ( ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . placeholder AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . size ( AST#expression#Left TOOL_WIDTH AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left value => 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 . inputValue AST#member_expression#Right = AST#expression#Left value AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left 'test_input' AST#expression#Right ) AST#modifier_chain_expression#Left . enableKeyboardOnFocus ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#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 '100%' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left 70 AST#expression#Right AST#property_assignment#Right } AST#object_literal#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 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#Left . borderRadius ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.white' 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 12 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 12 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 CommonItemInput { @Link inputValue: string; private name: Resource = $r('app.string.divider_color_blue'); private placeholder?: ResourceStr = ''; build() { Row() { Text(this.name) .margin({ left: 12, right: 12 }) Blank() TextInput({ placeholder: this.placeholder }) .size(TOOL_WIDTH) .onChange(value => { this.inputValue = value }).id('test_input') .enableKeyboardOnFocus(false) } .size({ width: '100%', height: 70 }) .padding({ left: 12, right: 12 }) .borderRadius(24) .backgroundColor($r('app.color.white')) .margin({ top: 12, bottom: 12 }) } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L235-L259
9dff7951e5da42fcff2d97c4f71645555498399b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
openSync
打开文件,支持使用URI打开文件。以同步方法。 @param path string 文件的应用沙箱路径或URI。 @param mode number 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开。 @returns
static openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); }
AST#method_declaration#Left static openSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : 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#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 . READ_WRITE 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 . CREATE AST#member_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fs . File 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#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 path AST#expression#Right , AST#expression#Left mode 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 openSync(path: string, mode: number = fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE): fs.File { return fs.openSync(path, mode); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L115-L117
e08a4af64cd2e3a6dee5ffe3ed0904d5227c8e00
gitee
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectDevice.ets
arkts
toControlPage
跳转的设备页面
private toControlPage(deviceId: string) { getControlPage.getDeviceControlPage(deviceId,true) }
AST#method_declaration#Left private toControlPage AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left getControlPage AST#expression#Right . getDeviceControlPage AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left deviceId AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
private toControlPage(deviceId: string) { getControlPage.getDeviceControlPage(deviceId,true) }
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectDevice.ets#L127-L129
581aa595103f90e6139a99fa7aa17e4f399a603a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets
arkts
calcImageDefaultSize
根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 @param imageWHRatio:图片原始宽高比 @param size:窗口大小{with:number,height:number} @returns image.Size
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width = 0 let height = 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 }; }
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#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#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
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width = 0 let height = 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 }; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L113-L125
128ea1c984c389cb8edc4dbd4bbbc5da5aa893b7
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isSet
检查是否为Set类型。 @param value @returns
static isSet(value: Object): boolean { return new util.types().isSet(value); }
AST#method_declaration#Left static isSet AST#parameter_list#Left ( AST#parameter#Left value : 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left util AST#expression#Right AST#new_expression#Right AST#expression#Right . types AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . isSet AST#member_expression#Right 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static isSet(value: Object): boolean { return new util.types().isSet(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L116-L118
672c0d85740618ac66989d8159528bca6e24a64c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
release
释放朗读控件的所有资源。 @returns
static async release(): Promise<void> { return TextReader.release(); }
AST#method_declaration#Left static async release AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TextReader 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async release(): Promise<void> { return TextReader.release(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L85-L87
572459a1b6be7d9919b1e961e963659478f77874
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AddBill.ets
arkts
NumberButton
数字按钮组件
@Builder NumberButton(text: string) { Column() { Text(text) .fontSize(20) .fontColor('#333333') .fontWeight(FontWeight.Medium) } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1, right: 1 }, color: '#D0D0D0' }) .onClick(() => { if (text === '今天') { // 设置今天的日期 this.selectedDate = this.getTodayDate(); } else if (text === '+' || text === '-') { // 加减功能待实现 } else { this.amount += text; } }) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NumberButton AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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 text AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#333333' AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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 '25%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 55 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#FFFFFF' 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 . 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 top AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 1 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 '#D0D0D0' 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left text 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedDate 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 . getTodayDate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left text AST#expression#Right === AST#expression#Left '+' AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left text AST#expression#Right === AST#expression#Left '-' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 加减功能待实现 } 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 . amount AST#member_expression#Right += AST#expression#Left text 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#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#builder_function_body#Right AST#method_declaration#Right
@Builder NumberButton(text: string) { Column() { Text(text) .fontSize(20) .fontColor('#333333') .fontWeight(FontWeight.Medium) } .width('25%') .height(55) .backgroundColor('#FFFFFF') .justifyContent(FlexAlign.Center) .border({ width: { top: 1, right: 1 }, color: '#D0D0D0' }) .onClick(() => { if (text === '今天') { this.selectedDate = this.getTodayDate(); } else if (text === '+' || text === '-') { } else { this.amount += text; } }) }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L307-L330
31970bf7b3b16ad90430b883625216b67dd4ab4d
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.DialogV2.d.ets
arkts
Declare the options of AdvancedDialogV2Button @interface AdvancedDialogV2ButtonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare interface AdvancedDialogV2ButtonOptions { /** * Sets the Display Content of a Button. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ content: ResourceStr; /** * Sets the Button Callback. * * @type { ?AdvancedDialogV2ButtonAction }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ action?: AdvancedDialogV2ButtonAction; /** * Sets the background color of a button. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ background?: ColorMetrics; /** * Sets the Button Text Color. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ fontColor?: ColorMetrics; /** * Describes the Button style. * * @type { ?ButtonStyleMode } * @default ButtonStyleMode.TEXTUAL * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ buttonStyle?: ButtonStyleMode; /** * Describes the Button role. * * @type { ?ButtonRole } * @default ButtonRole.NORMAL * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ role?: ButtonRole; /** * Set the default focus of a button. * * @type { ?boolean } * @default { false } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ defaultFocus?: boolean; /** * Set the availability of the button. * * @type { ?boolean } * @default { true } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ enabled?: boolean; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface AdvancedDialogV2ButtonOptions AST#object_type#Left { /** * Sets the Display Content of a Button. * * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Sets the Button Callback. * * @type { ?AdvancedDialogV2ButtonAction }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left action ? : AST#type_annotation#Left AST#primary_type#Left AdvancedDialogV2ButtonAction AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Sets the background color of a button. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left background ? : AST#type_annotation#Left AST#primary_type#Left ColorMetrics AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Sets the Button Text Color. * * @type { ?ColorMetrics }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left fontColor ? : AST#type_annotation#Left AST#primary_type#Left ColorMetrics AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Describes the Button style. * * @type { ?ButtonStyleMode } * @default ButtonStyleMode.TEXTUAL * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left buttonStyle ? : AST#type_annotation#Left AST#primary_type#Left ButtonStyleMode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Describes the Button role. * * @type { ?ButtonRole } * @default ButtonRole.NORMAL * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left role ? : AST#type_annotation#Left AST#primary_type#Left ButtonRole AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Set the default focus of a button. * * @type { ?boolean } * @default { false } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left defaultFocus ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * Set the availability of the button. * * @type { ?boolean } * @default { true } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 18 */ AST#type_member#Left enabled ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
export declare interface AdvancedDialogV2ButtonOptions { content: ResourceStr; action?: AdvancedDialogV2ButtonAction; background?: ColorMetrics; fontColor?: ColorMetrics; buttonStyle?: ButtonStyleMode; role?: ButtonRole; defaultFocus?: boolean; enabled?: boolean; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.DialogV2.d.ets#L156-L241
e059237587704703b47e9167ddbbd51076aa3f91
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/ui_tools.ets
arkts
Infers the id of window. @param idx The window index (number).
export function window_id_at_index(idx: number) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[idx]; return window_id; }
AST#export_declaration#Left export AST#function_declaration#Left function window_id_at_index AST#parameter_list#Left ( AST#parameter#Left idx : 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#variable_declaration#Left let AST#variable_declarator#Left windowIds = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Right . get AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'windowIds' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left window_id = AST#expression#Left AST#subscript_expression#Left AST#expression#Left windowIds AST#expression#Right [ AST#expression#Left idx 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 window_id AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function window_id_at_index(idx: number) { let windowIds = AppStorage.get('windowIds') as string[]; let window_id = windowIds[idx]; return window_id; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/ui_tools.ets#L522-L526
ace3a743e42db85c74887fc2ed2398f40e9725b5
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.PhotoPickerComponent.d.ets
arkts
saveTrustedPhotoAssets
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#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
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#L324-L325
182ec9ca7ac24bf2caaaedd430679e3ecddd53ce
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/common/utils/AudioService.ets
arkts
getPlayMode
@returns
public getPlayMode() { return this._shareData.playMode; }
AST#method_declaration#Left public getPlayMode AST#parameter_list#Left ( ) 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 this AST#expression#Right . _shareData AST#member_expression#Right AST#expression#Right . playMode AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
public getPlayMode() { return this._shareData.playMode; }
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/utils/AudioService.ets#L49-L51
291edf73b8c029245bc0b64d5922e70b30684b9a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
createDefaultSettings
创建默认设置 @returns 默认设置
private createDefaultSettings(): AppSettings { const now: string = new Date().toISOString(); const defaultThemeSettings: ThemeSettings = { mode: ThemeMode.AUTO, primaryColor: '#007AFF', accentColor: '#FF9500', customColors: {}, animationEnabled: true, animationDuration: 300, fontSize: FontSize.MEDIUM, borderRadius: BorderRadius.MEDIUM, enableDynamicColor: true, enableAnimations: true }; const defaultQuietHours: QuietHoursConfig = { enabled: false, startTime: '22:00', endTime: '08:00' }; const defaultNotificationSettings: NotificationSettings = { enabled: true, methods: [NotificationMethod.PUSH], sound: true, vibration: true, showPreview: true, quietHours: defaultQuietHours }; const defaultReminderSettings: ReminderSettings = { enabled: true, advanceDays: [0, 1, 7], frequency: ReminderFrequency.ONCE, customTime: '09:00', weekendReminder: true, lunarBirthdayReminder: true }; const defaultPrivacySettings: PrivacySettings = { dataEncryption: true, biometricLock: false, autoLockTimeout: 30, anonymousAnalytics: false, crashReporting: true, locationTracking: false, contactSyncEnabled: true, backupToCloud: false, shareUsageData: false, dataCollection: false, analytics: false, locationAccess: false, contactAccess: true }; const defaultAISettings: AISettings = { enabled: true, provider: 'default', personalization: true, responseLength: 'medium', creativity: 0.7, language: Language.ZH_CN, apiProvider: AIProvider.OPENAI, apiKey: '', apiUrl: undefined, model: 'gpt-3.5-turbo', maxTokens: 1000, temperature: 0.7, customPrompt: undefined }; const defaultDataSettings: DataSettings = { autoBackup: true, backupFrequency: BackupFrequency.WEEKLY, backupLocation: BackupLocation.LOCAL, maxBackupFiles: 5, syncEnabled: false, dataRetention: 365, syncConfig: this.createDefaultSyncConfig() }; const defaultSecuritySettings: SecuritySettings = { level: SecurityLevel.MEDIUM, biometricAuth: false, appLock: false, dataEncryption: true, sessionTimeout: 30 }; const defaultAccessibilitySettings: AccessibilitySettings = { highContrast: false, largeText: false, screenReader: false, reducedMotion: false, colorBlindSupport: false }; const defaultLanguageSettings: LanguageSettings = { current: Language.ZH_CN, fallback: Language.EN_US, autoDetect: true }; const result: AppSettings = { version: BusinessConstants.SETTINGS_VERSION, language: defaultLanguageSettings, theme: defaultThemeSettings, notification: defaultNotificationSettings, reminder: defaultReminderSettings, privacy: defaultPrivacySettings, ai: defaultAISettings, data: defaultDataSettings, security: defaultSecuritySettings, accessibility: defaultAccessibilitySettings, createdAt: now, updatedAt: now }; return result; }
AST#method_declaration#Left private createDefaultSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left now : 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 AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toISOString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultThemeSettings : AST#type_annotation#Left AST#primary_type#Left ThemeSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left mode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ThemeMode AST#expression#Right . AUTO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left primaryColor AST#property_name#Right : AST#expression#Left '#007AFF' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left accentColor AST#property_name#Right : AST#expression#Left '#FF9500' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customColors AST#property_name#Right : AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left animationEnabled 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 animationDuration AST#property_name#Right : AST#expression#Left 300 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fontSize AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left FontSize AST#expression#Right . MEDIUM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left borderRadius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BorderRadius AST#expression#Right . MEDIUM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left enableDynamicColor 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 enableAnimations AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultQuietHours : AST#type_annotation#Left AST#primary_type#Left QuietHoursConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enabled 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 startTime AST#property_name#Right : AST#expression#Left '22:00' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left endTime AST#property_name#Right : AST#expression#Left '08:00' AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultNotificationSettings : AST#type_annotation#Left AST#primary_type#Left NotificationSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enabled 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 methods AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left NotificationMethod AST#expression#Right . PUSH 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 sound 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 vibration 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 showPreview 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 quietHours AST#property_name#Right : AST#expression#Left defaultQuietHours AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultReminderSettings : AST#type_annotation#Left AST#primary_type#Left ReminderSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enabled 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 advanceDays AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 7 AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left frequency AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left ReminderFrequency AST#expression#Right . ONCE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customTime AST#property_name#Right : AST#expression#Left '09:00' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weekendReminder 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 lunarBirthdayReminder AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultPrivacySettings : AST#type_annotation#Left AST#primary_type#Left PrivacySettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dataEncryption 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 biometricLock 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 autoLockTimeout AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left anonymousAnalytics 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 crashReporting 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 locationTracking 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 contactSyncEnabled 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 backupToCloud 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 shareUsageData 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 dataCollection 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 analytics 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 locationAccess 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 contactAccess AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultAISettings : AST#type_annotation#Left AST#primary_type#Left AISettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left enabled 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 provider AST#property_name#Right : AST#expression#Left 'default' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left personalization 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 responseLength AST#property_name#Right : AST#expression#Left 'medium' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left creativity AST#property_name#Right : AST#expression#Left 0.7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left language AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Language AST#expression#Right . ZH_CN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiProvider AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AIProvider AST#expression#Right . OPENAI AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiKey AST#property_name#Right : AST#expression#Left '' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left apiUrl AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left model AST#property_name#Right : AST#expression#Left 'gpt-3.5-turbo' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxTokens AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left temperature AST#property_name#Right : AST#expression#Left 0.7 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customPrompt AST#property_name#Right : AST#expression#Left undefined AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultDataSettings : AST#type_annotation#Left AST#primary_type#Left DataSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left autoBackup 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 backupFrequency AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BackupFrequency AST#expression#Right . WEEKLY AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backupLocation AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BackupLocation AST#expression#Right . LOCAL AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left maxBackupFiles AST#property_name#Right : AST#expression#Left 5 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left syncEnabled 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 dataRetention AST#property_name#Right : AST#expression#Left 365 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left syncConfig AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createDefaultSyncConfig AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultSecuritySettings : AST#type_annotation#Left AST#primary_type#Left SecuritySettings 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 SecurityLevel AST#expression#Right . MEDIUM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left biometricAuth 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 appLock 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 dataEncryption 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 sessionTimeout AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultAccessibilitySettings : AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left highContrast 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 largeText 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 screenReader 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 reducedMotion 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 colorBlindSupport AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultLanguageSettings : AST#type_annotation#Left AST#primary_type#Left LanguageSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left current AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Language AST#expression#Right . ZH_CN AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left fallback AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Language AST#expression#Right . EN_US AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left autoDetect AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left version AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left BusinessConstants AST#expression#Right . SETTINGS_VERSION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left language AST#property_name#Right : AST#expression#Left defaultLanguageSettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left theme AST#property_name#Right : AST#expression#Left defaultThemeSettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left notification AST#property_name#Right : AST#expression#Left defaultNotificationSettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reminder AST#property_name#Right : AST#expression#Left defaultReminderSettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left privacy AST#property_name#Right : AST#expression#Left defaultPrivacySettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left ai AST#property_name#Right : AST#expression#Left defaultAISettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left defaultDataSettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left security AST#property_name#Right : AST#expression#Left defaultSecuritySettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left accessibility AST#property_name#Right : AST#expression#Left defaultAccessibilitySettings AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left createdAt AST#property_name#Right : AST#expression#Left now AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left updatedAt AST#property_name#Right : AST#expression#Left now 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#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
private createDefaultSettings(): AppSettings { const now: string = new Date().toISOString(); const defaultThemeSettings: ThemeSettings = { mode: ThemeMode.AUTO, primaryColor: '#007AFF', accentColor: '#FF9500', customColors: {}, animationEnabled: true, animationDuration: 300, fontSize: FontSize.MEDIUM, borderRadius: BorderRadius.MEDIUM, enableDynamicColor: true, enableAnimations: true }; const defaultQuietHours: QuietHoursConfig = { enabled: false, startTime: '22:00', endTime: '08:00' }; const defaultNotificationSettings: NotificationSettings = { enabled: true, methods: [NotificationMethod.PUSH], sound: true, vibration: true, showPreview: true, quietHours: defaultQuietHours }; const defaultReminderSettings: ReminderSettings = { enabled: true, advanceDays: [0, 1, 7], frequency: ReminderFrequency.ONCE, customTime: '09:00', weekendReminder: true, lunarBirthdayReminder: true }; const defaultPrivacySettings: PrivacySettings = { dataEncryption: true, biometricLock: false, autoLockTimeout: 30, anonymousAnalytics: false, crashReporting: true, locationTracking: false, contactSyncEnabled: true, backupToCloud: false, shareUsageData: false, dataCollection: false, analytics: false, locationAccess: false, contactAccess: true }; const defaultAISettings: AISettings = { enabled: true, provider: 'default', personalization: true, responseLength: 'medium', creativity: 0.7, language: Language.ZH_CN, apiProvider: AIProvider.OPENAI, apiKey: '', apiUrl: undefined, model: 'gpt-3.5-turbo', maxTokens: 1000, temperature: 0.7, customPrompt: undefined }; const defaultDataSettings: DataSettings = { autoBackup: true, backupFrequency: BackupFrequency.WEEKLY, backupLocation: BackupLocation.LOCAL, maxBackupFiles: 5, syncEnabled: false, dataRetention: 365, syncConfig: this.createDefaultSyncConfig() }; const defaultSecuritySettings: SecuritySettings = { level: SecurityLevel.MEDIUM, biometricAuth: false, appLock: false, dataEncryption: true, sessionTimeout: 30 }; const defaultAccessibilitySettings: AccessibilitySettings = { highContrast: false, largeText: false, screenReader: false, reducedMotion: false, colorBlindSupport: false }; const defaultLanguageSettings: LanguageSettings = { current: Language.ZH_CN, fallback: Language.EN_US, autoDetect: true }; const result: AppSettings = { version: BusinessConstants.SETTINGS_VERSION, language: defaultLanguageSettings, theme: defaultThemeSettings, notification: defaultNotificationSettings, reminder: defaultReminderSettings, privacy: defaultPrivacySettings, ai: defaultAISettings, data: defaultDataSettings, security: defaultSecuritySettings, accessibility: defaultAccessibilitySettings, createdAt: now, updatedAt: now }; return result; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L632-L752
b4b354e1beb948516bef8308057b627f188f3451
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
窗口呈现
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent( "pages/Index", (err) => { if (err.code) { return; } }); }
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 windowStage AST#expression#Right . loadContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "pages/Index" AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent( "pages/Index", (err) => { if (err.code) { return; } }); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/example/Wechat/entry/src/main/ets/entryability/EntryAbility.ets#L17-L24
aefd938924f379ee340901359ba49f211d841ede
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
convertSM2PriKey
将服务器端生成的16进制的长度为64位的C1C3C2格式的SM2私钥转换为前端所需的ASN.1格式SM2私钥字符串 @param priKey 16进制的64位的私钥字符串 @returns 转换后的私钥字符串
static async convertSM2PriKey(priKey: string): Promise<string> { if (priKey.length != 64) { return '服务器端SM2私钥长度不正确~'; } //构建SM2私钥参数对象 let keyPair: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), algName: 'SM2', sk: BigInt('0x' + priKey), specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC } //创建密钥生成器 let keyPairGenerator = await cryptoFramework.createAsyKeyGeneratorBySpec(keyPair); //生成uint8Array格式密钥 let unit8PriKey = await keyPairGenerator.generatePriKey(); //转换成鸿蒙所需私钥字符串 return StrAndUintUtil.unitArray2String(unit8PriKey.getEncoded().data); }
AST#method_declaration#Left static async convertSM2PriKey AST#parameter_list#Left ( AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left priKey AST#expression#Right . length AST#member_expression#Right AST#expression#Right != AST#expression#Left 64 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 '服务器端SM2私钥长度不正确~' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //构建SM2私钥参数对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPair : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . ECCPriKeySpec 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 params 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 cryptoFramework AST#expression#Right . ECCKeyUtil AST#member_expression#Right AST#expression#Right . genECCCommonParamsSpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'NID_sm2' 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 algName AST#property_name#Right : AST#expression#Left 'SM2' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left sk AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left BigInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '0x' AST#expression#Right + AST#expression#Left priKey AST#expression#Right AST#binary_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 specType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left cryptoFramework AST#expression#Right . AsyKeySpecType AST#member_expression#Right AST#expression#Right . PRIVATE_KEY_SPEC 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#variable_declaration#Left let AST#variable_declarator#Left keyPairGenerator = 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 cryptoFramework AST#expression#Right AST#await_expression#Right AST#expression#Right . createAsyKeyGeneratorBySpec AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyPair 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 //生成uint8Array格式密钥 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left unit8PriKey = 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 keyPairGenerator AST#expression#Right AST#await_expression#Right AST#expression#Right . generatePriKey AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //转换成鸿蒙所需私钥字符串 AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left unit8PriKey AST#expression#Right . getEncoded AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . data AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static async convertSM2PriKey(priKey: string): Promise<string> { if (priKey.length != 64) { return '服务器端SM2私钥长度不正确~'; } let keyPair: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), algName: 'SM2', sk: BigInt('0x' + priKey), specType: cryptoFramework.AsyKeySpecType.PRIVATE_KEY_SPEC } let keyPairGenerator = await cryptoFramework.createAsyKeyGeneratorBySpec(keyPair); let unit8PriKey = await keyPairGenerator.generatePriKey(); return StrAndUintUtil.unitArray2String(unit8PriKey.getEncoded().data); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L113-L130
f7230796b1483b2291291a2f05ca27cf48564db0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
transform
V1新老版本字段转换逻辑 @param resultSet 查询结果集 @param targetVersion 目标版本 @returns 目标版本格式数据
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: return this.transformV1ToV2(resultSet); case Constants.V3: return this.transformV1ToV3(resultSet); default: { throw new Error('The database version to which you need to upgrade is incorrect'); }
AST#method_declaration#Left transform AST#parameter_list#Left ( AST#parameter#Left resultSet : 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#Left targetVersion : 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 ValuesBucket AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ( AST#expression#Left targetVersion AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . V2 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . transformV1ToV2 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left case AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . V3 AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#ERROR#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . transformV1ToV3 AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left resultSet AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left default AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : { AST#ERROR#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 'The database version to which you need to upgrade is incorrect' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { switch (targetVersion) { case Constants.V2: return this.transformV1ToV2(resultSet); case Constants.V3: return this.transformV1ToV3(resultSet); default: { throw new Error('The database version to which you need to upgrade is incorrect'); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L96-L104
76cc690d1f1d0358e72fd0c3c2666b122c7bed22
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/DateHelper.ets
arkts
hasMinute
是否含有分
static hasMinute(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.Hms || type == DateType.Hm || type == DateType.Ms; }
AST#method_declaration#Left static hasMinute AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DateType 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#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 AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right . YmdHms AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . YmdHm AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Hms AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Hm AST#member_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left type AST#expression#Right == AST#expression#Left DateType AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . Ms AST#member_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
static hasMinute(type: DateType): boolean { return type == DateType.YmdHms || type == DateType.YmdHm || type == DateType.Hms || type == DateType.Hm || type == DateType.Ms; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/DateHelper.ets#L78-L81
b21ede6f2c060f471fee19d54d24ac23a8788303
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets
arkts
常量
export default class Constants { // 月份数组 public static readonly MONTHS: string[] = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']; // 星期 public static readonly WEEKS: string[] = ['日', '一', '二', '三', '四', '五', '六']; // 农历月份的中文表示 public static readonly CHINESE_MONTH: string[] = ['正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '腊']; // 农历日期的中文表示 public static readonly CHINESE_DAY: string[] = ['初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十']; // 一天的总毫秒数。1000 * 60 * 60 * 24 public static readonly TOTAL_MILLISECONDS_IN_DAY: number = 86400000; // 一周的天数 public static readonly DAYS_IN_WEEK: number = 7; // 公历字体大小 public static readonly DAY_FONT_SIZE: number = 16; // 农历字体大小 public static readonly LUNAR_DAY_FONT_SIZE: number = 10; // 星期字体大小 public static readonly WEEK_FONT_SIZE: number = 10; // 年月信息字体大小 public static readonly YEAR_MONTH_FONT_SIZE: number = 18; // 字体倍数 public static readonly FONT_MULTIPLIER: number = 1; // 选中日期边框宽度 public static readonly SELECT_DATE_BORDER_WIDTH: number = 1; // 默认值 public static readonly DEFAULT: number = 0; // 一年12个月 public static readonly MONTHS_NUM: number = 12; // 字体粗细设置 public static readonly FONT_WEIGHT_FIVE_HUNDRED: number = 500; public static readonly FONT_WEIGHT_EIGHT_HUNDRED: number = 800; // 今天日期 public static readonly TODAY: number = new Date().getDate(); // 本月 public static readonly TODAY_MONTH: number = new Date().getMonth() + 1; // 本年 public static readonly TODAY_YEAR: number = new Date().getFullYear(); // 年视图宽度 public static readonly YEAR_VIEW_WIDTH: number | string = '100%'; // 年视图高度 public static readonly YEAR_VIEW_HEIGHT: number | string = 650; // 月视图宽度 public static readonly MONTH_VIEW_WIDTH: number | string = '100%'; // 月视图高度 public static readonly MONTH_VIEW_HEIGHT: number | string = 400; // 周视图宽度 public static readonly WEEK_VIEW_WIDTH: number | string = '100%'; // 周视图高度 public static readonly WEEK_VIEW_HEIGHT: number | string = 120; // 日程点直径 public static readonly SCHEDULE_POINT_DIAMETER: number = 5; // 年视图字体颜色灰色 public static readonly YEAR_VIEW_FONT_COLOR: string = '#7e7e7e'; // 日程提醒时间选项 public static readonly REMINDER_TIME_OPTION: string[] = ['准时', '1分钟前', '5分钟前', '30分钟前', '1小时前']; // 年视图月份字体大小,粗细 public static readonly YEAR_VIEW_MONTH_FONT: string[] = ['60px 500', '70px 500', '25px 400']; // 年视图星期字体大小 public static readonly YEAR_VIEW_WEEK_FONT: string[] = ['35px', '45px', '20px']; // 年视图日期字体大小,粗细 public static readonly YEAR_VIEW_DAY_FONT: string[] = ['30px 400', '40px 400', '16px 400']; // 年视图下滑线 public static readonly YEAR_VIEW_UNDERLINE: string[] = ['80px', '100px', '40px']; // 年视图月份高度 public static readonly YEAR_VIEW_MONTH_HEIGHT: number[] = [20, 20, 15]; // 年视图星期,日期水平绘制偏移量 public static readonly YEAR_VIEW_HORIZONTAL_OFFSET: number[] = [15, 30, 20]; // 年视图日期垂直绘制偏移量 public static readonly YEAR_VIEW_VERTICAL_OFFSET: number[] = [18, 18, 20]; // 年视图星期初始高度 public static readonly YEAR_VIEW_WEEK_HEIGHT: number[] = [40, 40, 33]; // 年视图日期初始垂直绘制高度 public static readonly YEAR_VIEW_DAY_HEIGHT: number[] = [58, 58, 58]; // 年视图今天日期的圆半径 public static readonly YEAR_VIEW_TODAY_RADIUS: number[] = [6, 9, 7]; // 年视图今天日期的圆的弧线的终止弧度 public static readonly YEAR_VIEW_TODAY_END_ANGLE: number[] = [6.28, 6.28, 6.28]; // 年视图月数据的x轴初始值 public static readonly YEAR_VIEW_INIT_THREE: number[] = [3, 3, 3]; // 年视图今天日期的圆x轴位置微调 public static readonly YEAR_VIEW_X_AXIS: number[] = [0, 2, 1]; // 年视图今天日期的圆y轴位置微调 public static readonly YEAR_VIEW_Y_AXIS: number[] = [0, 1, 0]; }
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 月份数组 AST#property_declaration#Left public static readonly MONTHS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '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#expression#Left '10月' AST#expression#Right , AST#expression#Left '11月' AST#expression#Right , AST#expression#Left '12月' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 星期 AST#property_declaration#Left public static readonly WEEKS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '日' AST#expression#Right , AST#expression#Left '一' AST#expression#Right , AST#expression#Left '二' AST#expression#Right , AST#expression#Left '三' AST#expression#Right , AST#expression#Left '四' AST#expression#Right , AST#expression#Left '五' AST#expression#Right , AST#expression#Left '六' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 农历月份的中文表示 AST#property_declaration#Left public static readonly CHINESE_MONTH : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '正' AST#expression#Right , AST#expression#Left '二' AST#expression#Right , AST#expression#Left '三' AST#expression#Right , AST#expression#Left '四' AST#expression#Right , AST#expression#Left '五' AST#expression#Right , AST#expression#Left '六' AST#expression#Right , AST#expression#Left '七' AST#expression#Right , AST#expression#Left '八' AST#expression#Right , AST#expression#Left '九' AST#expression#Right , AST#expression#Left '十' AST#expression#Right , AST#expression#Left '十一' AST#expression#Right , AST#expression#Left '腊' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 农历日期的中文表示 AST#property_declaration#Left public static readonly CHINESE_DAY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '初一' AST#expression#Right , AST#expression#Left '初二' AST#expression#Right , AST#expression#Left '初三' AST#expression#Right , AST#expression#Left '初四' AST#expression#Right , AST#expression#Left '初五' AST#expression#Right , AST#expression#Left '初六' AST#expression#Right , AST#expression#Left '初七' AST#expression#Right , AST#expression#Left '初八' AST#expression#Right , AST#expression#Left '初九' AST#expression#Right , AST#expression#Left '初十' AST#expression#Right , AST#expression#Left '十一' AST#expression#Right , AST#expression#Left '十二' AST#expression#Right , AST#expression#Left '十三' AST#expression#Right , AST#expression#Left '十四' AST#expression#Right , AST#expression#Left '十五' AST#expression#Right , AST#expression#Left '十六' AST#expression#Right , AST#expression#Left '十七' AST#expression#Right , AST#expression#Left '十八' AST#expression#Right , AST#expression#Left '十九' AST#expression#Right , AST#expression#Left '二十' AST#expression#Right , AST#expression#Left '廿一' AST#expression#Right , AST#expression#Left '廿二' AST#expression#Right , AST#expression#Left '廿三' AST#expression#Right , AST#expression#Left '廿四' AST#expression#Right , AST#expression#Left '廿五' AST#expression#Right , AST#expression#Left '廿六' AST#expression#Right , AST#expression#Left '廿七' AST#expression#Right , AST#expression#Left '廿八' AST#expression#Right , AST#expression#Left '廿九' AST#expression#Right , AST#expression#Left '三十' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 一天的总毫秒数。1000 * 60 * 60 * 24 AST#property_declaration#Left public static readonly TOTAL_MILLISECONDS_IN_DAY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 86400000 AST#expression#Right ; AST#property_declaration#Right // 一周的天数 AST#property_declaration#Left public static readonly DAYS_IN_WEEK : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 7 AST#expression#Right ; AST#property_declaration#Right // 公历字体大小 AST#property_declaration#Left public static readonly DAY_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 LUNAR_DAY_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right // 星期字体大小 AST#property_declaration#Left public static readonly WEEK_FONT_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#Right ; AST#property_declaration#Right // 年月信息字体大小 AST#property_declaration#Left public static readonly YEAR_MONTH_FONT_SIZE : 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 public static readonly FONT_MULTIPLIER : 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 SELECT_DATE_BORDER_WIDTH : 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 DEFAULT : 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 // 一年12个月 AST#property_declaration#Left public static readonly MONTHS_NUM : 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 FONT_WEIGHT_FIVE_HUNDRED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public static readonly FONT_WEIGHT_EIGHT_HUNDRED : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 800 AST#expression#Right ; AST#property_declaration#Right // 今天日期 AST#property_declaration#Left public static readonly TODAY : 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getDate 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 public static readonly TODAY_MONTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getMonth 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 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#property_declaration#Right // 本年 AST#property_declaration#Left public static readonly TODAY_YEAR : 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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getFullYear 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 public static readonly YEAR_VIEW_WIDTH : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right // 年视图高度 AST#property_declaration#Left public static readonly YEAR_VIEW_HEIGHT : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 650 AST#expression#Right ; AST#property_declaration#Right // 月视图宽度 AST#property_declaration#Left public static readonly MONTH_VIEW_WIDTH : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right // 月视图高度 AST#property_declaration#Left public static readonly MONTH_VIEW_HEIGHT : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 400 AST#expression#Right ; AST#property_declaration#Right // 周视图宽度 AST#property_declaration#Left public static readonly WEEK_VIEW_WIDTH : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right // 周视图高度 AST#property_declaration#Left public static readonly WEEK_VIEW_HEIGHT : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left 120 AST#expression#Right ; AST#property_declaration#Right // 日程点直径 AST#property_declaration#Left public static readonly SCHEDULE_POINT_DIAMETER : 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 YEAR_VIEW_FONT_COLOR : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#7e7e7e' AST#expression#Right ; AST#property_declaration#Right // 日程提醒时间选项 AST#property_declaration#Left public static readonly REMINDER_TIME_OPTION : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '准时' AST#expression#Right , AST#expression#Left '1分钟前' AST#expression#Right , AST#expression#Left '5分钟前' AST#expression#Right , AST#expression#Left '30分钟前' AST#expression#Right , AST#expression#Left '1小时前' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图月份字体大小,粗细 AST#property_declaration#Left public static readonly YEAR_VIEW_MONTH_FONT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '60px 500' AST#expression#Right , AST#expression#Left '70px 500' AST#expression#Right , AST#expression#Left '25px 400' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图星期字体大小 AST#property_declaration#Left public static readonly YEAR_VIEW_WEEK_FONT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '35px' AST#expression#Right , AST#expression#Left '45px' AST#expression#Right , AST#expression#Left '20px' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图日期字体大小,粗细 AST#property_declaration#Left public static readonly YEAR_VIEW_DAY_FONT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '30px 400' AST#expression#Right , AST#expression#Left '40px 400' AST#expression#Right , AST#expression#Left '16px 400' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图下滑线 AST#property_declaration#Left public static readonly YEAR_VIEW_UNDERLINE : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left '80px' AST#expression#Right , AST#expression#Left '100px' AST#expression#Right , AST#expression#Left '40px' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图月份高度 AST#property_declaration#Left public static readonly YEAR_VIEW_MONTH_HEIGHT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 20 AST#expression#Right , AST#expression#Left 20 AST#expression#Right , AST#expression#Left 15 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图星期,日期水平绘制偏移量 AST#property_declaration#Left public static readonly YEAR_VIEW_HORIZONTAL_OFFSET : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 15 AST#expression#Right , AST#expression#Left 30 AST#expression#Right , AST#expression#Left 20 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图日期垂直绘制偏移量 AST#property_declaration#Left public static readonly YEAR_VIEW_VERTICAL_OFFSET : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 18 AST#expression#Right , AST#expression#Left 18 AST#expression#Right , AST#expression#Left 20 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图星期初始高度 AST#property_declaration#Left public static readonly YEAR_VIEW_WEEK_HEIGHT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 40 AST#expression#Right , AST#expression#Left 40 AST#expression#Right , AST#expression#Left 33 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图日期初始垂直绘制高度 AST#property_declaration#Left public static readonly YEAR_VIEW_DAY_HEIGHT : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 58 AST#expression#Right , AST#expression#Left 58 AST#expression#Right , AST#expression#Left 58 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图今天日期的圆半径 AST#property_declaration#Left public static readonly YEAR_VIEW_TODAY_RADIUS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 6 AST#expression#Right , AST#expression#Left 9 AST#expression#Right , AST#expression#Left 7 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图今天日期的圆的弧线的终止弧度 AST#property_declaration#Left public static readonly YEAR_VIEW_TODAY_END_ANGLE : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 6.28 AST#expression#Right , AST#expression#Left 6.28 AST#expression#Right , AST#expression#Left 6.28 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图月数据的x轴初始值 AST#property_declaration#Left public static readonly YEAR_VIEW_INIT_THREE : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 3 AST#expression#Right , AST#expression#Left 3 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图今天日期的圆x轴位置微调 AST#property_declaration#Left public static readonly YEAR_VIEW_X_AXIS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 1 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 年视图今天日期的圆y轴位置微调 AST#property_declaration#Left public static readonly YEAR_VIEW_Y_AXIS : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export default class Constants { public static readonly MONTHS: string[] = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']; public static readonly WEEKS: string[] = ['日', '一', '二', '三', '四', '五', '六']; public static readonly CHINESE_MONTH: string[] = ['正', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '腊']; public static readonly CHINESE_DAY: string[] = ['初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十']; public static readonly TOTAL_MILLISECONDS_IN_DAY: number = 86400000; public static readonly DAYS_IN_WEEK: number = 7; public static readonly DAY_FONT_SIZE: number = 16; public static readonly LUNAR_DAY_FONT_SIZE: number = 10; 字体大小 public static readonly WEEK_FONT_SIZE: number = 10; public static readonly YEAR_MONTH_FONT_SIZE: number = 18; public static readonly FONT_MULTIPLIER: number = 1; public static readonly SELECT_DATE_BORDER_WIDTH: number = 1; public static readonly DEFAULT: number = 0; public static readonly MONTHS_NUM: number = 12; public static readonly FONT_WEIGHT_FIVE_HUNDRED: number = 500; public static readonly FONT_WEIGHT_EIGHT_HUNDRED: number = 800; public static readonly TODAY: number = new Date().getDate(); public static readonly TODAY_MONTH: number = new Date().getMonth() + 1; public static readonly TODAY_YEAR: number = new Date().getFullYear(); public static readonly YEAR_VIEW_WIDTH: number | string = '100%'; public static readonly YEAR_VIEW_HEIGHT: number | string = 650; public static readonly MONTH_VIEW_WIDTH: number | string = '100%'; public static readonly MONTH_VIEW_HEIGHT: number | string = 400; public static readonly WEEK_VIEW_WIDTH: number | string = '100%'; public static readonly WEEK_VIEW_HEIGHT: number | string = 120; public static readonly SCHEDULE_POINT_DIAMETER: number = 5; public static readonly YEAR_VIEW_FONT_COLOR: string = '#7e7e7e'; public static readonly REMINDER_TIME_OPTION: string[] = ['准时', '1分钟前', '5分钟前', '30分钟前', '1小时前']; public static readonly YEAR_VIEW_MONTH_FONT: string[] = ['60px 500', '70px 500', '25px 400']; public static readonly YEAR_VIEW_WEEK_FONT: string[] = ['35px', '45px', '20px']; public static readonly YEAR_VIEW_DAY_FONT: string[] = ['30px 400', '40px 400', '16px 400']; public static readonly YEAR_VIEW_UNDERLINE: string[] = ['80px', '100px', '40px']; public static readonly YEAR_VIEW_MONTH_HEIGHT: number[] = [20, 20, 15]; public static readonly YEAR_VIEW_HORIZONTAL_OFFSET: number[] = [15, 30, 20]; public static readonly YEAR_VIEW_VERTICAL_OFFSET: number[] = [18, 18, 20]; public static readonly YEAR_VIEW_WEEK_HEIGHT: number[] = [40, 40, 33]; public static readonly YEAR_VIEW_DAY_HEIGHT: number[] = [58, 58, 58]; public static readonly YEAR_VIEW_TODAY_RADIUS: number[] = [6, 9, 7]; public static readonly YEAR_VIEW_TODAY_END_ANGLE: number[] = [6.28, 6.28, 6.28]; public static readonly YEAR_VIEW_INIT_THREE: number[] = [3, 3, 3]; public static readonly YEAR_VIEW_X_AXIS: number[] = [0, 2, 1]; public static readonly YEAR_VIEW_Y_AXIS: number[] = [0, 1, 0]; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/constant/Constants.ets#L19-L108
b48592aff358a41f85525d98c77df788a73873f2
gitee
qwerguai/ArkTSComponents.git
58ac77d9686670d79ba7421d71e68f31870aacd5
entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSettingListData
Get data of the setting list. @return {Array<PageResource>} settingListData.
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r('app.media.news'), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_menu'), $r('app.media.menu')), new ItemData($r('app.string.setting_list_storage'), $r('app.media.storage')), new ItemData($r('app.string.setting_list_privacy'), $r('app.media.privacy')) ]; return settingListData; }
AST#method_declaration#Left getSettingListData 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 ItemData 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 settingListData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ItemData [ ] 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 ItemData 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.string.setting_list_news' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.news' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.setting_toggle" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ItemData 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.string.setting_list_menu' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.menu' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ItemData 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.string.setting_list_storage' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.storage' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ItemData 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.string.setting_list_privacy' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.privacy' AST#expression#Right ) AST#resource_expression#Right 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#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left settingListData AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r('app.media.news'), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_menu'), $r('app.media.menu')), new ItemData($r('app.string.setting_list_storage'), $r('app.media.storage')), new ItemData($r('app.string.setting_list_privacy'), $r('app.media.privacy')) ]; return settingListData; }
https://github.com/qwerguai/ArkTSComponents.git/blob/58ac77d9686670d79ba7421d71e68f31870aacd5/entry/src/main/ets/viewmodel/MainViewModel.ets#L79-L87
b9164848c609bb63f77b6430b714d68d2c8d02a5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/social/SearchPage.ets
arkts
buildSearchTypes
构建搜索类型选择
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width('16vp') .height('16vp') .fillColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) Text(type.label) .fontSize(12) .fontColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) .fontWeight(this.selectedType === type.type ? FontWeight.Medium : FontWeight.Normal) Text(this.getTypeCount(type.type).toString()) .fontSize(10) .fontColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) .padding({ left: 4, right: 4, top: 2, bottom: 2 }) .backgroundColor(this.selectedType === type.type ? $r('app.color.primary_background') : $r('app.color.surface')) .borderRadius(8) } if (this.selectedType === type.type) { Divider() .width('40vp') .height('2vp') .color($r('app.color.primary')) } } .width('80vp') .height('50vp') .justifyContent(FlexAlign.Center) .onClick(() => { this.selectedType = type.type; }) }) } .padding({ left: 8, right: 8 }) } .scrollable(ScrollDirection.Horizontal) .scrollBar(BarState.Off) .width('100%') .backgroundColor(Color.White) .margin({ top: 1 }) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSearchTypes AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . hasSearched AST#member_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 Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . searchTypes AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left type AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 4 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left AST#template_literal#Left ` app.media.ic_ AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left type AST#expression#Right . icon AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '16vp' AST#expression#Right ) AST#modifier_chain_expression#Left . fillColor ( 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 . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 type AST#expression#Right . label AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 12 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left 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 . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getTypeCount AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left type AST#expression#Right . type 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#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 10 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( 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 . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary_background' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.surface' 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 8 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedType AST#member_expression#Right AST#expression#Right === AST#expression#Left type AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_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 . width ( AST#expression#Left '40vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '2vp' AST#expression#Right ) AST#modifier_chain_expression#Left . color ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '80vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '50vp' AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left type AST#expression#Right . type AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left 8 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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . scrollable ( AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollDirection AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . scrollBar ( AST#expression#Left AST#member_expression#Left AST#expression#Left BarState AST#expression#Right . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildSearchTypes() { if (this.hasSearched) { Scroll() { Row({ space: 0 }) { ForEach(this.searchTypes, (type) => { Column({ space: 4 }) { Row({ space: 4 }) { Image($r(`app.media.ic_${type.icon}`)) .width('16vp') .height('16vp') .fillColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) Text(type.label) .fontSize(12) .fontColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) .fontWeight(this.selectedType === type.type ? FontWeight.Medium : FontWeight.Normal) Text(this.getTypeCount(type.type).toString()) .fontSize(10) .fontColor(this.selectedType === type.type ? $r('app.color.primary') : $r('app.color.text_secondary')) .padding({ left: 4, right: 4, top: 2, bottom: 2 }) .backgroundColor(this.selectedType === type.type ? $r('app.color.primary_background') : $r('app.color.surface')) .borderRadius(8) } if (this.selectedType === type.type) { Divider() .width('40vp') .height('2vp') .color($r('app.color.primary')) } } .width('80vp') .height('50vp') .justifyContent(FlexAlign.Center) .onClick(() => { this.selectedType = type.type; }) }) } .padding({ left: 8, right: 8 }) } .scrollable(ScrollDirection.Horizontal) .scrollBar(BarState.Off) .width('100%') .backgroundColor(Color.White) .margin({ top: 1 }) } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/social/SearchPage.ets#L168-L217
511f3a203e1918e40c57d26c08c1026045b5b44d
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/TextOverflowPage.ets
arkts
publishComment
发布评论
publishComment(): void { // 生成评论id const uuid: string = util.generateRandomUUID(); // 添加一条评论,包含评论id、头像、昵称、回复id、回复昵称、回复文本 const comment: CommentModel = new CommentModel(uuid, $r('app.media.user_select'), this.curUser, this.replyId, this.replyUser, this.textInComment, new Date(), new CommentData()); // 通过回复id获取该评论的父评论 const parentComment = this.commentList.getParentData(this.replyId); // 如果获取到了父评论,则将该评论加到父评论下 if (parentComment) { parentComment.replyList.addDataFirst(comment); } else { // 否则自己作为父评论 this.commentList.addDataFirst(comment); } // 评论完成将回复人信息置空 this.replyId = ""; this.replyUser = ""; // 滑动置顶 if (!parentComment) { this.scroller.scrollToIndex(0, true, ScrollAlign.START); } else { this.scroller.scrollToIndex(this.commentList.indexOf(parentComment), true, ScrollAlign.START) } let newId = this.commentList.getData(0).id; let newId2 = uuid; emitter.emit({ eventId: 0, priority: 0 }, { data: { newId: newId, newId2: newId2 } }) }
AST#method_declaration#Left publishComment 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 { // 生成评论id AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uuid : 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 util AST#expression#Right . generateRandomUUID 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 // 添加一条评论,包含评论id、头像、昵称、回复id、回复昵称、回复文本 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left comment : AST#type_annotation#Left AST#primary_type#Left CommentModel 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 CommentModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uuid AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.user_select' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . curUser AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . replyId AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . replyUser AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textInComment AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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 CommentData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过回复id获取该评论的父评论 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parentComment = 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 . commentList AST#member_expression#Right AST#expression#Right . getParentData 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 . replyId 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 parentComment 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 parentComment AST#expression#Right . replyList AST#member_expression#Right AST#expression#Right . addDataFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left comment AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { // 否则自己作为父评论 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentList AST#member_expression#Right AST#expression#Right . addDataFirst AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left comment 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . replyId AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . replyUser AST#member_expression#Right = AST#expression#Left "" AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 滑动置顶 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left parentComment 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollAlign AST#expression#Right . START AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . scrollToIndex AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentList AST#member_expression#Right AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parentComment AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left ScrollAlign AST#expression#Right . START AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left newId = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . commentList AST#member_expression#Right AST#expression#Right . getData 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 . id 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 newId2 = AST#expression#Left uuid 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 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 newId AST#property_name#Right : AST#expression#Left newId AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left newId2 AST#property_name#Right : AST#expression#Left newId2 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#method_declaration#Right
publishComment(): void { const uuid: string = util.generateRandomUUID(); const comment: CommentModel = new CommentModel(uuid, $r('app.media.user_select'), this.curUser, this.replyId, this.replyUser, this.textInComment, new Date(), new CommentData()); const parentComment = this.commentList.getParentData(this.replyId); if (parentComment) { parentComment.replyList.addDataFirst(comment); } else { this.commentList.addDataFirst(comment); } this.replyId = ""; this.replyUser = ""; if (!parentComment) { this.scroller.scrollToIndex(0, true, ScrollAlign.START); } else { this.scroller.scrollToIndex(this.commentList.indexOf(parentComment), true, ScrollAlign.START) } let newId = this.commentList.getData(0).id; let newId2 = uuid; emitter.emit({ eventId: 0, priority: 0 }, { data: { newId: newId, newId2: newId2 } }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/TextOverflowPage.ets#L80-L113
e19e9519174e842a43cc8fea11d8d54c10d81e82
gitee
iamhyc/Aigis.git
585de9128882d868484438d32832ca9b9b50442d
entry/src/main/ets/crypto/huksUtils.ets
arkts
Key Storage Policy
export const PARAMS_IN_HUKS: PurposeParams = [{ tag: huks.HuksTag.HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG, value: huks.HuksKeyStorageType.HUKS_STORAGE_ONLY_USED_IN_HUKS, }];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PARAMS_IN_HUKS : AST#type_annotation#Left AST#primary_type#Left PurposeParams 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 tag AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksTag AST#member_expression#Right AST#expression#Right . HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left huks AST#expression#Right . HuksKeyStorageType AST#member_expression#Right AST#expression#Right . HUKS_STORAGE_ONLY_USED_IN_HUKS AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const PARAMS_IN_HUKS: PurposeParams = [{ tag: huks.HuksTag.HUKS_TAG_DERIVED_AGREED_KEY_STORAGE_FLAG, value: huks.HuksKeyStorageType.HUKS_STORAGE_ONLY_USED_IN_HUKS, }];
https://github.com/iamhyc/Aigis.git/blob/585de9128882d868484438d32832ca9b9b50442d/entry/src/main/ets/crypto/huksUtils.ets#L53-L56
57d01b5a0a6601861793d34a319fd7fea46d2937
github
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
queryCommodityListById
Query commodity list by id of commodity. @param id id of commodity @returns Commodity
queryCommodityListById(id: string) { const result = commodityData.filter(item => item.id === id)[0]; return result; }
AST#method_declaration#Left queryCommodityListById 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left commodityData AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left item => 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 id AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right [ AST#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#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
queryCommodityListById(id: string) { const result = commodityData.filter(item => item.id === id)[0]; return result; }
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L43-L46
0d6119dfcd25646322951f2ed00baa16b07c55b8
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment2.ets
arkts
[StartExclude Case2]
build() { Column() { } }
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#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() { Column() { } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment2.ets#L46-L49
9dc4ee315a85e76cee36541ccb671790d5fc3ac2
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
TabBarBuilder
构建头部
@Builder TabBarBuilder(title: string, index: number) { Column() { Text(title) .fontSize(16) .fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.currentTabIndex === index ? $r('app.color.primary') : $r('app.color.text_secondary')) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBarBuilder AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left title AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right : AST#expression#Left FontWeight AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentTabIndex AST#member_expression#Right AST#expression#Right === AST#expression#Left index AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder TabBarBuilder(title: string, index: number) { Column() { Text(title) .fontSize(16) .fontWeight(this.currentTabIndex === index ? FontWeight.Bold : FontWeight.Normal) .fontColor(this.currentTabIndex === index ? $r('app.color.primary') : $r('app.color.text_secondary')) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L471-L482
8e390bc47e5ba64baec7b95449af17a96de62b92
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
/ AssetStore 操作结果
export interface AssetStoreResult { isSuccess: boolean; error?: BusinessError; data?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface AssetStoreResult AST#object_type#Left { AST#type_member#Left isSuccess : 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 error ? : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left data ? : 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 AssetStoreResult { isSuccess: boolean; error?: BusinessError; data?: string; }
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L7-L11
e8888b8c8fb0bf7c110db8bb8dc3f560f913fa94
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件。 @param {number} index - 索引值。
notifyDataAdd(index: double): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#method_declaration#Left notifyDataAdd AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left double 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 listener => 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
notifyDataAdd(index: double): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets#L108-L112
ee3f080556387616c48688777614066e25bbc9e3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
notifyDataDelete
Notify the LazyForEach component to remove the child component at the index corresponding to the specified index.
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(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
notifyDataDelete(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataDelete(index); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/model/BasicDataSource.ets#L67-L71
3a286d103bfef6dcc0233fdf30ed585bf2f180a8
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets
arkts
constrainOffset
约束图片偏移,确保不超出视口边界 @param offset -- 当前偏移量 @param winSize -- 视口大小 @param imageSize -- 图片大小 @param scale -- 缩放
function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset); }
AST#function_declaration#Left function constrainOffset 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 winSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left scale : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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 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 winSize AST#expression#Right , AST#expression#Left imageSize AST#expression#Right , AST#expression#Left scale 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 Math AST#expression#Right . min 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 . max AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left offset 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#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left maxAllowedOffset AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
function constrainOffset(offset: number, winSize: number, imageSize: number, scale: number): number { let maxAllowedOffset: number = getMaxAllowedOffset(winSize, imageSize, scale); return Math.min(Math.max(offset, -maxAllowedOffset), maxAllowedOffset); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/utils/Constrain.ets#L77-L80
0b6a322c545add9df5df852b75873128d5d303ca
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets
arkts
getResourceItemAndState
get resource information according to resource id @param index - array position @param count - array length @param data - data
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.getAccessibilityExtensionList('all', 'enable'); for (let serviceInfo of data) { if (!serviceInfo || !serviceInfo.id) { continue; } LogUtil.info(`${MODULE_TAG} extensionService name : ${JSON.stringify(serviceInfo.id)}`); let serviceState: boolean = false; for (let enabledService of enabledServiceList) { if (enabledService.id && enabledService.id === serviceInfo.id) { serviceState = true; break; } } LogUtil.info(`${MODULE_TAG} + ${JSON.stringify(serviceInfo.name)} : ${JSON.stringify(serviceState)}`); let bundleFlag: number = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY; let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfo(serviceInfo.bundleName as string, bundleFlag); imageValue = await this.loadIcon(bundleInfo); description = await this.loadDescription(bundleInfo, serviceInfo.name as string); LogUtil.info(`${MODULE_TAG} getResourceManager getMediaBase64() value: ${imageValue}`); this.serviceInfoList.push({ serviceIcon: imageValue, serviceTitle: serviceInfo.name, serviceArrow: icon_arrow, serviceSummary: description, serviceEndText: serviceState ? $r('app.string.enabled') : $r('app.string.disabled'), serviceState: serviceState, serviceId: serviceInfo.id, serviceBundleName: serviceInfo.bundleName, serviceUri: URI_PAGE, }); } AppStorage.SetOrCreate('extensionServiceManagementList', this.serviceInfoList); LogUtil.info(`${MODULE_TAG} loadExtensionService end`); }
AST#method_declaration#Left async getResourceItemAndState 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 count : 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 AST#array_type#Left serviceInfo [ ] AST#array_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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getIconItem start data.length: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left imageValue = 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 description : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_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 enabledServiceList : 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 accessibility . AccessibilityAbilityInfo 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 AST#await_expression#Left await AST#expression#Left accessibility AST#expression#Right AST#await_expression#Right AST#expression#Right . getAccessibilityExtensionList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'all' AST#expression#Right , AST#expression#Left 'enable' 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#for_statement#Left for ( let serviceInfo of AST#expression#Left data 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#unary_expression#Left ! AST#expression#Left serviceInfo AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left AST#unary_expression#Left ! AST#expression#Left serviceInfo AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#continue_statement#Left continue ; AST#continue_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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right extensionService name : AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left serviceState : 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( let enabledService of AST#expression#Left enabledServiceList 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 enabledService AST#expression#Right . id AST#member_expression#Right AST#expression#Right && AST#expression#Left enabledService AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right === AST#expression#Left serviceInfo AST#expression#Right AST#binary_expression#Right AST#expression#Right . id AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left serviceState = 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#break_statement#Left break ; AST#break_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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG 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 JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . name 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 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 serviceState AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left bundleFlag : 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left bundleManager AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_APPLICATION AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_HAP_MODULE AST#member_expression#Right AST#expression#Right | AST#expression#Left bundleManager AST#expression#Right AST#binary_expression#Right AST#expression#Right . BundleFlag AST#member_expression#Right AST#expression#Right . GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY 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 bundleInfo : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo 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#await_expression#Left await AST#expression#Left bundleManager AST#expression#Right AST#await_expression#Right AST#expression#Right . getBundleInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . bundleName 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#expression#Left bundleFlag 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 imageValue = 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 . loadIcon AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleInfo 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 description = 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 . loadDescription AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left bundleInfo AST#expression#Right , AST#expression#Left AST#as_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . name 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#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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right getResourceManager getMediaBase64() value: AST#template_substitution#Left $ { AST#expression#Left imageValue 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#member_expression#Left AST#expression#Left this AST#expression#Right . serviceInfoList 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 serviceIcon AST#property_name#Right : AST#expression#Left imageValue AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceTitle AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceArrow AST#property_name#Right : AST#expression#Left icon_arrow AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceSummary AST#property_name#Right : AST#expression#Left description AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceEndText AST#property_name#Right : AST#expression#Left AST#conditional_expression#Left AST#expression#Left serviceState AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.enabled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.disabled' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceState AST#property_name#Right : AST#expression#Left serviceState AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceId AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceBundleName AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left serviceInfo AST#expression#Right . bundleName AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left serviceUri AST#property_name#Right : AST#expression#Left URI_PAGE 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#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 AppStorage AST#expression#Right . SetOrCreate AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'extensionServiceManagementList' AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . serviceInfoList 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 LogUtil AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left MODULE_TAG AST#expression#Right } AST#template_substitution#Right loadExtensionService end ` 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#method_declaration#Right
async getResourceItemAndState(index: number, count: number, data: serviceInfo[]) { LogUtil.info(`${MODULE_TAG} getIconItem start data.length: ${data.length}`); let imageValue = ''; let description: ResourceStr; let enabledServiceList: Array<accessibility.AccessibilityAbilityInfo> = await accessibility.getAccessibilityExtensionList('all', 'enable'); for (let serviceInfo of data) { if (!serviceInfo || !serviceInfo.id) { continue; } LogUtil.info(`${MODULE_TAG} extensionService name : ${JSON.stringify(serviceInfo.id)}`); let serviceState: boolean = false; for (let enabledService of enabledServiceList) { if (enabledService.id && enabledService.id === serviceInfo.id) { serviceState = true; break; } } LogUtil.info(`${MODULE_TAG} + ${JSON.stringify(serviceInfo.name)} : ${JSON.stringify(serviceState)}`); let bundleFlag: number = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY; let bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfo(serviceInfo.bundleName as string, bundleFlag); imageValue = await this.loadIcon(bundleInfo); description = await this.loadDescription(bundleInfo, serviceInfo.name as string); LogUtil.info(`${MODULE_TAG} getResourceManager getMediaBase64() value: ${imageValue}`); this.serviceInfoList.push({ serviceIcon: imageValue, serviceTitle: serviceInfo.name, serviceArrow: icon_arrow, serviceSummary: description, serviceEndText: serviceState ? $r('app.string.enabled') : $r('app.string.disabled'), serviceState: serviceState, serviceId: serviceInfo.id, serviceBundleName: serviceInfo.bundleName, serviceUri: URI_PAGE, }); } AppStorage.SetOrCreate('extensionServiceManagementList', this.serviceInfoList); LogUtil.info(`${MODULE_TAG} loadExtensionService end`); }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/model/accessibilityImpl/ExtensionServiceManagementModel.ets#L165-L202
ae3a2ff9e63a36f58bcf4c90d17f916a49981b3d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets
arkts
onPlayingChange
媒体最大音量
onPlayingChange() { this.player.isPlaying ? this.player.getPlay() : this.player.getPause(); if (this.player.isPlaying === false) { PipManager.getInstance().setAutoStart(false); } else { PipManager.getInstance().setAutoStart(true); PipManager.getInstance().updatePiPControlStatus(); } }
AST#method_declaration#Left onPlayingChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left 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 . isPlaying 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#member_expression#Left AST#expression#Left this AST#expression#Right . player AST#member_expression#Right AST#expression#Right . getPlay 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#conditional_expression#Right AST#expression#Right . player AST#member_expression#Right AST#expression#Right . getPause 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . player AST#member_expression#Right AST#expression#Right . isPlaying AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left PipManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setAutoStart 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 } else { 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 PipManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setAutoStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 PipManager AST#expression#Right . getInstance AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . updatePiPControlStatus 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
onPlayingChange() { this.player.isPlaying ? this.player.getPlay() : this.player.getPause(); if (this.player.isPlaying === false) { PipManager.getInstance().setAutoStart(false); } else { PipManager.getInstance().setAutoStart(true); PipManager.getInstance().updatePiPControlStatus(); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/PipWindowComponent.ets#L74-L82
48648b1cbe4de9adea7aa8e8c3abe0e94f8c6d33
gitee
ni202383/Chenguang-Calendar.git
c04543db2c394d662bc1336d098335134ff1e9a5
src/main/ets/pages/WeeklyTaskPage.ets
arkts
buildTaskList
构建任务列表
@Builder buildTaskList() { if (this.weeklyTaskTimeRangeList.length === 0) { this.buildEmptyState() } else { Scroll() { Column() { ForEach(this.weeklyTaskTimeRangeList, (item: TaskTimeRange, index: number) => { TaskTimeRangeItem({ taskItem: item, index: index }) }, (item: TaskTimeRange) => item.id) } } .layoutWeight(1) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTaskList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weeklyTaskTimeRangeList AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildEmptyState 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 } else { 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#member_expression#Left AST#expression#Left this AST#expression#Right . weeklyTaskTimeRangeList 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 TaskTimeRange 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 TaskTimeRangeItem ( AST#component_parameters#Left { AST#component_parameter#Left taskItem : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left index : AST#expression#Left index 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#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 TaskTimeRange AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
@Builder buildTaskList() { if (this.weeklyTaskTimeRangeList.length === 0) { this.buildEmptyState() } else { Scroll() { Column() { ForEach(this.weeklyTaskTimeRangeList, (item: TaskTimeRange, index: number) => { TaskTimeRangeItem({ taskItem: item, index: index }) }, (item: TaskTimeRange) => item.id) } } .layoutWeight(1) } }
https://github.com/ni202383/Chenguang-Calendar.git/blob/c04543db2c394d662bc1336d098335134ff1e9a5/src/main/ets/pages/WeeklyTaskPage.ets#L84-L98
26fe972a793a41ab1fd66f067d135acc7ce7955f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkWebHelper.ets
arkts
putAcceptCookieEnabled
设置WebCookieManager实例是否拥有发送和接收cookie的权限。 @param accept 设置是否拥有发送和接收cookie的权限,默认为true。
static putAcceptCookieEnabled(accept: boolean): void { webview.WebCookieManager.putAcceptCookieEnabled(accept); }
AST#method_declaration#Left static putAcceptCookieEnabled AST#parameter_list#Left ( AST#parameter#Left accept : 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webview AST#expression#Right . WebCookieManager AST#member_expression#Right AST#expression#Right . putAcceptCookieEnabled AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left accept AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
static putAcceptCookieEnabled(accept: boolean): void { webview.WebCookieManager.putAcceptCookieEnabled(accept); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L154-L156
a5d73da85ccab38fd3240a2fffa92b480c510ec9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/ListSceneView.ets
arkts
ListSceneView
列表默认间隔 实现List场景,拖拽交换子组件位置: 通过ListItem的onDragStart()方法指定拖拽开始时的行为,通过List的onTouch()指定拖拽释放时的行为。
@Component export struct ListSceneView { @State dataSource: DataSource = new DataSource(); @State dragIndex: number = 0; aboutToAppear() { for (let index = 0; index < ICON_NUM_IN_LIST; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`), `Item${index + 1}`, true)); } } changeIndex(index1: number, index2: number) { let temp: AppInfo = this.dataSource.getData(index1); this.dataSource.setData(index1, this.dataSource.getData(index2)); this.dataSource.setData(index2, temp); } build() { Column() { Text($r("app.string.drag_and_exchange_list_drag_title")) .fontColor(Color.White) .textAlign(TextAlign.Center) .fontSize($r("app.string.drag_and_exchange_opt_title_font_size")) Row() { // 仅靠List实现背景框,padding调整样式后,互换时可能错位 List({ space: LIST_SPACE }) { // TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料: // https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ LazyForEach(this.dataSource, (item: AppInfo, index) => { ListItem() { Column() { IconNoNameView({ app: item }) } } .onDragStart((event: DragEvent, extraParams: string) => { // TODO:知识点:在ListItem层,通过onDragStart实现拖拽开始时的回调行为 item.visible = false; // 拖拽时,设置子组件原位置图标不可见 // 记录目标位置子组件index值 this.dragIndex = (JSON.parse(extraParams) as JsonObjType).selectedIndex; }) .onDragEnd(() => { item.visible = true; }) }, (item: AppInfo) => item.name.toString()) } .scrollBar(BarState.Off) .height($r("app.string.drag_and_exchange_layout_90")) .listDirection(Axis.Horizontal) .alignListItem(ListItemAlign.Center) .onDrop((event: DragEvent, extraParams: string) => { // TODO:知识点:在List层,通过onDrop实现拖拽结束后的回调行为 let insertIndex: number = (JSON.parse(extraParams) as JsonObjType).insertIndex; // 通过参数extraParams获取原位置子组件index值 if (insertIndex >= this.dataSource.totalCount()) { return; } this.changeIndex(this.dragIndex, insertIndex); // 互换子组件index值 this.dataSource.notifyDataReload(); }) .enableScrollInteraction(false) // 禁用滑动 .alignListItem(ListItemAlign.Center) .padding({ top: $r("app.string.drag_and_exchange_layout_10"), bottom: $r("app.string.drag_and_exchange_layout_10"), left: $r("app.string.drag_and_exchange_layout_15"), right: $r("app.string.drag_and_exchange_layout_15") }) } .justifyContent(FlexAlign.Center) .height($r("app.string.drag_and_exchange_layout_90")) .width($r("app.string.drag_and_exchange_layout_90_percent")) .borderRadius($r("app.string.drag_and_exchange_layout_20")) .opacity($r("app.string.drag_and_exchange_background_opacity")) .backgroundColor($r('app.color.drag_and_exchange_background_color')) } .margin({ top: $r("app.string.drag_and_exchange_layout_20") }) } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListSceneView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right dataSource : AST#type_annotation#Left AST#primary_type#Left DataSource 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 DataSource 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 dragIndex : 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#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = 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 index AST#expression#Right < AST#expression#Left ICON_NUM_IN_LIST AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#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 . dataSource AST#member_expression#Right AST#expression#Right . pushData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left AppInfo 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 AST#template_literal#Left ` app.media.drag_and_exchange_ic_public_game AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Item AST#template_substitution#Left $ { AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right + AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right , AST#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#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#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left changeIndex AST#parameter_list#Left ( AST#parameter#Left index1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index2 : 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#variable_declaration#Left let AST#variable_declarator#Left temp : AST#type_annotation#Left AST#primary_type#Left AppInfo 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 . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index1 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 . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index1 AST#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 . dataSource AST#member_expression#Right AST#expression#Right . getData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . setData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left index2 AST#expression#Right , 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#block_statement#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_list_drag_title" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#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#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_opt_title_font_size" 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 Row ( ) AST#container_content_body#Left { // 仅靠List实现背景框,padding调整样式后,互换时可能错位 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left LIST_SPACE AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { // TODO: 性能知识点:图标一次性完全显示,且禁用滑动,无需懒加载。LazyForEach可以适用在动态添加数据的场景中,参考资料: // https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/lazyforeach_optimization.md/ AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left AppInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index 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 IconNoNameView ( AST#component_parameters#Left { AST#component_parameter#Left app : AST#expression#Left item AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . onDragStart ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left extraParams : 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 { // TODO:知识点:在ListItem层,通过onDragStart实现拖拽开始时的回调行为 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . visible 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 // 拖拽时,设置子组件原位置图标不可见 // 记录目标位置子组件index值 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 . dragIndex AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extraParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JsonObjType AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . selectedIndex 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 . onDragEnd ( 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 item AST#expression#Right . visible AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 AppInfo 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 AST#member_expression#Left AST#expression#Left item AST#expression#Right . name AST#member_expression#Right AST#expression#Right . toString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#lazy_for_each_statement#Right AST#ui_control_flow#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 . Off AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_90" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . listDirection ( AST#expression#Left AST#member_expression#Left AST#expression#Left Axis AST#expression#Right . Horizontal AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDrop ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left DragEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left extraParams : 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 { // TODO:知识点:在List层,通过onDrop实现拖拽结束后的回调行为 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left insertIndex : 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#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left extraParams AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left JsonObjType AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . insertIndex AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 通过参数extraParams获取原位置子组件index值 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left insertIndex AST#expression#Right >= AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . totalCount 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#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 this AST#expression#Right . changeIndex 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 . dragIndex AST#member_expression#Right AST#expression#Right , AST#expression#Left insertIndex AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 互换子组件index值 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 . dataSource AST#member_expression#Right 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#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableScrollInteraction ( AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ) // 禁用滑动 AST#modifier_chain_expression#Left . alignListItem ( AST#expression#Left AST#member_expression#Left AST#expression#Left ListItemAlign AST#expression#Right . Center 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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_10" 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.string.drag_and_exchange_layout_10" 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.string.drag_and_exchange_layout_15" 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.string.drag_and_exchange_layout_15" 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#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_90" 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.drag_and_exchange_layout_90_percent" 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.string.drag_and_exchange_layout_20" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_background_opacity" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.drag_and_exchange_background_color' 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#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 top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.drag_and_exchange_layout_20" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
@Component export struct ListSceneView { @State dataSource: DataSource = new DataSource(); @State dragIndex: number = 0; aboutToAppear() { for (let index = 0; index < ICON_NUM_IN_LIST; index++) { this.dataSource.pushData(new AppInfo($r(`app.media.drag_and_exchange_ic_public_game${index + 1}`), `Item${index + 1}`, true)); } } changeIndex(index1: number, index2: number) { let temp: AppInfo = this.dataSource.getData(index1); this.dataSource.setData(index1, this.dataSource.getData(index2)); this.dataSource.setData(index2, temp); } build() { Column() { Text($r("app.string.drag_and_exchange_list_drag_title")) .fontColor(Color.White) .textAlign(TextAlign.Center) .fontSize($r("app.string.drag_and_exchange_opt_title_font_size")) Row() { List({ space: LIST_SPACE }) { LazyForEach(this.dataSource, (item: AppInfo, index) => { ListItem() { Column() { IconNoNameView({ app: item }) } } .onDragStart((event: DragEvent, extraParams: string) => { item.visible = false; this.dragIndex = (JSON.parse(extraParams) as JsonObjType).selectedIndex; }) .onDragEnd(() => { item.visible = true; }) }, (item: AppInfo) => item.name.toString()) } .scrollBar(BarState.Off) .height($r("app.string.drag_and_exchange_layout_90")) .listDirection(Axis.Horizontal) .alignListItem(ListItemAlign.Center) .onDrop((event: DragEvent, extraParams: string) => { let insertIndex: number = (JSON.parse(extraParams) as JsonObjType).insertIndex; if (insertIndex >= this.dataSource.totalCount()) { return; } this.changeIndex(this.dragIndex, insertIndex); this.dataSource.notifyDataReload(); }) .enableScrollInteraction(false) .alignListItem(ListItemAlign.Center) .padding({ top: $r("app.string.drag_and_exchange_layout_10"), bottom: $r("app.string.drag_and_exchange_layout_10"), left: $r("app.string.drag_and_exchange_layout_15"), right: $r("app.string.drag_and_exchange_layout_15") }) } .justifyContent(FlexAlign.Center) .height($r("app.string.drag_and_exchange_layout_90")) .width($r("app.string.drag_and_exchange_layout_90_percent")) .borderRadius($r("app.string.drag_and_exchange_layout_20")) .opacity($r("app.string.drag_and_exchange_background_opacity")) .backgroundColor($r('app.color.drag_and_exchange_background_color')) } .margin({ top: $r("app.string.drag_and_exchange_layout_20") }) } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/dragandexchange/src/main/ets/view/ListSceneView.ets#L25-L99
e4c346f910c3c26efb9d78bfe9389272c4bd7528
gitee