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
|
frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/collect/nullPage.ets
|
arkts
|
NullPage
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export struct NullPage {
@Prop ratio: number
@Prop str: string
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(this.str)
.fontSize(15 * this.ratio)
.fontColor(Color.Grey)
.margin({ top: 10 })
}
.width('100%')
.height('40%')
.backgroundColor('#dfe5e3')
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NullPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right ratio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right str : AST#type_annotation#Left AST#primary_type#Left string 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 Flex ( AST#component_parameters#Left { AST#component_parameter#Left direction : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexDirection AST#expression#Right . Column AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left justifyContent : AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left alignItems : AST#expression#Left AST#member_expression#Left AST#expression#Left ItemAlign 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 Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . str AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 15 AST#expression#Right * AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . ratio AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Grey AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 '40%' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#dfe5e3' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct NullPage {
@Prop ratio: number
@Prop str: string
build() {
Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(this.str)
.fontSize(15 * this.ratio)
.fontColor(Color.Grey)
.margin({ top: 10 })
}
.width('100%')
.height('40%')
.backgroundColor('#dfe5e3')
}
}
|
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/collect/nullPage.ets#L16-L32
|
289a248c6ee00807fe4b05cce74e9323f120ef17
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
eftool/src/main/ets/device/KvUtil.ets
|
arkts
|
delete
|
删除数据
@param key 删除的key
@returns 结果
|
async delete(key: string): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.delete(key);
return "删除数据:" + key + "成功~";
}
return "用户禁止授权,删除失败~";
}
|
AST#method_declaration#Left async delete AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isAuth = 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 . getAuth 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 isAuth AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . kvStore AST#member_expression#Right AST#expression#Right ?. delete AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left key AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left "删除数据:" AST#expression#Right + AST#expression#Left key AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left "成功~" AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#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
|
async delete(key: string): Promise<string> {
let isAuth = await this.getAuth();
if (isAuth) {
await this.kvStore?.delete(key);
return "删除数据:" + key + "成功~";
}
return "用户禁止授权,删除失败~";
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L140-L147
|
ccafe5df422ebf2ef2fb7f31906ca3ee1023c526
|
gitee
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/models/managers/member/EncourageManager.ets
|
arkts
|
============================================================ EncourageType:激励类型枚举 ============================================================
|
export enum EncourageType {
wordPronRewardAd = "wordPronRewardAd", // 激励广告奖励发音次数
wordPronShareApp = "wordPronShareApp" // 分享应用奖励发音次数
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum EncourageType AST#enum_body#Left { AST#enum_member#Left wordPronRewardAd = AST#expression#Left "wordPronRewardAd" AST#expression#Right AST#enum_member#Right , // 激励广告奖励发音次数 AST#enum_member#Left wordPronShareApp = AST#expression#Left "wordPronShareApp" AST#expression#Right AST#enum_member#Right // 分享应用奖励发音次数 } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum EncourageType {
wordPronRewardAd = "wordPronRewardAd",
wordPronShareApp = "wordPronShareApp"
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L19-L22
|
66f6be9cc1b457082a59046b566a85e44dca2a63
|
github
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets
|
arkts
|
商品列表数据源
|
export const PRODUCT_DATA: Array<ProductDataModel> = [
new ProductDataModel(0, $r("app.media.component_stack_product00"), $r("app.string.component_stack_product_title00"), $r("app.string.component_stack_product_price00"), $r("app.string.component_stack_product_insurance00")),
new ProductDataModel(1, $r("app.media.component_stack_product01"), $r("app.string.component_stack_product_title01"), $r("app.string.component_stack_product_price01"), $r("app.string.component_stack_product_insurance01")),
new ProductDataModel(2, $r("app.media.component_stack_product02"), $r("app.string.component_stack_product_title02"), $r("app.string.component_stack_product_price02"), $r("app.string.component_stack_product_insurance02")),
new ProductDataModel(3, $r("app.media.component_stack_product03"), $r("app.string.component_stack_product_title03"), $r("app.string.component_stack_product_price03"), $r("app.string.component_stack_product_insurance03")),
new ProductDataModel(4, $r("app.media.component_stack_product04"), $r("app.string.component_stack_product_title04"), $r("app.string.component_stack_product_price04"), $r("app.string.component_stack_product_insurance04")),
new ProductDataModel(5, $r("app.media.component_stack_product05"), $r("app.string.component_stack_product_title05"), $r("app.string.component_stack_product_price05"), $r("app.string.component_stack_product_insurance05"))
];
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left PRODUCT_DATA : 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 ProductDataModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product00" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title00" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price00" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance00" 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 ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product01" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title01" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price01" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance01" 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 ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product02" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title02" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price02" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance02" 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 ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product03" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title03" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price03" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance03" 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 ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product04" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title04" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price04" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance04" 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 ProductDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_product05" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_title05" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_price05" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.component_stack_product_insurance05" 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#export_declaration#Right
|
export const PRODUCT_DATA: Array<ProductDataModel> = [
new ProductDataModel(0, $r("app.media.component_stack_product00"), $r("app.string.component_stack_product_title00"), $r("app.string.component_stack_product_price00"), $r("app.string.component_stack_product_insurance00")),
new ProductDataModel(1, $r("app.media.component_stack_product01"), $r("app.string.component_stack_product_title01"), $r("app.string.component_stack_product_price01"), $r("app.string.component_stack_product_insurance01")),
new ProductDataModel(2, $r("app.media.component_stack_product02"), $r("app.string.component_stack_product_title02"), $r("app.string.component_stack_product_price02"), $r("app.string.component_stack_product_insurance02")),
new ProductDataModel(3, $r("app.media.component_stack_product03"), $r("app.string.component_stack_product_title03"), $r("app.string.component_stack_product_price03"), $r("app.string.component_stack_product_insurance03")),
new ProductDataModel(4, $r("app.media.component_stack_product04"), $r("app.string.component_stack_product_title04"), $r("app.string.component_stack_product_price04"), $r("app.string.component_stack_product_insurance04")),
new ProductDataModel(5, $r("app.media.component_stack_product05"), $r("app.string.component_stack_product_title05"), $r("app.string.component_stack_product_price05"), $r("app.string.component_stack_product_insurance05"))
];
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets#L38-L45
|
f3aac107483572b5fa811b4dca511144bdb6f5dd
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SuperFeature/MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Player.ets
|
arkts
|
Player
|
Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Component
export default struct Player {
@StorageProp('fontSize') fontSize: number = 0
build() {
Row() {
Image($r('app.media.pic_music_cover'))
.height(32)
.width(32)
.borderRadius(5)
.margin({ right: 12 })
Column() {
Text($r('app.string.song_name'))
.fontColor('#000000')
.fontSize(this.fontSize - 1)
Row() {
Image($r('app.media.ic_vip'))
.height(16)
.width(16)
.margin({ right: 4 })
Text($r('app.string.singer'))
.fontColor('#000000')
.fontSize(this.fontSize - 4)
.opacity(0.38)
}
}
.alignItems(HorizontalAlign.Start)
Blank()
Image($r('app.media.icon_pause'))
.height(26)
.width(26)
.margin({ right: 16 })
Image($r('app.media.ic_next'))
.height(24)
.width(24)
.margin({ right: 16 })
Image($r('app.media.ic_Music_list'))
.height(24)
.width(24)
}
.width('100%')
.height(48)
.backgroundColor('#F6F9FC')
.padding({ left: 16, right: 16 })
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct Player AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageProp ( AST#expression#Left 'fontSize' AST#expression#Right ) AST#decorator#Right fontSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right AST#property_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left 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.pic_music_cover' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 32 AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 5 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 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.song_name' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#000000' 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 this AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right - AST#expression#Left 1 AST#expression#Right AST#binary_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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_vip' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 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 4 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.singer' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left '#000000' 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 this AST#expression#Right . fontSize AST#member_expression#Right AST#expression#Right - AST#expression#Left 4 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left 0.38 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.icon_pause' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 26 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 26 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 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_next' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( 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 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_Music_list' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 24 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 48 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#F6F9FC' 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#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct Player {
@StorageProp('fontSize') fontSize: number = 0
build() {
Row() {
Image($r('app.media.pic_music_cover'))
.height(32)
.width(32)
.borderRadius(5)
.margin({ right: 12 })
Column() {
Text($r('app.string.song_name'))
.fontColor('#000000')
.fontSize(this.fontSize - 1)
Row() {
Image($r('app.media.ic_vip'))
.height(16)
.width(16)
.margin({ right: 4 })
Text($r('app.string.singer'))
.fontColor('#000000')
.fontSize(this.fontSize - 4)
.opacity(0.38)
}
}
.alignItems(HorizontalAlign.Start)
Blank()
Image($r('app.media.icon_pause'))
.height(26)
.width(26)
.margin({ right: 16 })
Image($r('app.media.ic_next'))
.height(24)
.width(24)
.margin({ right: 16 })
Image($r('app.media.ic_Music_list'))
.height(24)
.width(24)
}
.width('100%')
.height(48)
.backgroundColor('#F6F9FC')
.padding({ left: 16, right: 16 })
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/MultiDeviceAppDev/MusicAlbum/entry/src/main/ets/common/Player.ets#L16-L62
|
12f4f6b5bb63c743a210f1893f386ada1998c715
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
LIstOptimizationBak/entry/src/main/ets/model/TabBarModel.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export interface TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
animationIcon: ResourceStr;
defaultIcon: ResourceStr;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface TabBarData AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left activeIcon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left animationIcon : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left defaultIcon : AST#type_annotation#Left AST#primary_type#Left ResourceStr 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 TabBarData {
id: TabBarType;
title: ResourceStr;
activeIcon: ResourceStr;
animationIcon: ResourceStr;
defaultIcon: ResourceStr;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LIstOptimizationBak/entry/src/main/ets/model/TabBarModel.ets#L16-L22
|
0b7d01bc05d504531f3e50c6a7a5ca77cf80d8ac
|
gitee
|
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionAdd.ets
|
arkts
|
handle
|
根据实际Client类型替换any
|
handle(data: ReactionData): { message: any | null, reaction: any | null, user: any | null } {
// 应用约束10:使用具体类型替代any
const user = this.client.users.get(data.user_id) as any | null;
if (!user) return { message: null, reaction: null, user: null };
// 应用约束22:显式类型转换
const channel = this.client.channels.get(data.channel_id) as any | null;
if (!channel || channel.type === 'voice') return { message: null, reaction: null, user: null };
const message = channel.messages.get(data.message_id) as any | null;
if (!message) return { message: null, reaction: null, user: null };
if (!data.emoji) return { message: null, reaction: null, user: null };
// 应用约束29:使用继承替代方法修改
const reaction = message._addReaction(data.emoji, user) as any | null;
if (reaction) {
// 应用约束30:类型安全的事件触发
this.client.emit(Constants.Events.MESSAGE_REACTION_ADD as string, reaction, user);
}
return { message, reaction, user };
}
|
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ReactionData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERROR#Left : AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left message AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right , reaction : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right , user : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right } { AST#ERROR#Right // 应用约束10:使用具体类型替代any AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left user = 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right 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 data AST#expression#Right . user_id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left user AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reaction AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left user AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 应用约束22:显式类型转换 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left channel = 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . channels 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 . channel_id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left channel AST#expression#Right AST#unary_expression#Right AST#expression#Right || AST#expression#Left channel AST#expression#Right AST#binary_expression#Right AST#expression#Right . type AST#member_expression#Right AST#expression#Right === AST#expression#Left 'voice' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reaction AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left user AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left message = 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 channel AST#expression#Right . messages 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 . message_id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left message AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reaction AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left user AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left data AST#expression#Right AST#unary_expression#Right AST#expression#Right . emoji AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left reaction AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left user AST#property_name#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right // 应用约束29:使用继承替代方法修改 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left reaction = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left message AST#expression#Right . _addReaction 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 . emoji AST#member_expression#Right AST#expression#Right , AST#expression#Left user AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left any AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left reaction AST#expression#Right ) AST#block_statement#Left { // 应用约束30:类型安全的事件触发 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 . client AST#member_expression#Right 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 . MESSAGE_REACTION_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 reaction 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#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 message AST#property_assignment#Right , AST#property_assignment#Left reaction AST#property_assignment#Right , AST#property_assignment#Left user 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
|
handle(data: ReactionData): { message: any | null, reaction: any | null, user: any | null } {
const user = this.client.users.get(data.user_id) as any | null;
if (!user) return { message: null, reaction: null, user: null };
const channel = this.client.channels.get(data.channel_id) as any | null;
if (!channel || channel.type === 'voice') return { message: null, reaction: null, user: null };
const message = channel.messages.get(data.message_id) as any | null;
if (!message) return { message: null, reaction: null, user: null };
if (!data.emoji) return { message: null, reaction: null, user: null };
const reaction = message._addReaction(data.emoji, user) as any | null;
if (reaction) {
this.client.emit(Constants.Events.MESSAGE_REACTION_ADD as string, reaction, user);
}
return { message, reaction, user };
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/MessageReactionAdd.ets#L17-L39
|
ddcc7788989d11870107269c6ac954adb06468a8
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets
|
arkts
|
scaleImage
|
缩放图片大小为原来的1/2
|
private scaleImage() {
if (this.pixelMap != undefined) {
// [Start pixelmap_scale_image]
// 宽为原来的0.5
// 高为原来的0.5
this.pixelMap.scale(0.5, 0.5).then(() => {
this.updateImageInfo();
})
// [End pixelmap_scale_image]
}
}
|
AST#method_declaration#Left private scaleImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pixelMap AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // [Start pixelmap_scale_image] // 宽为原来的0.5 // 高为原来的0.5 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 . pixelMap AST#member_expression#Right AST#expression#Right . scale AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0.5 AST#expression#Right , AST#expression#Left 0.5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateImageInfo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right // [End pixelmap_scale_image] } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
private scaleImage() {
if (this.pixelMap != undefined) {
this.pixelMap.scale(0.5, 0.5).then(() => {
this.updateImageInfo();
})
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L241-L251
|
70065d6f048049e4a8323eb10f6eca809602cc62
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets
|
arkts
|
encodeCBC
|
加密-CBC模式
@param str 待加密的字符串
@param aesKey SM4密钥
@param iv iv偏移量字符串
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64
@returns
|
static encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
}
|
AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left iv : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left 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 resultCoding : 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 AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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 . encodeCBC AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left sm4Key AST#expression#Right , AST#expression#Left iv AST#expression#Right , AST#expression#Left 'SM4_128' AST#expression#Right , AST#expression#Left 'SM4_128|CBC|PKCS7' AST#expression#Right , AST#expression#Left 128 AST#expression#Right , AST#expression#Left keyCoding AST#expression#Right , AST#expression#Left resultCoding 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 encodeCBC(str: string, sm4Key: string, iv: string,
keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.encodeCBC(str, sm4Key, iv, 'SM4_128', 'SM4_128|CBC|PKCS7', 128, keyCoding, resultCoding);
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets#L72-L75
|
c5a8c8465ff44d284bd7f00cebecdd8624cafcc0
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/SettingsTypes.ets
|
arkts
|
开发者配置接口
|
export interface DeveloperConfig {
debugMode: boolean;
enableLogging: boolean;
logLevel: LogLevel;
showPerformanceMetrics: boolean;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface DeveloperConfig AST#object_type#Left { AST#type_member#Left debugMode : 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 enableLogging : 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 logLevel : AST#type_annotation#Left AST#primary_type#Left LogLevel AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left showPerformanceMetrics : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface DeveloperConfig {
debugMode: boolean;
enableLogging: boolean;
logLevel: LogLevel;
showPerformanceMetrics: boolean;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L115-L120
|
a8928d00c38f3b74187a862a667eeacf50afe295
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/view/OrderListPage.ets
|
arkts
|
OrderListPage
|
@file 订单列表页面视图
@author Joker.X
|
@ComponentV2
export struct OrderListPage {
/**
* 订单列表页面 ViewModel
*/
@Local
private vm: OrderListViewModel = new OrderListViewModel();
/**
* 列表滚动控制器
*/
private listScroller: Scroller = new Scroller();
/**
* 构建订单列表页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: $r("app.string.order_list"),
viewModel: this.vm
}) {
BaseNetWorkListView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderListContent()
});
OrderGoodsModal({
visible: this.vm.rebuyModalVisible,
title: $r("app.string.select_goods_to_buy"),
buttonText: $r("app.string.rebuy"),
cartList: this.vm.rebuyCartList,
onDismiss: (): void => this.vm.hideRebuyModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toGoodsDetailForRebuy(goodsId)
});
OrderGoodsModal({
visible: this.vm.commentModalVisible,
title: $r("app.string.select_goods_to_comment"),
buttonText: $r("app.string.go_to_comment"),
cartList: this.vm.commentCartList,
onDismiss: (): void => this.vm.hideCommentModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toOrderCommentForGoods(goodsId)
});
}
}
/**
* 订单列表页面内容视图
* @returns {void} 无返回值
*/
@Builder
private OrderListContent() {
RefreshLayout({
loading: this.vm.isLoading,
isEnableSlideUp: this.vm.isEnableSlideUp,
scroller: this.listScroller,
onRefresh: (direction): void => this.vm.onRefreshDirection(direction)
}) {
List({ space: 12, scroller: this.listScroller }) {
ForEach(this.vm.listData, (item: Order): void => {
ListItem() {
this.OrderListItem(item);
}
}, (item: Order): string => `${item.id}`);
}
.width(P100)
.height(P100)
.padding({
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium")
})
.edgeEffect(EdgeEffect.None);
}
}
/**
* 渲染订单列表项
* @param {Order} item - 订单数据
* @returns {void} 无返回值
*/
@Builder
private OrderListItem(item: Order): void {
OrderCard({
order: item,
toOrderDetail: (orderId: number): void => OrderNavigator.toDetail(orderId),
toPay: (): void => this.vm.toPay(item),
toGoodsDetail: (): void => this.vm.handleRebuy(item),
toLogistics: (): void => OrderNavigator.toLogistics(item.id),
toComment: (): void => this.vm.handleOrderComment(item),
toRefund: (): void => OrderNavigator.toRefund(item.id)
});
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderListPage AST#component_body#Left { /**
* 订单列表页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left OrderListViewModel 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 OrderListViewModel 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 private listScroller : AST#type_annotation#Left AST#primary_type#Left Scroller 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 Scroller AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right /**
* 构建订单列表页面
* @returns {void} 无返回值
*/ AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.order_list" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left viewModel : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_custom_component_statement#Left BaseNetWorkListView ( AST#component_parameters#Left { AST#component_parameter#Left uiState : 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 . uiState AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRetry : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . retryRequest AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left content : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . OrderListContent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left OrderGoodsModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : 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 . rebuyModalVisible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_goods_to_buy" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.rebuy" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cartList : 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 . rebuyCartList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideRebuyModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onItemButtonClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left goodsId : 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#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 . toGoodsDetailForRebuy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right AST#ui_custom_component_statement#Left OrderGoodsModal ( AST#component_parameters#Left { AST#component_parameter#Left visible : 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 . commentModalVisible AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.select_goods_to_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonText : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.go_to_comment" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left cartList : 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 . commentCartList AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onDismiss : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . hideCommentModal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onItemButtonClick : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left goodsId : 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#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 . toOrderCommentForGoods AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right /**
* 订单列表页面内容视图
* @returns {void} 无返回值
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderListContent 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 RefreshLayout ( AST#component_parameters#Left { AST#component_parameter#Left loading : 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 . isLoading AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left isEnableSlideUp : 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 . isEnableSlideUp AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listScroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left onRefresh : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left direction AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 . onRefreshDirection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left direction AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . listScroller 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#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . listData 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 Order 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#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 . OrderListItem AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 Order 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#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left item AST#expression#Right . id AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right AST#ERROR#Left ; AST#ERROR#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left P100 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left P100 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 AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_horizontal_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.space_horizontal_medium" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . edgeEffect ( AST#expression#Left AST#member_expression#Left AST#expression#Left EdgeEffect AST#expression#Right . None AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#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#builder_function_body#Right AST#method_declaration#Right /**
* 渲染订单列表项
* @param {Order} item - 订单数据
* @returns {void} 无返回值
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderListItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left OrderCard ( AST#component_parameters#Left { AST#component_parameter#Left order : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toOrderDetail : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left orderId : 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#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toDetail AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left orderId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toPay : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . toPay AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toGoodsDetail : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . handleRebuy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toLogistics : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toLogistics 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 . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toComment : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . vm AST#member_expression#Right AST#expression#Right . handleOrderComment AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left item AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left toRefund : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left OrderNavigator AST#expression#Right . toRefund 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 . id AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct OrderListPage {
@Local
private vm: OrderListViewModel = new OrderListViewModel();
private listScroller: Scroller = new Scroller();
build() {
AppNavDestination({
title: $r("app.string.order_list"),
viewModel: this.vm
}) {
BaseNetWorkListView({
uiState: this.vm.uiState,
onRetry: (): void => this.vm.retryRequest(),
content: (): void => this.OrderListContent()
});
OrderGoodsModal({
visible: this.vm.rebuyModalVisible,
title: $r("app.string.select_goods_to_buy"),
buttonText: $r("app.string.rebuy"),
cartList: this.vm.rebuyCartList,
onDismiss: (): void => this.vm.hideRebuyModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toGoodsDetailForRebuy(goodsId)
});
OrderGoodsModal({
visible: this.vm.commentModalVisible,
title: $r("app.string.select_goods_to_comment"),
buttonText: $r("app.string.go_to_comment"),
cartList: this.vm.commentCartList,
onDismiss: (): void => this.vm.hideCommentModal(),
onItemButtonClick: (goodsId: number): void => this.vm.toOrderCommentForGoods(goodsId)
});
}
}
@Builder
private OrderListContent() {
RefreshLayout({
loading: this.vm.isLoading,
isEnableSlideUp: this.vm.isEnableSlideUp,
scroller: this.listScroller,
onRefresh: (direction): void => this.vm.onRefreshDirection(direction)
}) {
List({ space: 12, scroller: this.listScroller }) {
ForEach(this.vm.listData, (item: Order): void => {
ListItem() {
this.OrderListItem(item);
}
}, (item: Order): string => `${item.id}`);
}
.width(P100)
.height(P100)
.padding({
left: $r("app.float.space_horizontal_medium"),
right: $r("app.float.space_horizontal_medium")
})
.edgeEffect(EdgeEffect.None);
}
}
@Builder
private OrderListItem(item: Order): void {
OrderCard({
order: item,
toOrderDetail: (orderId: number): void => OrderNavigator.toDetail(orderId),
toPay: (): void => this.vm.toPay(item),
toGoodsDetail: (): void => this.vm.handleRebuy(item),
toLogistics: (): void => OrderNavigator.toLogistics(item.id),
toComment: (): void => this.vm.handleOrderComment(item),
toRefund: (): void => OrderNavigator.toRefund(item.id)
});
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderListPage.ets#L12-L104
|
0dab370722c46d831d9ca0f9c2e8de037e37763f
|
github
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_hvigor/entry/src/main/ets/MainAbility/themes/checkSystemTokens/CheckColorTokens.ets
|
arkts
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License")
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export class ColorsValues {
public readonly brand: string = 'sys.color.brand';
public readonly warning: string = 'sys.color.warning' ;
public readonly alert: string = 'sys.color.alert';
public readonly confirm: string = 'sys.color.confirm';
public readonly fontPrimary: string = 'sys.color.font_primary';
public readonly fontSecondary: string = 'sys.color.font_secondary';
public readonly fontTertiary: string = 'sys.color.font_tertiary';
public readonly fontFourth: string = 'sys.color.font_fourth';
public readonly fontEmphasize: string = 'sys.color.font_emphasize';
public readonly fontOnPrimary: string = 'sys.color.font_on_primary';
public readonly fontOnSecondary: string = 'sys.color.font_on_secondary';
public readonly fontOnTertiary: string = 'sys.color.font_on_tertiary';
public readonly fontOnFourth: string = 'sys.color.font_on_fourth';
public readonly iconPrimary: string = 'sys.color.icon_primary';
public readonly iconSecondary: string = 'sys.color.icon_secondary';
public readonly iconTertiary: string = 'sys.color.icon_tertiary';
public readonly iconFourth: string = 'sys.color.icon_fourth';
public readonly iconEmphasize: string = 'sys.color.icon_emphasize';
public readonly iconSubEmphasize: string = 'sys.color.icon_sub_emphasize';
public readonly iconOnPrimary: string = 'sys.color.icon_on_primary';
public readonly iconOnSecondary: string = 'sys.color.icon_on_secondary';
public readonly iconOnTertiary: string = 'sys.color.icon_on_tertiary';
public readonly iconOnFourth: string = 'sys.color.icon_on_fourth';
public readonly backgroundPrimary: string = 'sys.color.background_primary';
public readonly backgroundSecondary: string = 'sys.color.background_secondary';
public readonly backgroundTertiary: string = 'sys.color.background_tertiary';
public readonly backgroundFourth: string = 'sys.color.background_fourth';
public readonly backgroundEmphasize: string = 'sys.color.background_emphasize';
public readonly compForegroundPrimary: string = 'sys.color.comp_foreground_primary';
public readonly compBackgroundPrimary: string = 'sys.color.comp_background_primary';
public readonly compBackgroundPrimaryTran: string = 'sys.color.comp_background_primary_tran';
public readonly compBackgroundPrimaryContrary: string = 'sys.color.comp_background_primary_contrary';
public readonly compBackgroundGray: string = 'sys.color.comp_background_gray';
public readonly compBackgroundSecondary: string = 'sys.color.comp_background_secondary';
public readonly compBackgroundTertiary: string = 'sys.color.comp_background_tertiary';
public readonly compBackgroundEmphasize: string = 'sys.color.comp_background_emphasize';
public readonly compBackgroundNeutral: string = 'sys.color.neutral';
public readonly compEmphasizeSecondary: string = 'sys.color.comp_emphasize_secondary';
public readonly compEmphasizeTertiary: string = 'sys.color.comp_emphasize_tertiary';
public readonly compDivider: string = 'sys.color.comp_divider';
public readonly compCommonContrary: string = 'sys.color.comp_common_contrary';
public readonly compBackgroundFocus: string = 'sys.color.comp_background_focus';
public readonly compFocusedPrimary: string = 'sys.color.comp_focused_primary';
public readonly compFocusedSecondary: string = 'sys.color.comp_focused_secondary';
public readonly compFocusedTertiary: string = 'sys.color.comp_focused_tertiary';
public readonly interactiveHover: string = 'sys.color.interactive_hover';
public readonly interactivePressed: string = 'sys.color.interactive_pressed';
public readonly interactiveFocus: string = 'sys.color.interactive_focus';
public readonly interactiveActive: string = 'sys.color.interactive_active';
public readonly interactiveSelect: string = 'sys.color.interactive_select';
public readonly interactiveClick: string = 'sys.color.interactive_click';
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ColorsValues AST#class_body#Left { AST#property_declaration#Left public readonly brand : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.brand' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly warning : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.warning' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly alert : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.alert' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly confirm : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.confirm' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontFourth : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_fourth' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontEmphasize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_emphasize' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontOnPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_on_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontOnSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_on_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontOnTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_on_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly fontOnFourth : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.font_on_fourth' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconFourth : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_fourth' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconEmphasize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_emphasize' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconSubEmphasize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_sub_emphasize' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconOnPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_on_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconOnSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_on_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconOnTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_on_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly iconOnFourth : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.icon_on_fourth' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly backgroundPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.background_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly backgroundSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.background_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly backgroundTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.background_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly backgroundFourth : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.background_fourth' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly backgroundEmphasize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.background_emphasize' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compForegroundPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_foreground_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundPrimaryTran : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_primary_tran' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundPrimaryContrary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_primary_contrary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundGray : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_gray' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundEmphasize : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_emphasize' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundNeutral : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.neutral' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compEmphasizeSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_emphasize_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compEmphasizeTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_emphasize_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compDivider : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_divider' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compCommonContrary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_common_contrary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compBackgroundFocus : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_background_focus' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compFocusedPrimary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_focused_primary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compFocusedSecondary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_focused_secondary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly compFocusedTertiary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.comp_focused_tertiary' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactiveHover : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_hover' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactivePressed : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_pressed' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactiveFocus : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_focus' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactiveActive : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_active' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactiveSelect : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_select' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left public readonly interactiveClick : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'sys.color.interactive_click' AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ColorsValues {
public readonly brand: string = 'sys.color.brand';
public readonly warning: string = 'sys.color.warning' ;
public readonly alert: string = 'sys.color.alert';
public readonly confirm: string = 'sys.color.confirm';
public readonly fontPrimary: string = 'sys.color.font_primary';
public readonly fontSecondary: string = 'sys.color.font_secondary';
public readonly fontTertiary: string = 'sys.color.font_tertiary';
public readonly fontFourth: string = 'sys.color.font_fourth';
public readonly fontEmphasize: string = 'sys.color.font_emphasize';
public readonly fontOnPrimary: string = 'sys.color.font_on_primary';
public readonly fontOnSecondary: string = 'sys.color.font_on_secondary';
public readonly fontOnTertiary: string = 'sys.color.font_on_tertiary';
public readonly fontOnFourth: string = 'sys.color.font_on_fourth';
public readonly iconPrimary: string = 'sys.color.icon_primary';
public readonly iconSecondary: string = 'sys.color.icon_secondary';
public readonly iconTertiary: string = 'sys.color.icon_tertiary';
public readonly iconFourth: string = 'sys.color.icon_fourth';
public readonly iconEmphasize: string = 'sys.color.icon_emphasize';
public readonly iconSubEmphasize: string = 'sys.color.icon_sub_emphasize';
public readonly iconOnPrimary: string = 'sys.color.icon_on_primary';
public readonly iconOnSecondary: string = 'sys.color.icon_on_secondary';
public readonly iconOnTertiary: string = 'sys.color.icon_on_tertiary';
public readonly iconOnFourth: string = 'sys.color.icon_on_fourth';
public readonly backgroundPrimary: string = 'sys.color.background_primary';
public readonly backgroundSecondary: string = 'sys.color.background_secondary';
public readonly backgroundTertiary: string = 'sys.color.background_tertiary';
public readonly backgroundFourth: string = 'sys.color.background_fourth';
public readonly backgroundEmphasize: string = 'sys.color.background_emphasize';
public readonly compForegroundPrimary: string = 'sys.color.comp_foreground_primary';
public readonly compBackgroundPrimary: string = 'sys.color.comp_background_primary';
public readonly compBackgroundPrimaryTran: string = 'sys.color.comp_background_primary_tran';
public readonly compBackgroundPrimaryContrary: string = 'sys.color.comp_background_primary_contrary';
public readonly compBackgroundGray: string = 'sys.color.comp_background_gray';
public readonly compBackgroundSecondary: string = 'sys.color.comp_background_secondary';
public readonly compBackgroundTertiary: string = 'sys.color.comp_background_tertiary';
public readonly compBackgroundEmphasize: string = 'sys.color.comp_background_emphasize';
public readonly compBackgroundNeutral: string = 'sys.color.neutral';
public readonly compEmphasizeSecondary: string = 'sys.color.comp_emphasize_secondary';
public readonly compEmphasizeTertiary: string = 'sys.color.comp_emphasize_tertiary';
public readonly compDivider: string = 'sys.color.comp_divider';
public readonly compCommonContrary: string = 'sys.color.comp_common_contrary';
public readonly compBackgroundFocus: string = 'sys.color.comp_background_focus';
public readonly compFocusedPrimary: string = 'sys.color.comp_focused_primary';
public readonly compFocusedSecondary: string = 'sys.color.comp_focused_secondary';
public readonly compFocusedTertiary: string = 'sys.color.comp_focused_tertiary';
public readonly interactiveHover: string = 'sys.color.interactive_hover';
public readonly interactivePressed: string = 'sys.color.interactive_pressed';
public readonly interactiveFocus: string = 'sys.color.interactive_focus';
public readonly interactiveActive: string = 'sys.color.interactive_active';
public readonly interactiveSelect: string = 'sys.color.interactive_select';
public readonly interactiveClick: string = 'sys.color.interactive_click';
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_hvigor/entry/src/main/ets/MainAbility/themes/checkSystemTokens/CheckColorTokens.ets#L15-L67
|
9c407b0a7014ab539a2fa8aa143455b50554a717
|
gitee
|
|
zqaini002/YaoYaoLingXian.git
|
5095b12cbeea524a87c42d0824b1702978843d39
|
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
|
arkts
|
定义图标映射类
|
export class IconMapping {
defaultIcon = $r('app.media.default_icon');
}
|
AST#export_declaration#Left export AST#class_declaration#Left class IconMapping AST#class_body#Left { AST#property_declaration#Left defaultIcon = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.default_icon' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class IconMapping {
defaultIcon = $r('app.media.default_icon');
}
|
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L10-L12
|
79bfef680a0aa716e932d7d577d1cc780bd0f70d
|
github
|
|
openharmony/applications_settings
|
aac607310ec30e30d1d54db2e04d055655f72730
|
common/component/src/main/ets/default/switchComponent.ets
|
arkts
|
SwitchComponent
|
Toggle component
|
@Component
export default struct SwitchComponent {
@Link isOn: boolean;
@State isEnabled?: boolean = true;
private title: string | Resource = '';
private controller?: SwitchController;
private summary?: string | Resource = '';
private switchHeight: string | number | Resource = '';
build() {
Row() {
Column() {
Text(this.title)
.fontColor($r('sys.color.ohos_fa_text_primary'))
.fontSize($r("app.float.font_16"))
.fontWeight(FontWeight.Medium)
if (this.summary) {
Text(this.summary)
.fontColor($r('sys.color.ohos_fa_text_secondary'))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.fontWeight('sans-serif')
.textAlign(TextAlign.Start)
.maxLines(ComponentConfig.MAX_LINES_1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: $r('sys.float.ohos_id_text_margin_vertical') })
}
}
.alignItems(HorizontalAlign.Start)
Blank()
Stack({ alignContent: Alignment.Start }) {
Toggle({ type: ToggleType.Switch, isOn: this.isOn })
.width('36vp')
.height('20vp')
.margin({ left: $r('app.float.wh_value_6') })
.selectedColor('#007DFF')
.onChange((isOn: boolean) => {
if (!this.isEnabled) return;
this.isOn = new Boolean(isOn).valueOf();
this.toggleValue(this.isOn);
});
}
}
.padding({ left: $r('app.float.distance_12'), right: $r('app.float.distance_8') })
.width(ComponentConfig.WH_100_100)
.height(this.switchHeight)
.backgroundColor($r("app.color.white_bg_color"))
.alignItems(VerticalAlign.Center)
.borderRadius($r("app.float.radius_16"))
}
aboutToAppear() {
if (this.controller) {
this.toggleValue = this.controller.onSelfToggleValueBindThis;
// bind component and initialize
this.controller.bindComponent(this)
.bindProperties(["isOn", "isEnabled"])
.initData()
.subscribe();
}
}
aboutToDisappear() {
this.controller?.unsubscribe();
}
private toggleValue: (isOn: boolean) => void = () => {
};
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SwitchComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isOn : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isEnabled ? : 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 private title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private controller ? : AST#type_annotation#Left AST#primary_type#Left SwitchController AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private summary ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private switchHeight : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_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 Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_fa_text_primary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.font_16" 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . summary AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . summary AST#member_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.color.ohos_fa_text_secondary' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'sys.float.ohos_id_text_size_body2' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left 'sans-serif' AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . maxLines ( AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . MAX_LINES_1 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 . 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 'sys.float.ohos_id_text_margin_vertical' 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#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 . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left HorizontalAlign AST#expression#Right . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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 Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . Start 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 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 this AST#expression#Right . isOn AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '36vp' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left '20vp' AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.wh_value_6' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . selectedColor ( AST#expression#Left '#007DFF' AST#expression#Right ) AST#modifier_chain_expression#Left . onChange ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . isEnabled AST#member_expression#Right AST#expression#Right ) AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isOn AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Boolean AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left isOn AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . valueOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toggleValue 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 . isOn AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.distance_12' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.float.distance_8' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left ComponentConfig AST#expression#Right . WH_100_100 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . switchHeight AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.white_bg_color" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.float.radius_16" 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#build_body#Right AST#build_method#Right AST#method_declaration#Left aboutToAppear 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 . controller AST#member_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . toggleValue 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 . controller AST#member_expression#Right AST#expression#Right . onSelfToggleValueBindThis AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right // bind component and initialize AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right . bindComponent 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 . bindProperties AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left "isOn" AST#expression#Right , AST#expression#Left "isEnabled" AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . initData AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . subscribe 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 AST#method_declaration#Left aboutToDisappear 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 this AST#expression#Right . controller AST#member_expression#Right AST#expression#Right ?. unsubscribe 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#property_declaration#Left private toggleValue : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left isOn : 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#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export default struct SwitchComponent {
@Link isOn: boolean;
@State isEnabled?: boolean = true;
private title: string | Resource = '';
private controller?: SwitchController;
private summary?: string | Resource = '';
private switchHeight: string | number | Resource = '';
build() {
Row() {
Column() {
Text(this.title)
.fontColor($r('sys.color.ohos_fa_text_primary'))
.fontSize($r("app.float.font_16"))
.fontWeight(FontWeight.Medium)
if (this.summary) {
Text(this.summary)
.fontColor($r('sys.color.ohos_fa_text_secondary'))
.fontSize($r('sys.float.ohos_id_text_size_body2'))
.fontWeight('sans-serif')
.textAlign(TextAlign.Start)
.maxLines(ComponentConfig.MAX_LINES_1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: $r('sys.float.ohos_id_text_margin_vertical') })
}
}
.alignItems(HorizontalAlign.Start)
Blank()
Stack({ alignContent: Alignment.Start }) {
Toggle({ type: ToggleType.Switch, isOn: this.isOn })
.width('36vp')
.height('20vp')
.margin({ left: $r('app.float.wh_value_6') })
.selectedColor('#007DFF')
.onChange((isOn: boolean) => {
if (!this.isEnabled) return;
this.isOn = new Boolean(isOn).valueOf();
this.toggleValue(this.isOn);
});
}
}
.padding({ left: $r('app.float.distance_12'), right: $r('app.float.distance_8') })
.width(ComponentConfig.WH_100_100)
.height(this.switchHeight)
.backgroundColor($r("app.color.white_bg_color"))
.alignItems(VerticalAlign.Center)
.borderRadius($r("app.float.radius_16"))
}
aboutToAppear() {
if (this.controller) {
this.toggleValue = this.controller.onSelfToggleValueBindThis;
this.controller.bindComponent(this)
.bindProperties(["isOn", "isEnabled"])
.initData()
.subscribe();
}
}
aboutToDisappear() {
this.controller?.unsubscribe();
}
private toggleValue: (isOn: boolean) => void = () => {
};
}
|
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/switchComponent.ets#L22-L93
|
f3a96b21e21a39c4b87ce76e8814638690e0465b
|
gitee
|
vhall/VHLive_SDK_Harmony
|
29c820e5301e17ae01bc6bdcc393a4437b518e7c
|
watchKit/src/main/ets/builder/LotteryDialog.ets
|
arkts
|
LotteryDialog
|
抽奖弹窗
|
@Component
export struct LotteryDialog {
@State icon: ResourceStr = ''
//关闭弹窗
@State closeDialog: boolean = true
@State lottery_status: number = 0
@State type: string = 'lottery_result_notice'
@Consume lotteryPush: VHLotteryResultNoticeModel | null
@Prop LotteryCarryOut: VHLotteryCarryOut = new VHLotteryCarryOut();
@Link LotteryStatus: boolean
@Prop room_id: string = ''
// aboutToAppear(): void {
// LotteryData()
// }
aboutToDisappear(): void {
this.lotteryPush = null
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LotteryDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right icon : 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 AST#decorator#Left @ State AST#decorator#Right closeDialog : 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 lottery_status : 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 type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'lottery_result_notice' AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right lotteryPush : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left VHLotteryResultNoticeModel AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right LotteryCarryOut : AST#type_annotation#Left AST#primary_type#Left VHLotteryCarryOut 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 VHLotteryCarryOut AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right LotteryStatus : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right room_id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#ERROR#Left AST#expression#Left AST#call_expression#Left AST#expression#Left '' AST#expression#Right // aboutToAppear(): void { // LotteryData() // } AST#ERROR#Left aboutToDisappear 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#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left void AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left this AST#property_assignment#Right AST#object_literal#Right AST#expression#Right AST#unary_expression#Right AST#expression#Right . lotteryPush AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#property_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct LotteryDialog {
@State icon: ResourceStr = ''
@State closeDialog: boolean = true
@State lottery_status: number = 0
@State type: string = 'lottery_result_notice'
@Consume lotteryPush: VHLotteryResultNoticeModel | null
@Prop LotteryCarryOut: VHLotteryCarryOut = new VHLotteryCarryOut();
@Link LotteryStatus: boolean
@Prop room_id: string = ''
aboutToDisappear(): void {
this.lotteryPush = null
}
|
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/LotteryDialog.ets#L20-L37
|
eb13b81a0ca153316e10941f9cc100c0dda9df72
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets
|
arkts
|
@Author csx
@DateTime 2024/3/20 21:19
@TODO DynamicUtil 动态协商工具类
|
export class DynamicSyncUtil {
/**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 共享密钥
*/
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: number, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
//公钥数据
let pubKeyArray: Uint8Array = new Uint8Array();
//私钥数据
let priKeyArray: Uint8Array = new Uint8Array();
//转换公钥
if (typeof pubKey === 'string') {
let pk = CryptoSyncUtil.convertPubKeyFromStr(pubKey as string, symAlgName, keyName, keyCoding);
pubKeyArray = pk.pubKey.getEncoded().data;
} else {
pubKeyArray = pubKey as Uint8Array;
}
//转换私钥
if (typeof priKey === 'string') {
let pik = CryptoSyncUtil.convertPriKeyFromStr(priKey as string, symAlgName, keyName, keyCoding);
priKeyArray = pik.priKey.getEncoded().data;
} else {
priKeyArray = priKey as Uint8Array;
}
//创建密钥生成器
let eccGen = crypto.createAsyKeyGenerator(symAlgName);
// 外部传入的公私钥对A
let keyPairA = eccGen.convertKeySync({ data: pubKeyArray }, null);
// 内部生成的公私钥对B
let keyPairB = eccGen.convertKeySync(null, { data: priKeyArray });
let eccKeyAgreement = crypto.createKeyAgreement(symAlgName);
// 使用A的公钥和B的私钥进行密钥协商
let secret1 = eccKeyAgreement.generateSecretSync(keyPairB.priKey, keyPairA.pubKey);
// 两种协商的结果应当一致
if (secret1.data) {
return StrAndUintUtil.unitArray2StrCoding(secret1.data, resultCoding);
} else {
return '动态协商交换结果不相等,请检查公私钥是否正确!';
}
}
/**
* 消息认证码计算
* @param str 计算字符串
* @param symAlgName 秘钥规格
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns
*/
static hmac(str: string, symAlgName: string,
resultCoding: buffer.BufferEncoding = 'base64'): string {
//创建消息认证码计算器
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
let symKeyGenerator = crypto.createSymKeyGenerator('AES256');
// 通过非对称密钥生成器,随机生成非对称密钥
let symKey = symKeyGenerator.generateSymKeySync();
//初始化密钥
mac.initSync(symKey);
for (let i = 0; i < messageData.length; i += updateLength) {
let updateMessage = messageData.subarray(i, i + updateLength);
let updateMessageBlob: crypto.DataBlob = { data: updateMessage };
mac.update(updateMessageBlob);
}
let macOutput = mac.doFinalSync();
return StrAndUintUtil.unitArray2StrCoding(macOutput.data, resultCoding);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DynamicSyncUtil AST#class_body#Left { /**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 共享密钥
*/ AST#method_declaration#Left static dynamicKey AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keyName : AST#type_annotation#Left AST#primary_type#Left number 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 resultCoding : 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#variable_declaration#Left let AST#variable_declarator#Left pubKeyArray : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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 priKeyArray : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#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#unary_expression#Left typeof AST#expression#Left pubKey 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#variable_declaration#Left let AST#variable_declarator#Left pk = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . convertPubKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left pubKey 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 symAlgName AST#expression#Right , AST#expression#Left keyName AST#expression#Right , AST#expression#Left keyCoding 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 pubKeyArray = 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 pk AST#expression#Right . pubKey AST#member_expression#Right 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#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 pubKeyArray = AST#expression#Left AST#as_expression#Left AST#expression#Left pubKey AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //转换私钥 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left priKey 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#variable_declaration#Left let AST#variable_declarator#Left pik = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CryptoSyncUtil AST#expression#Right . convertPriKeyFromStr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left priKey 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 symAlgName AST#expression#Right , AST#expression#Left keyName AST#expression#Right , AST#expression#Left keyCoding 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 priKeyArray = 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 pik AST#expression#Right . priKey AST#member_expression#Right 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#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 priKeyArray = AST#expression#Left AST#as_expression#Left AST#expression#Left priKey AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 eccGen = 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 // 外部传入的公私钥对A AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPairA = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eccGen AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left pubKeyArray AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 内部生成的公私钥对B AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyPairB = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eccGen AST#expression#Right . convertKeySync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#null_literal#Left null AST#null_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 priKeyArray AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left eccKeyAgreement = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createKeyAgreement 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 // 使用A的公钥和B的私钥进行密钥协商 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left secret1 = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left eccKeyAgreement AST#expression#Right . generateSecretSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairB AST#expression#Right . priKey AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left keyPairA AST#expression#Right . pubKey AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 两种协商的结果应当一致 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret1 AST#expression#Right . data AST#member_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 StrAndUintUtil AST#expression#Right . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left secret1 AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding 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#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 消息认证码计算
* @param str 计算字符串
* @param symAlgName 秘钥规格
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns
*/ AST#method_declaration#Left static hmac 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 symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : 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#variable_declaration#Left let AST#variable_declarator#Left mac = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createMac 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 messageData = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Uint8Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left buffer AST#expression#Right . from AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left str AST#expression#Right , AST#expression#Left 'utf-8' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . buffer AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left updateLength = AST#expression#Left 200 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 默认以200字节为单位进行分段update AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left symKeyGenerator = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left crypto AST#expression#Right . createSymKeyGenerator AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'AES256' 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 symKeyGenerator AST#expression#Right . generateSymKeySync 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 mac AST#expression#Right . initSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left symKey AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left messageData AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#assignment_expression#Left i += AST#expression#Left updateLength 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 updateMessage = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left messageData AST#expression#Right . subarray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left i AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right + AST#expression#Left updateLength 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 updateMessageBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left crypto . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left updateMessage AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . update AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left updateMessageBlob AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left macOutput = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left mac AST#expression#Right . doFinalSync 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 . unitArray2StrCoding AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left macOutput AST#expression#Right . data AST#member_expression#Right AST#expression#Right , AST#expression#Left resultCoding AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DynamicSyncUtil {
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: number, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): string {
let pubKeyArray: Uint8Array = new Uint8Array();
let priKeyArray: Uint8Array = new Uint8Array();
if (typeof pubKey === 'string') {
let pk = CryptoSyncUtil.convertPubKeyFromStr(pubKey as string, symAlgName, keyName, keyCoding);
pubKeyArray = pk.pubKey.getEncoded().data;
} else {
pubKeyArray = pubKey as Uint8Array;
}
if (typeof priKey === 'string') {
let pik = CryptoSyncUtil.convertPriKeyFromStr(priKey as string, symAlgName, keyName, keyCoding);
priKeyArray = pik.priKey.getEncoded().data;
} else {
priKeyArray = priKey as Uint8Array;
}
let eccGen = crypto.createAsyKeyGenerator(symAlgName);
let keyPairA = eccGen.convertKeySync({ data: pubKeyArray }, null);
let keyPairB = eccGen.convertKeySync(null, { data: priKeyArray });
let eccKeyAgreement = crypto.createKeyAgreement(symAlgName);
let secret1 = eccKeyAgreement.generateSecretSync(keyPairB.priKey, keyPairA.pubKey);
if (secret1.data) {
return StrAndUintUtil.unitArray2StrCoding(secret1.data, resultCoding);
} else {
return '动态协商交换结果不相等,请检查公私钥是否正确!';
}
}
static hmac(str: string, symAlgName: string,
resultCoding: buffer.BufferEncoding = 'base64'): string {
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
let symKeyGenerator = crypto.createSymKeyGenerator('AES256');
let symKey = symKeyGenerator.generateSymKeySync();
mac.initSync(symKey);
for (let i = 0; i < messageData.length; i += updateLength) {
let updateMessage = messageData.subarray(i, i + updateLength);
let updateMessageBlob: crypto.DataBlob = { data: updateMessage };
mac.update(updateMessageBlob);
}
let macOutput = mac.doFinalSync();
return StrAndUintUtil.unitArray2StrCoding(macOutput.data, resultCoding);
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L28-L103
|
f24bb20e44650a98370b88c7927d8330094d00e4
|
gitee
|
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets
|
arkts
|
查询当前是尺寸
|
export function getImgSize(imageSize: image.Size, rotate: number,
dimensionWH: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT): number {
const isStandardRotation = [90, 270].includes(Math.abs(rotate % 360));
const Key =
isStandardRotation ? (dimensionWH == ImageFitType.TYPE_WIDTH ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH) :
dimensionWH;
// return px2vp(imageSize[Key])
return imageSize[Key]
}
|
AST#export_declaration#Left export AST#function_declaration#Left function getImgSize AST#parameter_list#Left ( AST#parameter#Left imageSize : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . Size AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rotate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dimensionWH : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left ImageFitType . TYPE_WIDTH AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left ImageFitType . TYPE_HEIGHT AST#qualified_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_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 const AST#variable_declarator#Left isStandardRotation = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left 90 AST#expression#Right , AST#expression#Left 270 AST#expression#Right ] AST#array_literal#Right AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . abs AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left rotate AST#expression#Right % AST#expression#Left 360 AST#expression#Right AST#binary_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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left Key = AST#expression#Left AST#conditional_expression#Left AST#expression#Left isStandardRotation 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 AST#binary_expression#Left AST#expression#Left dimensionWH AST#expression#Right == AST#expression#Left ImageFitType AST#expression#Right AST#binary_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFitType AST#expression#Right . TYPE_HEIGHT AST#member_expression#Right AST#expression#Right : AST#expression#Left ImageFitType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . TYPE_WIDTH AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right : AST#expression#Left dimensionWH AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // return px2vp(imageSize[Key]) AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#subscript_expression#Left AST#expression#Left imageSize AST#expression#Right [ AST#expression#Left Key AST#expression#Right ] AST#subscript_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 getImgSize(imageSize: image.Size, rotate: number,
dimensionWH: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT): number {
const isStandardRotation = [90, 270].includes(Math.abs(rotate % 360));
const Key =
isStandardRotation ? (dimensionWH == ImageFitType.TYPE_WIDTH ? ImageFitType.TYPE_HEIGHT : ImageFitType.TYPE_WIDTH) :
dimensionWH;
return imageSize[Key]
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/utils/Constrain.ets#L105-L113
|
af7eded4f10e5818171f6017c83129d6321f8fbd
|
gitee
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets
|
arkts
|
onWindowStageCreate
|
[Start soft_keyboard_entryability]
|
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
let keyboardAvoidMode = windowStage.getMainWindowSync().getUIContext().getKeyboardAvoidMode();
// 设置虚拟键盘抬起时压缩页面大小为减去键盘的高度
windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE);
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
|
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 { // Main window is created, set main page for this ability AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'Ability onWindowStageCreate' 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 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#variable_declaration#Left let AST#variable_declarator#Left keyboardAvoidMode = 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 windowStage AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getKeyboardAvoidMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 设置虚拟键盘抬起时压缩页面大小为减去键盘的高度 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left windowStage AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . setKeyboardAvoidMode AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left KeyboardAvoidMode AST#expression#Right . RESIZE 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 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 hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left 'Failed to load the content. Cause: %{public}s' AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left err AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?? AST#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#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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'testTag' AST#expression#Right , AST#expression#Left 'Succeeded in loading the content.' 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
|
onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
let keyboardAvoidMode = windowStage.getMainWindowSync().getUIContext().getKeyboardAvoidMode();
windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE);
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageInteracts/entry2/src/main/ets/entry2ability/Entry2Ability.ets#L30-L44
|
234851f9294ac96c24ffdcb98db5d43aefdbdb26
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
|
arkts
|
showToastTip
|
显示带图形吐司
@param options
|
static showToastTip(options: ToastTipOptions) {
ActionParameter.initToastTipDefault(options);
options.dialogId = DialogHelper.generateId();
ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ToastTipBuilder), options);
let timeID = setTimeout(() => {
DialogHelper.closeDialog(options.dialogId ?? "");
clearTimeout(timeID);
}, options.duration);
}
|
AST#method_declaration#Left static showToastTip AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastTipOptions 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 ActionParameter AST#expression#Right . initToastTipDefault AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . generateId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#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 ActionBaseCore 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 . openCustomDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left ToastTipBuilder AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#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 timeID = AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHelper AST#expression#Right . closeDialog AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . dialogId 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 clearTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left timeID 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 options AST#expression#Right . duration 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
|
static showToastTip(options: ToastTipOptions) {
ActionParameter.initToastTipDefault(options);
options.dialogId = DialogHelper.generateId();
ActionBaseCore.getInstance().openCustomDialog(wrapBuilder(ToastTipBuilder), options);
let timeID = setTimeout(() => {
DialogHelper.closeDialog(options.dialogId ?? "");
clearTimeout(timeID);
}, options.duration);
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L432-L440
|
ddbbac2bf64327cdaa1d922528e887edb06076b4
|
gitee
|
851432669/Smart-Home-ArkTs-Hi3861.git
|
0451f85f072ed3281cc23d9cdc2843d79f60f975
|
entry/src/main/ets/common/utils/GlobalDataManager.ets
|
arkts
|
updateUserAccount
|
更新用户账号
|
updateUserAccount(account: string): void {
if (account && account.trim().length > 0) {
this.userInfo.account = account.trim();
console.info(`用户账号ID已更新为: ${account}`);
}
}
|
AST#method_declaration#Left updateUserAccount AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left account AST#expression#Right && AST#expression#Left account AST#expression#Right AST#binary_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 . 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 AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userInfo AST#member_expression#Right AST#expression#Right . account AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left account 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#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 console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 用户账号ID已更新为: AST#template_substitution#Left $ { AST#expression#Left account 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#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
updateUserAccount(account: string): void {
if (account && account.trim().length > 0) {
this.userInfo.account = account.trim();
console.info(`用户账号ID已更新为: ${account}`);
}
}
|
https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/common/utils/GlobalDataManager.ets#L170-L175
|
eae9e990f3b9d774a875aa2c1a830d4bcc07528b
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
|
arkts
|
disconnect
|
断开连接
|
disconnect() {
Log.showInfo(TAG, `disconnect`);
this.disconnectInner(this.mGattClientDevice!);
}
|
AST#method_declaration#Left disconnect 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 Log AST#expression#Right . showInfo 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 ` disconnect ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . disconnectInner AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mGattClientDevice AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
disconnect() {
Log.showInfo(TAG, `disconnect`);
this.disconnectInner(this.mGattClientDevice!);
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L144-L147
|
90fc9898287e278b265becb8f2056647cbd89600
|
gitee
|
HarmonyCandies/like_button.git
|
c3928cbfd952bd3dec41a9937faa518295ea6464
|
like_button/src/main/ets/common/Color.ets
|
arkts
|
/ convert from dart Color
|
export class DartColor {
readonly value: number;
constructor(value: number) {
// this.value = value & 0xFFFFFFFF;
// 强制转换为无符号32位整数
this.value = value >>> 0;
}
static fromARGB(a: number, r: number, g: number, b: number): DartColor {
let value =
((a & 0xff) << 24) |
((r & 0xff) << 16) |
((g & 0xff) << 8) |
(b & 0xff);
return new DartColor(value);
}
static fromRGBO(r: number, g: number, b: number, opacity: number): DartColor {
const value =
(((Math.round(opacity * 0xff) & 0xff) << 24) |
(r & 0xff) << 16) |
((g & 0xff) << 8) |
(b & 0xff);
return new DartColor(value);
}
get alpha(): number {
return (0xff000000 & this.value) >>> 24;
}
get opacity(): number {
return this.alpha / 0xFF;
}
get red(): number {
return (0x00ff0000 & this.value) >>> 16;
}
get green(): number {
return (0x0000ff00 & this.value) >>> 8;
}
get blue(): number {
return (0x000000ff & this.value);
}
withAlpha(a: number): DartColor {
return DartColor.fromARGB(a, this.red, this.green, this.blue);
}
withOpacity(opacity: number): DartColor {
if (opacity < 0.0 || opacity > 1.0) {
throw new Error('Opacity must be between 0.0 and 1.0');
}
return this.withAlpha(Math.round(opacity * 255));
}
withRed(r: number): DartColor {
return DartColor.fromARGB(this.alpha, r, this.green, this.blue);
}
withGreen(g: number): DartColor {
return DartColor.fromARGB(this.alpha, this.red, g, this.blue);
}
withBlue(b: number): DartColor {
return DartColor.fromARGB(this.alpha, this.red, this.green, b);
}
computeLuminance(): number {
const linearizeColorComponent = (component: number): number => {
if (component <= 0.03928) {
return component / 12.92;
}
return Math.pow((component + 0.055) / 1.055, 2.4);
};
const R = linearizeColorComponent(this.red / 0xFF);
const G = linearizeColorComponent(this.green / 0xFF);
const B = linearizeColorComponent(this.blue / 0xFF);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
static lerp(a: DartColor | null, b: DartColor | null, t: number): DartColor | null {
if (t < 0) {
t = 0;
} else if (t > 1) {
t = 1;
}
if (b === null) {
if (a === null) {
return null;
} else {
return a.withAlpha(Math.round((1 - t) * a.alpha));
}
} else {
if (a === null) {
return b.withAlpha(Math.round(t * b.alpha));
} else {
const alpha = Math.round(DartColor._lerpInt(a.alpha, b.alpha, t));
const red = DartColor._lerpInt(a.red, b.red, t);
const green = DartColor._lerpInt(a.green, b.green, t);
const blue = DartColor._lerpInt(a.blue, b.blue, t);
return DartColor.fromARGB(alpha, red, green, blue);
}
}
}
private static _lerpInt(a: number, b: number, t: number): number {
return a + (b - a) * t;
}
private static _scaleAlpha(color: DartColor, factor: number): DartColor {
return color.withAlpha(Math.round(color.alpha * factor));
}
static alphaBlend(foreground: DartColor, background: DartColor): DartColor {
const alpha = foreground.alpha;
if (alpha === 0x00) {
return background;
}
const invAlpha = 0xff - alpha;
let backAlpha = background.alpha;
if (backAlpha === 0xff) {
return DartColor.fromARGB(
0xff,
Math.round((alpha * foreground.red + invAlpha * background.red) / 0xff),
Math.round((alpha * foreground.green + invAlpha * background.green) / 0xff),
Math.round((alpha * foreground.blue + invAlpha * background.blue) / 0xff)
);
} else {
backAlpha = (backAlpha * invAlpha) / 0xff;
const outAlpha = alpha + backAlpha;
return DartColor.fromARGB(
outAlpha,
Math.round((foreground.red * alpha + background.red * backAlpha) / outAlpha),
Math.round((foreground.green * alpha + background.green * backAlpha) / outAlpha),
Math.round((foreground.blue * alpha + background.blue * backAlpha) / outAlpha)
);
}
}
static fromString(colorString: string): DartColor {
let hexValue: string = colorString;
if (hexValue.charAt(0) === '#') {
hexValue = hexValue.substr(1);
}
if (hexValue.length !== 6 && hexValue.length !== 8) {
throw new Error('Invalid color string format');
}
if (hexValue.length === 6) {
hexValue = `FF${hexValue}`;
}
const parsedValue: number = parseInt(hexValue, 16);
return new DartColor(parsedValue);
}
static fromResourceColor(color: ResourceColor | DartColor): DartColor {
if (color instanceof DartColor) {
return color;
}
return DartColor.fromString(color as string);
}
toString(): string {
return `#${this.value.toString(16).padStart(8, '0')}`;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DartColor AST#class_body#Left { AST#property_declaration#Left readonly value : 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 value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // this.value = value & 0xFFFFFFFF; // 强制转换为无符号32位整数 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 . value AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left value AST#expression#Right >>> AST#expression#Left 0 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#constructor_declaration#Right AST#method_declaration#Left static fromARGB AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left g : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : 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 DartColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left value = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_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 a AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left r AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_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 g AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left b AST#expression#Right & AST#expression#Left 0xff 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DartColor AST#expression#Right AST#new_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 AST#method_declaration#Left static fromRGBO AST#parameter_list#Left ( AST#parameter#Left r : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left g : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left opacity : 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 DartColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left value = 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 AST#parenthesized_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 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 AST#binary_expression#Left AST#expression#Left opacity AST#expression#Right * AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_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 r AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_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 g AST#expression#Right & AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right << AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right | AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left b AST#expression#Right & AST#expression#Left 0xff 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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left DartColor AST#expression#Right AST#new_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 AST#method_declaration#Left get AST#ERROR#Left alpha AST#ERROR#Right 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#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 0xff000000 AST#expression#Right & AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >>> AST#expression#Left 24 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left opacity AST#ERROR#Right 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right / AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left red AST#ERROR#Right 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#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 0x00ff0000 AST#expression#Right & AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >>> AST#expression#Left 16 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left green AST#ERROR#Right 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#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 0x0000ff00 AST#expression#Right & AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . value AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right >>> AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left get AST#ERROR#Left blue AST#ERROR#Right 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#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0x000000ff AST#expression#Right & AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . value 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 AST#method_declaration#Left withAlpha AST#parameter_list#Left ( AST#parameter#Left a : 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 DartColor 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 DartColor AST#expression#Right . fromARGB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left a AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blue 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 AST#method_declaration#Left withOpacity AST#parameter_list#Left ( AST#parameter#Left opacity : 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 DartColor 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 opacity AST#expression#Right < AST#expression#Left 0.0 AST#expression#Right AST#binary_expression#Right AST#expression#Right || AST#expression#Left AST#binary_expression#Left AST#expression#Left opacity AST#expression#Right > AST#expression#Left 1.0 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#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 'Opacity must be between 0.0 and 1.0' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#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 . withAlpha 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 . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left opacity AST#expression#Right * AST#expression#Left 255 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left withRed AST#parameter_list#Left ( AST#parameter#Left r : 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 DartColor 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 DartColor AST#expression#Right . fromARGB 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 . alpha AST#member_expression#Right AST#expression#Right , AST#expression#Left r AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blue 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 AST#method_declaration#Left withGreen AST#parameter_list#Left ( AST#parameter#Left g : 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 DartColor 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 DartColor AST#expression#Right . fromARGB 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 . alpha AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left g AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blue 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 AST#method_declaration#Left withBlue AST#parameter_list#Left ( AST#parameter#Left b : 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 DartColor 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 DartColor AST#expression#Right . fromARGB 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 . alpha AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left b AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left computeLuminance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left linearizeColorComponent = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left component : 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left component AST#expression#Right <= AST#expression#Left 0.03928 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#binary_expression#Left AST#expression#Left component AST#expression#Right / AST#expression#Left 12.92 AST#expression#Right AST#binary_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . pow 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 component AST#expression#Right + AST#expression#Left 0.055 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 1.055 AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left 2.4 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#arrow_function#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 R = AST#expression#Left AST#call_expression#Left AST#expression#Left linearizeColorComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . red AST#member_expression#Right AST#expression#Right / AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left G = AST#expression#Left AST#call_expression#Left AST#expression#Left linearizeColorComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . green AST#member_expression#Right AST#expression#Right / AST#expression#Left 0xFF AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left B = AST#expression#Left AST#call_expression#Left AST#expression#Left linearizeColorComponent AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . blue AST#member_expression#Right AST#expression#Right / AST#expression#Left 0xFF 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#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left 0.2126 AST#expression#Right * AST#expression#Left R AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left 0.7152 AST#expression#Right * AST#expression#Left G 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 0.0722 AST#expression#Right * AST#expression#Left B AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static lerp AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DartColor AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DartColor AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left t : 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#union_type#Left AST#primary_type#Left DartColor AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_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 t 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 t = AST#expression#Left 0 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } else AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left t AST#expression#Right > AST#expression#Left 1 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left t = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_if_statement#Right AST#ui_control_flow#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left b 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#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#expression_statement#Right } else { AST#expression_statement#Left AST#expression#Left return 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 a AST#expression#Right . withAlpha 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 . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 1 AST#expression#Right - AST#expression#Left t AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right . alpha 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#ui_if_statement#Right AST#ui_control_flow#Right } else { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right === AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left return 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 b AST#expression#Right . withAlpha 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 . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left t AST#expression#Right * AST#expression#Left b AST#expression#Right AST#binary_expression#Right AST#expression#Right . alpha 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 } else { AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left alpha = 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . _lerpInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right , AST#expression#Left t AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left red = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . _lerpInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . red AST#member_expression#Right AST#expression#Right , AST#expression#Left t 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 const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left green = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . _lerpInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . green AST#member_expression#Right AST#expression#Right , AST#expression#Left t 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 const AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left blue = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . _lerpInt AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left a AST#expression#Right . blue AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left b AST#expression#Right . blue AST#member_expression#Right AST#expression#Right , AST#expression#Left t 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . fromARGB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left alpha AST#expression#Right , AST#expression#Left red AST#expression#Right , AST#expression#Left green AST#expression#Right , AST#expression#Left blue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#method_declaration#Left private static _lerpInt AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left t : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left a 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 b AST#expression#Right - AST#expression#Left a AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right * AST#expression#Left t AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left private static _scaleAlpha AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left DartColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left factor : 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 DartColor 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 color AST#expression#Right . withAlpha 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 . round AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left color AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right * AST#expression#Left factor AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static alphaBlend AST#parameter_list#Left ( AST#parameter#Left foreground : AST#type_annotation#Left AST#primary_type#Left DartColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left background : AST#type_annotation#Left AST#primary_type#Left DartColor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left DartColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left alpha = AST#expression#Left AST#member_expression#Left AST#expression#Left foreground AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left alpha AST#expression#Right === AST#expression#Left 0x00 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 background AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left invAlpha = AST#expression#Left AST#binary_expression#Left AST#expression#Left 0xff AST#expression#Right - AST#expression#Left alpha 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 backAlpha = AST#expression#Left AST#member_expression#Left AST#expression#Left background AST#expression#Right . alpha AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left backAlpha AST#expression#Right === AST#expression#Left 0xff 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 DartColor AST#expression#Right . fromARGB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xff AST#expression#Right , 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 AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left alpha AST#expression#Right * AST#expression#Left foreground AST#expression#Right AST#binary_expression#Right AST#expression#Right . red AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left invAlpha AST#expression#Right * AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . red AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#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 alpha AST#expression#Right * AST#expression#Left foreground AST#expression#Right AST#binary_expression#Right AST#expression#Right . green AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left invAlpha AST#expression#Right * AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . green AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#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 alpha AST#expression#Right * AST#expression#Left foreground AST#expression#Right AST#binary_expression#Right AST#expression#Right . blue AST#member_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left invAlpha AST#expression#Right * AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . blue AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left backAlpha = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left backAlpha AST#expression#Right * AST#expression#Left invAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left 0xff AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#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 outAlpha = AST#expression#Left AST#binary_expression#Left AST#expression#Left alpha AST#expression#Right + AST#expression#Left backAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DartColor AST#expression#Right . fromARGB AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left outAlpha AST#expression#Right , 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 AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left foreground AST#expression#Right . red AST#member_expression#Right AST#expression#Right * AST#expression#Left alpha AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right . red AST#member_expression#Right AST#expression#Right * AST#expression#Left backAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left outAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#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 foreground AST#expression#Right . green AST#member_expression#Right AST#expression#Right * AST#expression#Left alpha AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right . green AST#member_expression#Right AST#expression#Right * AST#expression#Left backAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left outAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#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 foreground AST#expression#Right . blue AST#member_expression#Right AST#expression#Right * AST#expression#Left alpha AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left background AST#expression#Right AST#binary_expression#Right AST#expression#Right . blue AST#member_expression#Right AST#expression#Right * AST#expression#Left backAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left outAlpha AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static fromString AST#parameter_list#Left ( AST#parameter#Left colorString : 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 DartColor AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hexValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left colorString AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hexValue AST#expression#Right . charAt 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#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 hexValue = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hexValue AST#expression#Right . substr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hexValue AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left 6 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left hexValue AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right !== AST#expression#Left 8 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'Invalid color string format' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hexValue AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 6 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 hexValue = AST#expression#Left AST#template_literal#Left ` FF AST#template_substitution#Left $ { AST#expression#Left hexValue AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parsedValue : 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 parseInt AST#expression#Right AST#argument_list#Left ( AST#expression#Left hexValue AST#expression#Right , AST#expression#Left 16 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#new_expression#Left new AST#expression#Left DartColor AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left parsedValue AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left static fromResourceColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceColor AST#primary_type#Right | AST#primary_type#Left DartColor 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 DartColor 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 color AST#expression#Right instanceof AST#expression#Left DartColor 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 color 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 DartColor AST#expression#Right . fromString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left color 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right AST#method_declaration#Left toString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` # AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . value 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 . padStart AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 8 AST#expression#Right , AST#expression#Left '0' 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#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DartColor {
readonly value: number;
constructor(value: number) {
this.value = value >>> 0;
}
static fromARGB(a: number, r: number, g: number, b: number): DartColor {
let value =
((a & 0xff) << 24) |
((r & 0xff) << 16) |
((g & 0xff) << 8) |
(b & 0xff);
return new DartColor(value);
}
static fromRGBO(r: number, g: number, b: number, opacity: number): DartColor {
const value =
(((Math.round(opacity * 0xff) & 0xff) << 24) |
(r & 0xff) << 16) |
((g & 0xff) << 8) |
(b & 0xff);
return new DartColor(value);
}
get alpha(): number {
return (0xff000000 & this.value) >>> 24;
}
get opacity(): number {
return this.alpha / 0xFF;
}
get red(): number {
return (0x00ff0000 & this.value) >>> 16;
}
get green(): number {
return (0x0000ff00 & this.value) >>> 8;
}
get blue(): number {
return (0x000000ff & this.value);
}
withAlpha(a: number): DartColor {
return DartColor.fromARGB(a, this.red, this.green, this.blue);
}
withOpacity(opacity: number): DartColor {
if (opacity < 0.0 || opacity > 1.0) {
throw new Error('Opacity must be between 0.0 and 1.0');
}
return this.withAlpha(Math.round(opacity * 255));
}
withRed(r: number): DartColor {
return DartColor.fromARGB(this.alpha, r, this.green, this.blue);
}
withGreen(g: number): DartColor {
return DartColor.fromARGB(this.alpha, this.red, g, this.blue);
}
withBlue(b: number): DartColor {
return DartColor.fromARGB(this.alpha, this.red, this.green, b);
}
computeLuminance(): number {
const linearizeColorComponent = (component: number): number => {
if (component <= 0.03928) {
return component / 12.92;
}
return Math.pow((component + 0.055) / 1.055, 2.4);
};
const R = linearizeColorComponent(this.red / 0xFF);
const G = linearizeColorComponent(this.green / 0xFF);
const B = linearizeColorComponent(this.blue / 0xFF);
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
}
static lerp(a: DartColor | null, b: DartColor | null, t: number): DartColor | null {
if (t < 0) {
t = 0;
} else if (t > 1) {
t = 1;
}
if (b === null) {
if (a === null) {
return null;
} else {
return a.withAlpha(Math.round((1 - t) * a.alpha));
}
} else {
if (a === null) {
return b.withAlpha(Math.round(t * b.alpha));
} else {
const alpha = Math.round(DartColor._lerpInt(a.alpha, b.alpha, t));
const red = DartColor._lerpInt(a.red, b.red, t);
const green = DartColor._lerpInt(a.green, b.green, t);
const blue = DartColor._lerpInt(a.blue, b.blue, t);
return DartColor.fromARGB(alpha, red, green, blue);
}
}
}
private static _lerpInt(a: number, b: number, t: number): number {
return a + (b - a) * t;
}
private static _scaleAlpha(color: DartColor, factor: number): DartColor {
return color.withAlpha(Math.round(color.alpha * factor));
}
static alphaBlend(foreground: DartColor, background: DartColor): DartColor {
const alpha = foreground.alpha;
if (alpha === 0x00) {
return background;
}
const invAlpha = 0xff - alpha;
let backAlpha = background.alpha;
if (backAlpha === 0xff) {
return DartColor.fromARGB(
0xff,
Math.round((alpha * foreground.red + invAlpha * background.red) / 0xff),
Math.round((alpha * foreground.green + invAlpha * background.green) / 0xff),
Math.round((alpha * foreground.blue + invAlpha * background.blue) / 0xff)
);
} else {
backAlpha = (backAlpha * invAlpha) / 0xff;
const outAlpha = alpha + backAlpha;
return DartColor.fromARGB(
outAlpha,
Math.round((foreground.red * alpha + background.red * backAlpha) / outAlpha),
Math.round((foreground.green * alpha + background.green * backAlpha) / outAlpha),
Math.round((foreground.blue * alpha + background.blue * backAlpha) / outAlpha)
);
}
}
static fromString(colorString: string): DartColor {
let hexValue: string = colorString;
if (hexValue.charAt(0) === '#') {
hexValue = hexValue.substr(1);
}
if (hexValue.length !== 6 && hexValue.length !== 8) {
throw new Error('Invalid color string format');
}
if (hexValue.length === 6) {
hexValue = `FF${hexValue}`;
}
const parsedValue: number = parseInt(hexValue, 16);
return new DartColor(parsedValue);
}
static fromResourceColor(color: ResourceColor | DartColor): DartColor {
if (color instanceof DartColor) {
return color;
}
return DartColor.fromString(color as string);
}
toString(): string {
return `#${this.value.toString(16).padStart(8, '0')}`;
}
}
|
https://github.com/HarmonyCandies/like_button.git/blob/c3928cbfd952bd3dec41a9937faa518295ea6464/like_button/src/main/ets/common/Color.ets#L3-L184
|
72e4872b844d7d40d365586d95a588ac3c0d2b61
|
github
|
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/view/ChatBubble.ets
|
arkts
|
speakMessage
|
播放消息语音
|
private async speakMessage(): Promise<void> {
try {
// 如果已经有TTS在播放,先停止
if (this.ttsService.isSpeakingNow()) {
await this.ttsService.stop();
this.isSpeaking = false;
this.logService.tts('停止当前播放');
return;
}
// 检查TTS是否可用
if (!this.ttsService.isAvailable()) {
this.logService.tts('TTS未初始化,尝试初始化...');
await this.ttsService.initialize();
if (!this.ttsService.isAvailable()) {
this.logService.error('ChatBubble', 'TTS初始化失败');
promptAction.showToast({
message: 'TTS服务不可用',
duration: 1500
});
return;
}
}
// 开始播放
this.isSpeaking = true;
this.logService.tts(`用户点击播放按钮,消息: ${this.message.content.substring(0, 30)}...`);
await this.ttsService.speak(this.message.content);
// 等待播放完成 - 通过轮询TTS服务状态
const checkInterval = setInterval(() => {
if (!this.ttsService.isSpeakingNow()) {
this.isSpeaking = false;
clearInterval(checkInterval);
this.logService.tts('播放完成,重置UI状态');
}
}, 500);
// 设置最大超时时间(30秒)
setTimeout(() => {
if (this.isSpeaking) {
this.isSpeaking = false;
clearInterval(checkInterval);
this.logService.warn('ChatBubble', 'TTS播放超时,强制重置状态');
}
}, 30000);
} catch (error) {
this.logService.error('ChatBubble', `播放失败: ${JSON.stringify(error)}`);
this.isSpeaking = false;
promptAction.showToast({
message: '语音播放失败',
duration: 1500
});
}
}
|
AST#method_declaration#Left private async speakMessage 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 { // 如果已经有TTS在播放,先停止 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 this AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . isSpeakingNow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . ttsService 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#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 . isSpeaking AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '停止当前播放' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right // 检查TTS是否可用 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . isAvailable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'TTS未初始化,尝试初始化...' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . initialize AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . isAvailable AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ChatBubble' AST#expression#Right , AST#expression#Left 'TTS初始化失败' 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left 'TTS服务不可用' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#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 . isSpeaking 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#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` 用户点击播放按钮,消息: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . message AST#member_expression#Right AST#expression#Right . content AST#member_expression#Right 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 30 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ... ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 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 . ttsService AST#member_expression#Right AST#expression#Right . speak 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 . message AST#member_expression#Right AST#expression#Right . content 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 // 等待播放完成 - 通过轮询TTS服务状态 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left checkInterval = AST#expression#Left AST#call_expression#Left AST#expression#Left setInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . ttsService AST#member_expression#Right AST#expression#Right . isSpeakingNow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpeaking AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left checkInterval 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 . logService AST#member_expression#Right AST#expression#Right . tts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '播放完成,重置UI状态' 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#expression#Left 500 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秒) AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpeaking 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 . isSpeaking AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearInterval AST#expression#Right AST#argument_list#Left ( AST#expression#Left checkInterval 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 . logService AST#member_expression#Right AST#expression#Right . warn AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ChatBubble' AST#expression#Right , AST#expression#Left 'TTS播放超时,强制重置状态' 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#expression#Left 30000 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . logService AST#member_expression#Right AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ChatBubble' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` 播放失败: AST#template_substitution#Left $ { AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . stringify AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left error AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSpeaking AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left '语音播放失败' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 1500 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#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async speakMessage(): Promise<void> {
try {
if (this.ttsService.isSpeakingNow()) {
await this.ttsService.stop();
this.isSpeaking = false;
this.logService.tts('停止当前播放');
return;
}
if (!this.ttsService.isAvailable()) {
this.logService.tts('TTS未初始化,尝试初始化...');
await this.ttsService.initialize();
if (!this.ttsService.isAvailable()) {
this.logService.error('ChatBubble', 'TTS初始化失败');
promptAction.showToast({
message: 'TTS服务不可用',
duration: 1500
});
return;
}
}
this.isSpeaking = true;
this.logService.tts(`用户点击播放按钮,消息: ${this.message.content.substring(0, 30)}...`);
await this.ttsService.speak(this.message.content);
const checkInterval = setInterval(() => {
if (!this.ttsService.isSpeakingNow()) {
this.isSpeaking = false;
clearInterval(checkInterval);
this.logService.tts('播放完成,重置UI状态');
}
}, 500);
setTimeout(() => {
if (this.isSpeaking) {
this.isSpeaking = false;
clearInterval(checkInterval);
this.logService.warn('ChatBubble', 'TTS播放超时,强制重置状态');
}
}, 30000);
} catch (error) {
this.logService.error('ChatBubble', `播放失败: ${JSON.stringify(error)}`);
this.isSpeaking = false;
promptAction.showToast({
message: '语音播放失败',
duration: 1500
});
}
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/ChatBubble.ets#L248-L304
|
f5e61136cc6cb8c49cf9b715e1376042cec1e4e8
|
github
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/services/TextToSpeechService.ets
|
arkts
|
isAvailable
|
检查TTS是否可用
|
isAvailable(): boolean {
return this.isInitialized && this.ttsEngine !== null;
}
|
AST#method_declaration#Left isAvailable AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isInitialized AST#member_expression#Right AST#expression#Right && AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . ttsEngine AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
isAvailable(): boolean {
return this.isInitialized && this.ttsEngine !== null;
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L379-L381
|
9a197a658ea448101e3a79adc68513ad0843fb63
|
github
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets
|
arkts
|
debug
|
打印DEBUG级别日志
@param args
|
static debug(...args: string[]): void {
if (LogUtil.showLog) {
hilog.debug(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
}
|
AST#method_declaration#Left static debug AST#parameter_list#Left ( AST#parameter#Left ... args : 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#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#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . showLog 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 hilog AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . domain AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . 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#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . format AST#member_expression#Right AST#expression#Right . repeat AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left args AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left args 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
|
static debug(...args: string[]): void {
if (LogUtil.showLog) {
hilog.debug(LogUtil.domain, LogUtil.tag, LogUtil.format.repeat(args.length), args)
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/commonLib/src/main/ets/utils/LogUtil.ets#L54-L58
|
94d625dce4cc0dbe451755c5f9f1733f50766fd1
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets
|
arkts
|
getWeekViewData
|
获取指定周数据
|
getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
}
|
AST#method_declaration#Left getWeekViewData AST#parameter_list#Left ( AST#parameter#Left weekNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . weekDays AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TimeUtils AST#expression#Right . getWeekDays AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left weekNum AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
getWeekViewData(weekNum: number) {
this.weekDays = [...TimeUtils.getWeekDays(weekNum)];
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L81-L83
|
ad448813e33d1aae59cf3d5660dfbae6baf20176
|
gitee
|
hefengbao/jingmo-for-HarmonyOS.git
|
a208f3fdc95c0914749072e811301b9dfd6678d6
|
features/classicalliterature/classicpoem/src/main/ets/model/ClassicPoem.ets
|
arkts
|
分类
|
constructor(
id: number,
dynasty: string,
writer: string,
writer_introduction: string,
title: string,
subtitle: string | null,
preface: string | null,
content: string,
annotation: string | null,
translation: string | null,
creative_background: string | null,
explain: string | null,
comment: string | null,
collection: string,
category: string | null
) {
this.id = id;
this.dynasty = dynasty;
this.writer = writer;
this.writer_introduction = writer_introduction;
this.title = title;
this.subtitle = subtitle;
this.preface = preface;
this.content = content;
this.annotation = annotation;
this.translation = translation;
this.creative_background = creative_background;
this.explain = explain;
this.comment = comment;
this.collection = collection;
this.category = category
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dynasty : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left writer : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left writer_introduction : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left subtitle : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left preface : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left annotation : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left translation : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left creative_background : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left explain : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left comment : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left collection : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left category : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . id AST#member_expression#Right = AST#expression#Left id AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dynasty AST#member_expression#Right = AST#expression#Left dynasty 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 . writer AST#member_expression#Right = AST#expression#Left writer 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 . writer_introduction AST#member_expression#Right = AST#expression#Left writer_introduction AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right = AST#expression#Left title AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . subtitle AST#member_expression#Right = AST#expression#Left subtitle 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 . preface AST#member_expression#Right = AST#expression#Left preface AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . content AST#member_expression#Right = AST#expression#Left content AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . annotation AST#member_expression#Right = AST#expression#Left annotation 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 . translation AST#member_expression#Right = AST#expression#Left translation 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 . creative_background AST#member_expression#Right = AST#expression#Left creative_background 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 . explain AST#member_expression#Right = AST#expression#Left explain 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 . comment AST#member_expression#Right = AST#expression#Left comment 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 . collection AST#member_expression#Right = AST#expression#Left collection 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 . category AST#member_expression#Right = AST#expression#Left category AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(
id: number,
dynasty: string,
writer: string,
writer_introduction: string,
title: string,
subtitle: string | null,
preface: string | null,
content: string,
annotation: string | null,
translation: string | null,
creative_background: string | null,
explain: string | null,
comment: string | null,
collection: string,
category: string | null
) {
this.id = id;
this.dynasty = dynasty;
this.writer = writer;
this.writer_introduction = writer_introduction;
this.title = title;
this.subtitle = subtitle;
this.preface = preface;
this.content = content;
this.annotation = annotation;
this.translation = translation;
this.creative_background = creative_background;
this.explain = explain;
this.comment = comment;
this.collection = collection;
this.category = category
}
|
https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/features/classicalliterature/classicpoem/src/main/ets/model/ClassicPoem.ets#L26-L58
|
e97718e857f19757688404a89afcb0a20515dcf9
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
ETSUI/List/entry/src/main/ets/common/CommonConstants.ets
|
arkts
|
offset range
|
export const MAX_OFFSET_Y: number = 100;
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left MAX_OFFSET_Y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 100 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const MAX_OFFSET_Y: number = 100;
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L45-L45
|
8b7e5fda9bd153ee4256a5d073b7554293f29c69
|
gitee
|
|
xinkai-hu/MyDay.git
|
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
|
entry/src/main/ets/model/WeatherData.ets
|
arkts
|
天气数据类型。与高德地图天气 API 请求结果向对应。
|
export default interface
|
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
|
export default interface
|
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/WeatherData.ets#L4-L4
|
0f0a9ff934ab8fe1e6db3e96b9c59a59cf569b61
|
github
|
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/plan/DayOfWordsView.ets
|
arkts
|
/ 参数类型
|
export interface Param {
dayOf: DayOf
plan: Plan
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Param AST#object_type#Left { AST#type_member#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan 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 Param {
dayOf: DayOf
plan: Plan
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/plan/DayOfWordsView.ets#L47-L51
|
acd00e748649718e9fffee498f50468103557f0e
|
github
|
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets
|
arkts
|
Resource management tool class.
|
export class ResourceManagerUtil {
/**
* Obtains the description of a media file.
*
* @param path Resource path.
* @param callback Callback function.
*/
public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is empty.');
return;
}
try {
let resourceManager = GlobalContext.getContext()
.getObject('resourceManager') as resourceManager.ResourceManager;
resourceManager.getRawFd(path, (error, value) => {
if (error != null) {
Logger.error(TAG, `callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
} else {
Logger.info(TAG, `callback getRawFd success fd code: ${value.fd}.`);
callback(value);
}
});
} catch (error) {
Logger.error(TAG, `callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`);
}
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class ResourceManagerUtil AST#class_body#Left { /**
* Obtains the description of a media file.
*
* @param path Resource path.
* @param callback Callback function.
*/ AST#method_declaration#Left public static getSrcPath 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 callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left callback 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 'getSrcPath fail,callback is empty.' 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 let AST#variable_declarator#Left resourceManager = 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 GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'resourceManager' 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 resourceManager . ResourceManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left resourceManager AST#expression#Right . getRawFd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error AST#parameter#Right , 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#binary_expression#Left AST#expression#Left error 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 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 ` callback getRawFd failed 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 , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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 . 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 ` callback getRawFd success fd code: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . fd AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left callback AST#expression#Right AST#argument_list#Left ( AST#expression#Left value 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#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 TAG AST#expression#Right , AST#expression#Left AST#template_literal#Left ` callback getRawFd failed, 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 , message: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left error AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class ResourceManagerUtil {
public static getSrcPath(path: string, callback: Function) {
if (callback === undefined) {
Logger.error(TAG, 'getSrcPath fail,callback is empty.');
return;
}
try {
let resourceManager = GlobalContext.getContext()
.getObject('resourceManager') as resourceManager.ResourceManager;
resourceManager.getRawFd(path, (error, value) => {
if (error != null) {
Logger.error(TAG, `callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
} else {
Logger.info(TAG, `callback getRawFd success fd code: ${value.fd}.`);
callback(value);
}
});
} catch (error) {
Logger.error(TAG, `callback getRawFd failed, error code: ${error.code}, message: ${error.message}.`);
}
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets#L25-L52
|
3a49a0dcc0d160f1d915482bf41375bfdf321a16
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/main/src/main/ets/component/HomeBanner.ets
|
arkts
|
getIndicator
|
获取轮播图指示器
@returns {DotIndicator | boolean} 指示器配置
|
private getIndicator(): DotIndicator | boolean {
if (this.breakpointState.isXS() || this.breakpointState.isSM()) {
return Indicator.dot()
.color($r("app.color.bg_purple_light"))
.selectedColor($r("app.color.primary"));
}
return false;
}
|
AST#method_declaration#Left private getIndicator AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DotIndicator AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 this AST#expression#Right . breakpointState AST#member_expression#Right AST#expression#Right . isXS AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . breakpointState AST#member_expression#Right AST#expression#Right . isSM 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#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 Indicator AST#expression#Right . dot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . color AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.color.bg_purple_light" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . selectedColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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#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#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
|
private getIndicator(): DotIndicator | boolean {
if (this.breakpointState.isXS() || this.breakpointState.isSM()) {
return Indicator.dot()
.color($r("app.color.bg_purple_light"))
.selectedColor($r("app.color.primary"));
}
return false;
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeBanner.ets#L65-L73
|
88b34ea8e8a7311d1f97a9c8da9be10d166b0442
|
github
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/utils/SysUtil.ets
|
arkts
|
getIndicatorHeight
|
获取底部导航条的高度,单位为vp。
@returns
|
static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHub.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.topRect.height;
if (height > 0) {
return px2vp(height);
}
return 28;
} catch (err) {
return 28;
}
}
|
AST#method_declaration#Left static getIndicatorHeight AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left uiContext 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#assignment_expression#Left uiContext = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DialogHub AST#expression#Right . getUIAbilityContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left height = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#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 uiContext AST#expression#Right . windowStage AST#member_expression#Right AST#expression#Right . getMainWindowSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getWindowAvoidArea AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left window AST#expression#Right . AvoidAreaType AST#member_expression#Right AST#expression#Right . TYPE_NAVIGATION_INDICATOR AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left height AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp 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#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 28 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 28 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static getIndicatorHeight(uiContext?: common.UIAbilityContext): number {
try {
if (!uiContext) {
uiContext = DialogHub.getUIAbilityContext();
}
let height = uiContext.windowStage.getMainWindowSync()
.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR)
.topRect.height;
if (height > 0) {
return px2vp(height);
}
return 28;
} catch (err) {
return 28;
}
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L86-L101
|
8bbf794cb495e0bfe5e9f83e9ac8213cf6a33bb6
|
github
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
|
arkts
|
aboutToDisappear
|
[Start net_con_unregister]
|
aboutToDisappear(): void {
this.netCon?.unregister((error: BusinessError) => {
if (error) {
hilog.error(0x0000, 'Sample', 'unregister failed, callback: err->: %{public}s', JSON.stringify(error));
}
});
}
|
AST#method_declaration#Left aboutToDisappear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . netCon AST#member_expression#Right AST#expression#Right ?. unregister AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left error AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0000 AST#expression#Right , AST#expression#Left 'Sample' AST#expression#Right , AST#expression#Left 'unregister failed, callback: err->: %{public}s' 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#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#builder_function_body#Right AST#method_declaration#Right
|
aboutToDisappear(): void {
this.netCon?.unregister((error: BusinessError) => {
if (error) {
hilog.error(0x0000, 'Sample', 'unregister failed, callback: err->: %{public}s', JSON.stringify(error));
}
});
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L49-L55
|
efb6d422b0dfeef2fb2218fe9498f2888eb4719e
|
gitee
|
sithvothykiv/dialog_hub.git
|
b676c102ef2d05f8994d170abe48dcc40cd39005
|
custom_dialog/src/main/ets/core/dialog/ImageDialog.ets
|
arkts
|
initDialogDefault
|
------------------------- 保护、私有方法 protected | private methods -------------------------
初始化DialogOptions参数
@param options
|
protected initDialogDefault(options: IImageDialogOptions) {
if (options.isOnlineImage === undefined && DownloadFileUtil.isOnlineUri(options.imageURI)) {
options.isOnlineImage = true
}
options._dialogType = 'modal'
// 未设置图片关闭,默认添加
if (options.attaches === undefined && options.isShowClose || options.isShowClose === undefined) {
options.attaches = [PresetAttach.outsideBottomCenterClose]
}
options.transitionType = options.transitionType ?? NavigationSystemTransitionType.EXPLODE
options.style = CommonDialog.makeStyle(options) as IImageDialogStyle
return options
}
|
AST#method_declaration#Left protected initDialogDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left IImageDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . isOnlineImage AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left DownloadFileUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . isOnlineUri AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . imageURI AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . isOnlineImage 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#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 options AST#expression#Right . _dialogType AST#member_expression#Right = AST#expression#Left 'modal' AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right // 未设置图片关闭,默认添加 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . attaches AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . isShowClose AST#member_expression#Right AST#expression#Right || AST#expression#Left options AST#expression#Right AST#binary_expression#Right AST#expression#Right . isShowClose AST#member_expression#Right AST#expression#Right === AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . attaches AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left PresetAttach AST#expression#Right . outsideBottomCenterClose AST#member_expression#Right AST#expression#Right ] AST#array_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#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . transitionType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . transitionType AST#member_expression#Right AST#expression#Right ?? AST#expression#Left NavigationSystemTransitionType AST#expression#Right AST#binary_expression#Right AST#expression#Right . EXPLODE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . style AST#member_expression#Right = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonDialog AST#expression#Right . makeStyle AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left options AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left IImageDialogStyle AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left return AST#expression#Right AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left options AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
protected initDialogDefault(options: IImageDialogOptions) {
if (options.isOnlineImage === undefined && DownloadFileUtil.isOnlineUri(options.imageURI)) {
options.isOnlineImage = true
}
options._dialogType = 'modal'
if (options.attaches === undefined && options.isShowClose || options.isShowClose === undefined) {
options.attaches = [PresetAttach.outsideBottomCenterClose]
}
options.transitionType = options.transitionType ?? NavigationSystemTransitionType.EXPLODE
options.style = CommonDialog.makeStyle(options) as IImageDialogStyle
return options
}
|
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/ImageDialog.ets#L97-L112
|
37ace723d7fa1d9a463ac3a1949dfe265c8d3b37
|
github
|
Duke_Bit/ElfRefresh
|
56faf5431c1643ec5ae227dc854a31b391778b2c
|
entry/src/main/ets/components/TitleBar.ets
|
arkts
|
TitleBar
|
标准头部
|
@ComponentV2
export struct TitleBar {
@Param title: ResourceStr = ''
@Param right?: ResourceStr = undefined
@Param BtnStrColor?: ResourceColor = undefined
@Event onRightClick?: () => void = undefined
@Event onBackClick?: () => void = undefined
build() {
RelativeContainer() {
Button() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back")).objectFit(ImageFit.Contain)
.height(16)
.width(16)
}
.type(ButtonType.Circle)
.backgroundColor('#00000000')
.margin({ left: 16, right: 16 })
.onClick(() => {
if (this.onBackClick) {
this.onBackClick()
} else {
router.back()
}
})
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id("back")
.width(44)
if (this.title != null) {
Text(this.title)
.id('title')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
}.width('100%')
.height(44 )
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right 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 AST#decorator#Left @ Param AST#decorator#Right right ? : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right BtnStrColor ? : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Event AST#decorator#Right onRightClick ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left undefined AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Event AST#decorator#Right onBackClick ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left undefined 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 RelativeContainer ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "sys.media.ohos_ic_compnent_titlebar_back" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . objectFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left ImageFit AST#expression#Right . Contain AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 16 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 . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Circle AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left '#00000000' 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#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . onBackClick 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 . onBackClick 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 router AST#expression#Right . back AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left anchor AST#property_name#Right : AST#expression#Left "__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 center 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 . Center AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . id ( AST#expression#Left "back" AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 44 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right != AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { AST#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 . id ( AST#expression#Left 'title' AST#expression#Right ) AST#modifier_chain_expression#Left . alignRules ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left center 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 . 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 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#object_literal#Right 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left 44 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
|
@ComponentV2
export struct TitleBar {
@Param title: ResourceStr = ''
@Param right?: ResourceStr = undefined
@Param BtnStrColor?: ResourceColor = undefined
@Event onRightClick?: () => void = undefined
@Event onBackClick?: () => void = undefined
build() {
RelativeContainer() {
Button() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back")).objectFit(ImageFit.Contain)
.height(16)
.width(16)
}
.type(ButtonType.Circle)
.backgroundColor('#00000000')
.margin({ left: 16, right: 16 })
.onClick(() => {
if (this.onBackClick) {
this.onBackClick()
} else {
router.back()
}
})
.alignRules({
left: { anchor: "__container__", align: HorizontalAlign.Start },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.id("back")
.width(44)
if (this.title != null) {
Text(this.title)
.id('title')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.fontColor('#333333')
.fontWeight(FontWeight.Medium)
}
}.width('100%')
.height(44 )
}
}
|
https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/entry/src/main/ets/components/TitleBar.ets#L6-L53
|
d23cdffd209619ccbc19d344f548a929497ed314
|
gitee
|
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
|
6231773905435f000d00d94b26504433082ba40b
|
packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets
|
arkts
|
Declare type SelectOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 10
Declare type SelectOption
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 11
|
export declare class SelectOptions {
/**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
options: Array<SelectOption>;
/**
* The default selected index.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The default selected index.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
selected?: number;
/**
* The default text value.
* @type { string }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* The default text value.
* @type { string }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
value?: string;
/**
* Callback when the select is selected.
* @type { (index: number, value?: string) => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/
/**
* Callback when the select is selected.
* @type { (index: number, value?: string) => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/
onSelect?: (index: number, value?: string) => void;
}
|
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class SelectOptions AST#class_body#Left { /**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* SubOption array of the select.
* @type { Array<SelectSubOption> }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left options : 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 SelectOption AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The default selected index.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The default selected index.
* @type { number }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left selected ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* The default text value.
* @type { string }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* The default text value.
* @type { string }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left value ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* Callback when the select is selected.
* @type { (index: number, value?: string) => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 10
*/ /**
* Callback when the select is selected.
* @type { (index: number, value?: string) => void }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 11
*/ AST#property_declaration#Left onSelect ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right ; AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export declare class SelectOptions {
options: Array<SelectOption>;
selected?: number;
value?: string;
onSelect?: (index: number, value?: string) => void;
}
|
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.SubHeader.d.ets#L135-L192
|
d0109fa2fcb45f0c824bd21c2548e9e06fe61e73
|
github
|
|
L1rics06/arkTS-.git
|
991fd131bfdb11e2933152133c97453d86092ac0
|
entry/src/main/ets/pages/ContactPage.ets
|
arkts
|
filterContacts
|
搜索联系人
|
filterContacts() {
if (!this.searchText.trim()) {
this.updateContactGroups(this.allContacts);
return;
}
const keyword = this.searchText.toLowerCase();
const filtered = this.allContacts.filter(friend => {
const notation = friend.notation?.toLowerCase() || '';
const friendId = friend.friend_id.toLowerCase();
return notation.includes(keyword) || friendId.includes(keyword);
});
this.updateContactGroups(filtered);
}
|
AST#method_declaration#Left filterContacts AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . searchText AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateContactGroups 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 . allContacts 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#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left keyword = 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 . searchText AST#member_expression#Right AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left filtered = 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 . allContacts AST#member_expression#Right AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left friend => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left notation = 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 friend AST#expression#Right . notation AST#member_expression#Right AST#expression#Right ?. toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left '' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left friendId = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left friend AST#expression#Right . friend_id AST#member_expression#Right AST#expression#Right . toLowerCase AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 notation AST#expression#Right . includes AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left keyword AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right || AST#expression#Left friendId 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 keyword 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#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . updateContactGroups AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filtered 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
|
filterContacts() {
if (!this.searchText.trim()) {
this.updateContactGroups(this.allContacts);
return;
}
const keyword = this.searchText.toLowerCase();
const filtered = this.allContacts.filter(friend => {
const notation = friend.notation?.toLowerCase() || '';
const friendId = friend.friend_id.toLowerCase();
return notation.includes(keyword) || friendId.includes(keyword);
});
this.updateContactGroups(filtered);
}
|
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L178-L192
|
bde28afd630da8438bb767abe9f3ddc06609c3e5
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets
|
arkts
|
快捷图标数据
|
export const ICON_DATA1: Array<IconDataModel> = [
new IconDataModel(0, 2, $r("app.media.component_stack_ic_device_matebook_filled"), '笔记本'),
new IconDataModel(1, 2, $r("app.media.component_stack_ic_device_smartscreen_filled"), '智慧屏'),
new IconDataModel(2, 1, $r("app.media.component_stack_ic_device_soundx_filled"), '音箱'),
new IconDataModel(3, 1, $r("app.media.component_stack_ic_device_vrglass_filled"), 'VR眼镜'),
new IconDataModel(4, 1, $r("app.media.component_stack_ic_device_watch_filled"), '手表'),
new IconDataModel(5, 1, $r("app.media.component_stack_ic_public_devices_phone_filled"), '手机')
];
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ICON_DATA1 : 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 IconDataModel AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_device_matebook_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '笔记本' 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 IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_device_smartscreen_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '智慧屏' 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 IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_device_soundx_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '音箱' 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 IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 3 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_device_vrglass_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left 'VR眼镜' 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 IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_device_watch_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '手表' 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 IconDataModel AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 5 AST#expression#Right , AST#expression#Left 1 AST#expression#Right , AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.media.component_stack_ic_public_devices_phone_filled" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right , AST#expression#Left '手机' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const ICON_DATA1: Array<IconDataModel> = [
new IconDataModel(0, 2, $r("app.media.component_stack_ic_device_matebook_filled"), '笔记本'),
new IconDataModel(1, 2, $r("app.media.component_stack_ic_device_smartscreen_filled"), '智慧屏'),
new IconDataModel(2, 1, $r("app.media.component_stack_ic_device_soundx_filled"), '音箱'),
new IconDataModel(3, 1, $r("app.media.component_stack_ic_device_vrglass_filled"), 'VR眼镜'),
new IconDataModel(4, 1, $r("app.media.component_stack_ic_device_watch_filled"), '手表'),
new IconDataModel(5, 1, $r("app.media.component_stack_ic_public_devices_phone_filled"), '手机')
];
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/mock/IconMock.ets#L19-L26
|
107c79669b82cf00c479e920e801d085d6d8c84f
|
gitee
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/charts/PieChartModel.ets
|
arkts
|
setDrawSliceText
|
Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
Deprecated -> use setDrawEntryLabels(...) instead.
@param enabled
@Deprecated
|
public setDrawSliceText(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
}
|
AST#method_declaration#Left public setDrawSliceText AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDrawEntryLabels AST#member_expression#Right = AST#expression#Left enabled AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public setDrawSliceText(enabled: boolean): void {
this.mDrawEntryLabels = enabled;
}
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L692-L694
|
d62e305d0e49a3b3e45a1904697c2f5b0db9d3a5
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/chat/AIAssistantPage.ets
|
arkts
|
buildTypingIndicator
|
构建正在输入指示器
|
@Builder
buildTypingIndicator() {
Row({ space: 12 }) {
Circle({ width: 32, height: 32 })
.fill($r('app.color.primary'))
.overlay(
Image($r('app.media.ic_robot'))
.width('20vp')
.height('20vp')
.fillColor(Color.White)
)
Row({ space: 4 }) {
ForEach([1, 2, 3], (index: number) => {
Circle({ width: 6, height: 6 })
.fill($r('app.color.text_secondary'))
.animation({
duration: 600,
curve: Curves.easeInOut,
iterations: -1,
playMode: PlayMode.Alternate
})
.opacity(0.3 + index * 0.2)
})
}
.padding(12)
.backgroundColor(Color.White)
.borderRadius(16)
.shadow({
radius: 4,
color: Color.Black,
offsetX: 0,
offsetY: 2
})
Blank()
}
.width('100%')
.alignItems(VerticalAlign.Center)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTypingIndicator 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 32 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 32 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( 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#Left . overlay ( 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 Image AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_robot' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . width AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '20vp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . height AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '20vp' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . fillColor AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White 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#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#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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 1 AST#expression#Right , AST#expression#Left 2 AST#expression#Right , AST#expression#Left 3 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left 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 Circle ( AST#component_parameters#Left { AST#component_parameter#Left width : AST#expression#Left 6 AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left height : AST#expression#Left 6 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fill ( 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#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 600 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curves AST#expression#Right . easeInOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Alternate AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 0.3 AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right * AST#expression#Left 0.2 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 12 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 4 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Black AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . alignItems ( AST#expression#Left AST#member_expression#Left AST#expression#Left VerticalAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildTypingIndicator() {
Row({ space: 12 }) {
Circle({ width: 32, height: 32 })
.fill($r('app.color.primary'))
.overlay(
Image($r('app.media.ic_robot'))
.width('20vp')
.height('20vp')
.fillColor(Color.White)
)
Row({ space: 4 }) {
ForEach([1, 2, 3], (index: number) => {
Circle({ width: 6, height: 6 })
.fill($r('app.color.text_secondary'))
.animation({
duration: 600,
curve: Curves.easeInOut,
iterations: -1,
playMode: PlayMode.Alternate
})
.opacity(0.3 + index * 0.2)
})
}
.padding(12)
.backgroundColor(Color.White)
.borderRadius(16)
.shadow({
radius: 4,
color: Color.Black,
offsetX: 0,
offsetY: 2
})
Blank()
}
.width('100%')
.alignItems(VerticalAlign.Center)
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/chat/AIAssistantPage.ets#L332-L371
|
50d2355b27b70fd5cf019317c4930adab72ca1d1
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets
|
arkts
|
getGenderLabel
|
获取性别标签
|
private getGenderLabel(gender: Gender): string {
const labels: Record<Gender, string> = {
[Gender.MALE]: '男',
[Gender.FEMALE]: '女',
[Gender.UNKNOWN]: '未知'
};
return labels[gender] || '未知';
}
|
AST#method_declaration#Left private getGenderLabel AST#parameter_list#Left ( AST#parameter#Left gender : AST#type_annotation#Left AST#primary_type#Left Gender 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 labels : 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 Gender AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Gender AST#expression#Right . MALE AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '男' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Gender AST#expression#Right . FEMALE AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '女' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left Gender AST#expression#Right . UNKNOWN AST#member_expression#Right AST#expression#Right ] AST#property_name#Right : AST#expression#Left '未知' 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 AST#binary_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left labels AST#expression#Right [ AST#expression#Left gender AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right || AST#expression#Left '未知' AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private getGenderLabel(gender: Gender): string {
const labels: Record<Gender, string> = {
[Gender.MALE]: '男',
[Gender.FEMALE]: '女',
[Gender.UNKNOWN]: '未知'
};
return labels[gender] || '未知';
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/contacts/ContactDetailPage.ets#L658-L665
|
f9efcc6df0dd391ecf9e90ea65982819dcacd1d2
|
github
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildMemberRemove.ets
|
arkts
|
应用约束:构造函数参数类型声明(错误1)
|
constructor(client: any) {
super(client);
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left client : 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#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( AST#expression#Left client 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#constructor_declaration#Right
|
constructor(client: any) {
super(client);
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildMemberRemove.ets#L11-L13
|
0eae79299df704a6f035241ed5eaa449c240d825
|
github
|
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets
|
arkts
|
getScanInfos
|
扫描wifi
|
async getScanInfos() {
// 不停地扫描wifi
let result: wifi.WifiScanInfo[] = await wifi.getScanInfoList();
if (this.isSwitchOn) {
setTimeout(async () => {
this.wifilist = result
await this.getScanInfos();
}, 3000)
}
}
|
AST#method_declaration#Left async getScanInfos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 不停地扫描wifi AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left result : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left wifi AST#ERROR#Left . WifiScanInfo AST#ERROR#Right [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left wifi AST#expression#Right AST#await_expression#Right AST#expression#Right . getScanInfoList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isSwitchOn 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 setTimeout AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left async 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 . wifilist AST#member_expression#Right = AST#expression#Left result AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . getScanInfos 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 3000 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
|
async getScanInfos() {
let result: wifi.WifiScanInfo[] = await wifi.getScanInfoList();
if (this.isSwitchOn) {
setTimeout(async () => {
this.wifilist = result
await this.getScanInfos();
}, 3000)
}
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ConnectivityKit/Wlan/entry/src/main/ets/pages/AvailableWifi.ets#L32-L42
|
6f8a6162f89de10181932ef99476a896af93165f
|
gitee
|
wangjinyuan/JS-TS-ArkTS-database.git
|
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
|
npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets
|
arkts
|
connectToWebSocket
|
应用约束1:参数添加类型注解
|
connectToWebSocket(token: string, resolve: (value: string) => void, reject: (reason: any) => void): void {
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
this.client.token = token;
// 应用约束26:使用箭头函数
const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300);
this.client.rest.methods.getGateway().then((res: { url: string }) => {
const protocolVersion = Constants.DefaultOptions.ws.version;
const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`;
this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);
this.client.ws.connect(gateway);
this.client.ws.connection.once('error', reject);
this.client.ws.connection.once('close', (event: { code: number }) => {
if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN));
if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD));
if (event.code === 4011) reject(new Error(Constants.Errors.SHARDING_REQUIRED));
}
|
AST#method_declaration#Left connectToWebSocket AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resolve : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left reject : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left reason : 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#function_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 . client 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 AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Events AST#member_expression#Right AST#expression#Right . DEBUG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Authenticated using token AST#template_substitution#Left $ { AST#expression#Left token AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . token AST#member_expression#Right = AST#expression#Left token AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 应用约束26:使用箭头函数 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left timeout = 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 . client AST#member_expression#Right AST#expression#Right . setTimeout AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#call_expression#Left AST#expression#Left reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Errors AST#member_expression#Right AST#expression#Right . TOOK_TOO_LONG 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#arrow_function#Right AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left 1000 AST#expression#Right * AST#expression#Left 300 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#expression_statement#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . rest AST#member_expression#Right AST#expression#Right . methods AST#member_expression#Right AST#expression#Right . getGateway AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#ERROR#Left ( AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left res : AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left url AST#property_name#Right : AST#expression#Left string AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right => { AST#ERROR#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left protocolVersion = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . DefaultOptions AST#member_expression#Right AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . version 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 gateway = AST#expression#Left AST#template_literal#Left ` AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left res AST#expression#Right . url AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right /?v= AST#template_substitution#Left $ { AST#expression#Left protocolVersion AST#expression#Right } AST#template_substitution#Right &encoding= AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left WebSocketConnection AST#expression#Right . ENCODING AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 . client 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 AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Events AST#member_expression#Right AST#expression#Right . DEBUG AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Using gateway AST#template_substitution#Left $ { AST#expression#Left gateway 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . connect AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left gateway 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . connection AST#member_expression#Right AST#expression#Right . once AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'error' AST#expression#Right , AST#expression#Left reject 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . client AST#member_expression#Right AST#expression#Right . ws AST#member_expression#Right AST#expression#Right . connection AST#member_expression#Right AST#expression#Right . once AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left 'close' AST#expression#Right AST#ERROR#Left , AST#ERROR#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left event : AST#ERROR#Right AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left code AST#property_name#Right : AST#expression#Left number AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right => AST#ERROR#Right { AST#property_name#Left if AST#property_name#Right ( event AST#ERROR#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 4004 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 reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Errors AST#member_expression#Right AST#expression#Right . BAD_LOGIN 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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 4010 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 reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Errors AST#member_expression#Right AST#expression#Right . INVALID_SHARD 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#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left event AST#expression#Right . code AST#member_expression#Right AST#expression#Right === AST#expression#Left 4011 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 reject AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . Errors AST#member_expression#Right AST#expression#Right . SHARDING_REQUIRED 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
connectToWebSocket(token: string, resolve: (value: string) => void, reject: (reason: any) => void): void {
this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`);
this.client.token = token;
const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300);
this.client.rest.methods.getGateway().then((res: { url: string }) => {
const protocolVersion = Constants.DefaultOptions.ws.version;
const gateway = `${res.url}/?v=${protocolVersion}&encoding=${WebSocketConnection.ENCODING}`;
this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`);
this.client.ws.connect(gateway);
this.client.ws.connection.once('error', reject);
this.client.ws.connection.once('close', (event: { code: number }) => {
if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN));
if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD));
if (event.code === 4011) reject(new Error(Constants.Errors.SHARDING_REQUIRED));
}
|
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/ClientManager.ets#L46-L66
|
5e06433a6484b736c4521b64ade1884f06121ba2
|
github
|
openharmony/xts_acts
|
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
|
validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets
|
arkts
|
initButtonNotificationRequest
|
init NotificationRequest width buttons
@param notificationContent
@param notificationActionButtons
@return return the created NotificationRequest
|
initButtonNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationActionButtons: notificationManager.NotificationActionButton[]): notificationManager.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) { // 当前通知接口最大允许有两个按钮,超过两个按钮不展示
actionButtons = notificationActionButtons.splice(0, 2)
}
return {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1, // 通知id,默认为1
content: notificationContent,
actionButtons: actionButtons
};
}
|
AST#method_declaration#Left initButtonNotificationRequest AST#parameter_list#Left ( AST#parameter#Left notificationContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left notificationActionButtons : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationActionButton AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left [ ] AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationRequest AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left actionButtons = AST#expression#Left notificationActionButtons 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 notificationActionButtons AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 2 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 actionButtons = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notificationActionButtons AST#expression#Right . splice AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right , AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } 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 slotType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left notification AST#expression#Right . SlotType AST#member_expression#Right AST#expression#Right . CONTENT_INFORMATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left id AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , // 通知id,默认为1 AST#property_assignment#Left AST#property_name#Left content AST#property_name#Right : AST#expression#Left notificationContent AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left actionButtons AST#property_name#Right : AST#expression#Left actionButtons 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
|
initButtonNotificationRequest(notificationContent: notificationManager.NotificationContent, notificationActionButtons: notificationManager.NotificationActionButton[]): notificationManager.NotificationRequest {
let actionButtons = notificationActionButtons
if (notificationActionButtons.length > 2) {
actionButtons = notificationActionButtons.splice(0, 2)
}
return {
slotType: notification.SlotType.CONTENT_INFORMATION,
id: 1,
content: notificationContent,
actionButtons: actionButtons
};
}
|
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationRequestUtil.ets#L57-L68
|
c52d3c45f2035e7914e12ca929738725c9381ae6
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
|
arkts
|
wifiStateObserve
|
WI-FI状态监听
|
wifiStateObserve() {
// 注册WLAN状态改变事件
// 0,未激活;1,已激活;2,激活中;3:去激活中
wifiManager.on("wifiStateChange", (result: number) => {
logger.info("NetUtils", "wifiStateChange: " + result);
this.postEvent(NetworkEventName.WifiStateChange, result);
});
// 注册WLAN连接状态改变事件
// 0,已断开;1,已连接
wifiManager.on("wifiConnectionChange", (result: number) => {
logger.info("NetUtils", "wifiConnectionChange: " + result);
this.postEvent(NetworkEventName.WifiConnectionChange, result);
});
}
|
AST#method_declaration#Left wifiStateObserve AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 注册WLAN状态改变事件 // 0,未激活;1,已激活;2,激活中;3:去激活中 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wifiManager AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "wifiStateChange" AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : 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 "NetUtils" AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left "wifiStateChange: " AST#expression#Right + AST#expression#Left result AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postEvent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetworkEventName AST#expression#Right . WifiStateChange AST#member_expression#Right AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right // 注册WLAN连接状态改变事件 // 0,已断开;1,已连接 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left wifiManager AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "wifiConnectionChange" AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left result : 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 "NetUtils" AST#expression#Right , AST#expression#Left AST#binary_expression#Left AST#expression#Left "wifiConnectionChange: " AST#expression#Right + AST#expression#Left result AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postEvent AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left NetworkEventName AST#expression#Right . WifiConnectionChange AST#member_expression#Right AST#expression#Right , AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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
|
wifiStateObserve() {
wifiManager.on("wifiStateChange", (result: number) => {
logger.info("NetUtils", "wifiStateChange: " + result);
this.postEvent(NetworkEventName.WifiStateChange, result);
});
wifiManager.on("wifiConnectionChange", (result: number) => {
logger.info("NetUtils", "wifiConnectionChange: " + result);
this.postEvent(NetworkEventName.WifiConnectionChange, result);
});
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L333-L346
|
9e5ffa3d5af13eb7a0f495670aa8392a3ba173bb
|
gitee
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets
|
arkts
|
[Start Case3_start] Data structure of user information UserData
|
export interface UserData {
id: string;
username: string;
description: string;
// ...
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface UserData 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#type_member#Left username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left description : 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 UserData {
id: string;
username: string;
description: string;
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets#L27-L32
|
24a296d8be8b670ff81afb25904481e3b1629d0e
|
gitee
|
|
queueit/harmony-sdk.git
|
ba7b4b38c03730bfbe305789acba6db0012d5f5c
|
queueit_sdk/src/main/ets/main/QueueItEngine.ets
|
arkts
|
run
|
--- Public API Methods ---
|
public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
}
|
AST#method_declaration#Left public async run AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . debug AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left QueueItEngine AST#expression#Right . TAG AST#member_expression#Right AST#expression#Right , AST#expression#Left "run() called" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . runWithConnection AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left undefined AST#expression#Right , AST#expression#Left undefined AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public async run(): Promise<void> {
Logger.debug(QueueItEngine.TAG, "run() called");
await this.runWithConnection(undefined, undefined);
}
|
https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/queueit_sdk/src/main/ets/main/QueueItEngine.ets#L73-L76
|
7fae51f8cfee3a06cea4e23ea726f26c8a8bc415
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/views/main/sub/list/SubListOneView.ets
|
arkts
|
@Monitor('sectionWords') onChangeOfWords(){ this.indexers = this.sectionWords.allSections().map(v=>v.charAt(0).toUpperCase()) }
|
build() {
Stack(){
this.buildList()
if (this.indexers.length > 0){
// 字母表索引组件
Row(){
AlphabetIndexer({
arrayValue: this.indexers,
selected: this.selectedIndexOfIndexers
})
.onSelect((index: number) => {
// 点击字母时滚动到对应位置(这里简单映射)
this.scroller.scrollToIndex(index);
})
}
.hitTestBehavior(HitTestMode.Transparent)
.justifyContent(FlexAlign.End)
.width('100%')
}
}
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) 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 . buildList 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 . indexers AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 字母表索引组件 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AlphabetIndexer ( AST#component_parameters#Left { AST#component_parameter#Left arrayValue : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . indexers AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left selected : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectedIndexOfIndexers AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onSelect ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#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 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#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 . hitTestBehavior ( AST#expression#Left AST#member_expression#Left AST#expression#Left HitTestMode AST#expression#Right . Transparent 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 . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Stack(){
this.buildList()
if (this.indexers.length > 0){
Row(){
AlphabetIndexer({
arrayValue: this.indexers,
selected: this.selectedIndexOfIndexers
})
.onSelect((index: number) => {
this.scroller.scrollToIndex(index);
})
}
.hitTestBehavior(HitTestMode.Transparent)
.justifyContent(FlexAlign.End)
.width('100%')
}
}
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/list/SubListOneView.ets#L38-L60
|
0ab4d0d00b217834f788bf692a7a2237e9c3e45b
|
github
|
|
openharmony-tpc/ImageKnife
|
bc55de9e2edd79ed4646ce37177ad94b432874f7
|
library/src/main/ets/utils/FileUtils.ets
|
arkts
|
getFileSizeSync
|
获取path的文件大小
@param path 文件绝对路径
|
getFileSizeSync(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
LogUtil.error('FileUtils getFileSize e ' + e)
return -1
}
}
|
AST#method_declaration#Left getFileSizeSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number 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 stat = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left fs AST#expression#Right . statSync AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left path AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left stat AST#expression#Right . size AST#member_expression#Right AST#expression#Right AST#return_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 LogUtil AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left 'FileUtils getFileSize e ' AST#expression#Right + AST#expression#Left e AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
getFileSizeSync(path: string): number {
try {
let stat = fs.statSync(path)
return stat.size
} catch (e) {
LogUtil.error('FileUtils getFileSize e ' + e)
return -1
}
}
|
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/FileUtils.ets#L132-L140
|
4af5c250e12cac60b979597b111e455d08bb10d7
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
spinkit/src/main/ets/components/SpinK.ets
|
arkts
|
SpinK
|
TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01
|
@ComponentV2
export struct SpinK {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0;
@Local opacity6: number = 0;
@Local opacity7: number = 0;
@Local opacity8: number = 0;
@Local opacity9: number = 0;
@Local opacity10: number = 0;
@Local opacity11: number = 0;
@Local opacity12: number = 0;
aboutToAppear(): void {
this.round1 = this.spinSize * 0.14
}
build() {
Stack() {
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity1)
}
.frameStyle()
.rotate({ angle: 0 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity2)
}
.frameStyle()
.rotate({ angle: 30 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity3)
}
.frameStyle()
.rotate({ angle: 60 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity4)
}
.frameStyle()
.rotate({ angle: 90 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity5)
}
.frameStyle()
.rotate({ angle: 120 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity6)
}
.frameStyle()
.rotate({ angle: 150 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity7)
}
.frameStyle()
.rotate({ angle: 180 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity8)
}
.frameStyle()
.rotate({ angle: 210 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity9)
}
.frameStyle()
.rotate({ angle: 240 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity10)
}
.frameStyle()
.rotate({ angle: 270 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity11)
}
.frameStyle()
.rotate({ angle: 300 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity12)
}
.frameStyle()
.rotate({ angle: 330 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity1 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity1 = 0
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity2 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity2 = 0
}
}];
let keyframes3: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity3 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity3 = 0
}
}];
let keyframes4: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity4 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity4 = 0
}
}];
let keyframes5: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity5 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity5 = 0
}
}];
let keyframes6: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity6 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity6 = 0
}
}];
let keyframes7: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity7 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity7 = 0
}
}];
let keyframes8: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity8 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity8 = 0
}
}];
let keyframes9: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity9 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity9 = 0
}
}];
let keyframes10: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity10 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity10 = 0
}
}];
let keyframes11: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity11 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity11 = 0
}
}];
let keyframes12: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity12 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity12 = 0
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1100 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1000 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -900 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -800 }, keyframes5);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -700 }, keyframes6);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -600 }, keyframes7);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -500 }, keyframes8);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -400 }, keyframes9);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -300 }, keyframes10);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -200 }, keyframes11);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -100 }, keyframes12);
})
}
@Styles
roundStyle(){
.width(this.round1)
.height(this.round1)
.borderRadius(this.round1)
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
@Styles
frameStyle(){
.height('100%')
.width(this.round1)
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinK AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 36 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinColor : AST#type_annotation#Left AST#primary_type#Left ResourceColor AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right round1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.14 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right opacity1 : 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 opacity2 : 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 opacity3 : 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 opacity4 : 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 opacity5 : 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 opacity6 : 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 opacity7 : 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 opacity8 : 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 opacity9 : 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 opacity10 : 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 opacity11 : 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 opacity12 : 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#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 . round1 AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right * AST#expression#Left 0.14 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 30 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 60 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 90 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 120 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 150 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 180 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 210 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 240 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity10 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 270 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity11 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle 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#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Canvas ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . roundStyle ( ) AST#modifier_chain_expression#Left . opacity ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity12 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . frameStyle ( ) AST#modifier_chain_expression#Left . rotate ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left angle AST#property_name#Right : AST#expression#Left 330 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . renderFit ( AST#expression#Left AST#member_expression#Left AST#expression#Left RenderFit 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 this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onAppear ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes1 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity1 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes2 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity2 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes3 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity3 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes4 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity4 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes5 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity5 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes6 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity6 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes7 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity7 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes8 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity8 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes9 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity9 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes10 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity10 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity10 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes11 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity11 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity11 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left keyframes12 : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left KeyframeState AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 480 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity12 AST#member_expression#Right = AST#expression#Left 1 AST#expression#Right AST#assignment_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 720 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Linear AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left event AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . opacity12 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#property_assignment#Right } AST#object_literal#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1100 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1000 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes3 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 900 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 800 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes5 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 700 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes6 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 600 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes7 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 500 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes8 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 400 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes9 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 300 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes10 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 200 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes11 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . keyframeAnimateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 1 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left delay AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 100 AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left keyframes12 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right roundStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . spinColor AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#member_expression#Left AST#expression#Left ShadowStyle AST#expression#Right . OUTER_DEFAULT_XS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right frameStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . round1 AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right } AST#extend_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@ComponentV2
export struct SpinK {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.14
@Local opacity1: number = 0;
@Local opacity2: number = 0;
@Local opacity3: number = 0;
@Local opacity4: number = 0;
@Local opacity5: number = 0;
@Local opacity6: number = 0;
@Local opacity7: number = 0;
@Local opacity8: number = 0;
@Local opacity9: number = 0;
@Local opacity10: number = 0;
@Local opacity11: number = 0;
@Local opacity12: number = 0;
aboutToAppear(): void {
this.round1 = this.spinSize * 0.14
}
build() {
Stack() {
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity1)
}
.frameStyle()
.rotate({ angle: 0 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity2)
}
.frameStyle()
.rotate({ angle: 30 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity3)
}
.frameStyle()
.rotate({ angle: 60 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity4)
}
.frameStyle()
.rotate({ angle: 90 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity5)
}
.frameStyle()
.rotate({ angle: 120 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity6)
}
.frameStyle()
.rotate({ angle: 150 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity7)
}
.frameStyle()
.rotate({ angle: 180 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity8)
}
.frameStyle()
.rotate({ angle: 210 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity9)
}
.frameStyle()
.rotate({ angle: 240 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity10)
}
.frameStyle()
.rotate({ angle: 270 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity11)
}
.frameStyle()
.rotate({ angle: 300 })
Column() {
Canvas()
.roundStyle()
.opacity(this.opacity12)
}
.frameStyle()
.rotate({ angle: 330 })
}
.renderFit(RenderFit.CENTER)
.width(this.spinSize)
.height(this.spinSize)
.onAppear(() => {
let keyframes1: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity1 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity1 = 0
}
}];
let keyframes2: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity2 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity2 = 0
}
}];
let keyframes3: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity3 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity3 = 0
}
}];
let keyframes4: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity4 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity4 = 0
}
}];
let keyframes5: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity5 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity5 = 0
}
}];
let keyframes6: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity6 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity6 = 0
}
}];
let keyframes7: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity7 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity7 = 0
}
}];
let keyframes8: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity8 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity8 = 0
}
}];
let keyframes9: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity9 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity9 = 0
}
}];
let keyframes10: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity10 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity10 = 0
}
}];
let keyframes11: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity11 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity11 = 0
}
}];
let keyframes12: Array<KeyframeState> = [
{
duration: 480,
curve: Curve.Linear,
event: () => {
this.opacity12 = 1
}
},
{
duration: 720,
curve: Curve.Linear,
event: () => {
this.opacity12 = 0
}
}];
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: 0 }, keyframes1);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1100 }, keyframes2);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -1000 }, keyframes3);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -900 }, keyframes4);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -800 }, keyframes5);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -700 }, keyframes6);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -600 }, keyframes7);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -500 }, keyframes8);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -400 }, keyframes9);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -300 }, keyframes10);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -200 }, keyframes11);
this.getUIContext().keyframeAnimateTo({ iterations: -1, delay: -100 }, keyframes12);
})
}
@Styles
roundStyle(){
.width(this.round1)
.height(this.round1)
.borderRadius(this.round1)
.backgroundColor(this.spinColor)
.shadow(ShadowStyle.OUTER_DEFAULT_XS)
}
@Styles
frameStyle(){
.height('100%')
.width(this.round1)
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinK.ets#L21-L354
|
9eb2af9706c1f3b05236153ee5f272f50581ad40
|
gitee
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
|
arkts
|
unshiftData
|
向数组第一个位置插入数据
|
public unshiftData(data: T): void {
this.originDataArray.unshift(data);
this.notifyDataAdd(0);
}
|
AST#method_declaration#Left public unshiftData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . originDataArray AST#member_expression#Right AST#expression#Right . unshift AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left data AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . notifyDataAdd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
public unshiftData(data: T): void {
this.originDataArray.unshift(data);
this.notifyDataAdd(0);
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L83-L86
|
98d6faa678009f0319bebe9788da2f72738b19a0
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets
|
arkts
|
Time operation tool class.
|
export class DateUtils {
/**
* Obtaining time.
*
* @param {number} days Days.
* @return Return the specific year, month, day, and time.
*/
getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class DateUtils AST#class_body#Left { /**
* Obtaining time.
*
* @param {number} days Days.
* @return Return the specific year, month, day, and time.
*/ AST#method_declaration#Left getDate AST#parameter_list#Left ( AST#parameter#Left days : 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 date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#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#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Date AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getTime AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right - AST#expression#Left AST#binary_expression#Left AST#expression#Left days AST#expression#Right * AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . TODAY_MILLI_SECOND 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 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 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 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#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#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 CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . MONTH_PLUS_ONE 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 day : 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 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 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#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left '' AST#expression#Right + AST#expression#Left year AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left month AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left day AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class DateUtils {
getDate(days: number) {
let date: Date = new Date(new Date().getTime() - days * CommonConstants.TODAY_MILLI_SECOND);
let year: number = date.getFullYear();
let month: number = date.getMonth() + CommonConstants.MONTH_PLUS_ONE;
let day: number = date.getDate();
return '' + year + month + day;
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/DateUtils.ets#L21-L35
|
7987296a072346904293c9dbc0d947c87c441dfc
|
gitee
|
|
harmonyos_samples/BestPracticeSnippets
|
490ea539a6d4427dd395f3dac3cf4887719f37af
|
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
|
arkts
|
toggleLowDefinition
|
[Start toggle_low_definition]
|
toggleLowDefinition() {
this.videoSrc = $rawfile('lowQuality.mp4');
}
|
AST#method_declaration#Left toggleLowDefinition AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . videoSrc AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left $rawfile AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'lowQuality.mp4' 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
|
toggleLowDefinition() {
this.videoSrc = $rawfile('lowQuality.mp4');
}
|
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L126-L128
|
d6310caf33da9053ce234f08426f25822acf7753
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
feature/main/src/main/ets/navigation/MainGraph.ets
|
arkts
|
register
|
注册主模块导航路由
@returns {void} 无返回值
|
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
}
|
AST#method_declaration#Left register 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 RouteBuild AST#expression#Right . register AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left MainRoutes AST#expression#Right . Main AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left wrapBuilder AST#expression#Right AST#argument_list#Left ( AST#expression#Left MainNav 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
|
register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/navigation/MainGraph.ets#L14-L16
|
6788baad333c42f7ec58e85e1cb8e17a9fb52059
|
github
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/settings/SettingsService.ets
|
arkts
|
mergeAccessibilitySettings
|
合并无障碍设置
|
private mergeAccessibilitySettings(current: AccessibilitySettings, updates: Partial<AccessibilitySettings>): AccessibilitySettings {
const result: AccessibilitySettings = {
highContrast: updates.highContrast !== undefined ? updates.highContrast : current.highContrast,
largeText: updates.largeText !== undefined ? updates.largeText : current.largeText,
screenReader: updates.screenReader !== undefined ? updates.screenReader : current.screenReader,
reducedMotion: updates.reducedMotion !== undefined ? updates.reducedMotion : current.reducedMotion,
colorBlindSupport: updates.colorBlindSupport !== undefined ? updates.colorBlindSupport : current.colorBlindSupport
};
return result;
}
|
AST#method_declaration#Left private mergeAccessibilitySettings AST#parameter_list#Left ( AST#parameter#Left current : AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left updates : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AccessibilitySettings 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 AccessibilitySettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left result : 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#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 updates AST#expression#Right . highContrast AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . highContrast AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . highContrast AST#member_expression#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#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 updates AST#expression#Right . largeText AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . largeText AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . largeText AST#member_expression#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#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 updates AST#expression#Right . screenReader AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . screenReader AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . screenReader AST#member_expression#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#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 updates AST#expression#Right . reducedMotion AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . reducedMotion AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . reducedMotion AST#member_expression#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#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 updates AST#expression#Right . colorBlindSupport AST#member_expression#Right AST#expression#Right !== AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left updates AST#expression#Right . colorBlindSupport AST#member_expression#Right AST#expression#Right : AST#expression#Left current AST#expression#Right AST#conditional_expression#Right AST#expression#Right . colorBlindSupport 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#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 mergeAccessibilitySettings(current: AccessibilitySettings, updates: Partial<AccessibilitySettings>): AccessibilitySettings {
const result: AccessibilitySettings = {
highContrast: updates.highContrast !== undefined ? updates.highContrast : current.highContrast,
largeText: updates.largeText !== undefined ? updates.largeText : current.largeText,
screenReader: updates.screenReader !== undefined ? updates.screenReader : current.screenReader,
reducedMotion: updates.reducedMotion !== undefined ? updates.reducedMotion : current.reducedMotion,
colorBlindSupport: updates.colorBlindSupport !== undefined ? updates.colorBlindSupport : current.colorBlindSupport
};
return result;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L602-L611
|
0a8964401c201c75da8dcad8a44ffd0f3621a6ff
|
github
|
ashcha0/line-inspection-terminal-frontend_arkts.git
|
c82616097e8a3b257b7b01e75b6b83ce428b518c
|
entry/src/main/ets/utils/HttpUtil.ets
|
arkts
|
post
|
POST请求
|
static post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig);
}
|
AST#method_declaration#Left static post AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left HttpResponse AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left postConfig : AST#type_annotation#Left AST#primary_type#Left RequestConfig AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left method AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left http AST#expression#Right . RequestMethod AST#member_expression#Right AST#expression#Right . POST AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left headers AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . headers AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left timeout AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left config AST#expression#Right . timeout AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left data AST#property_name#Right : AST#expression#Left data 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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left HttpUtil AST#expression#Right . request AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left url AST#expression#Right , AST#expression#Left postConfig 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 post<T = Object>(url: string, data?: Object, config: RequestConfig = {}): Promise<HttpResponse<T>> {
const postConfig: RequestConfig = {
method: http.RequestMethod.POST,
headers: config.headers,
timeout: config.timeout,
data: data
};
return HttpUtil.request<T>(url, postConfig);
}
|
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/utils/HttpUtil.ets#L142-L150
|
f42007a9f539a102d59fd738f78e16c4aec432ce
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets
|
arkts
|
功能数据类
|
export class FeatureDataType {
image: Resource;
text: ResourceStr;
constructor(image: Resource, text: ResourceStr) {
this.image = image;
this.text = text;
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class FeatureDataType AST#class_body#Left { AST#property_declaration#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_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_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 . image AST#member_expression#Right = AST#expression#Left image 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 . text 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#constructor_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class FeatureDataType {
image: Resource;
text: ResourceStr;
constructor(image: Resource, text: ResourceStr) {
this.image = image;
this.text = text;
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/model/DataType.ets#L46-L54
|
c0423f55f6f2d9142b31898f026284ed3c241b69
|
gitee
|
|
Piagari/arkts_example.git
|
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
|
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets
|
arkts
|
startServer
|
启动服务器
|
async startServer(serverIp: string, serverPort: number) {
let ipAddress: socket.NetAddress = {
address: serverIp,
port: serverPort
};
try {
await this.tcpServer.listen(ipAddress);
console.info('服务器启动成功');
// 服务器启动成功后的处理逻辑
this.tcpServer.on('connect', (connection: socket.TCPSocketConnection) => {
connection.on('message', (data: socket.SocketMessageInfo) => {
const message = this.buf2String(data.message);
this.dataList.push({
name: '服务端',
msgType: 0,
self: false,
msg: message
});
});
});
} catch (err) {
console.info('服务器启动失败');
// 服务器启动失败的处理逻辑,如显示错误提示
}
}
|
AST#method_declaration#Left async startServer AST#parameter_list#Left ( AST#parameter#Left serverIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left serverPort : 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 ipAddress : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . NetAddress 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 address AST#property_name#Right : AST#expression#Left serverIp AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left port AST#property_name#Right : AST#expression#Left serverPort AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#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 . tcpServer AST#member_expression#Right AST#expression#Right . listen AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ipAddress AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '服务器启动成功' AST#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 . tcpServer AST#member_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'connect' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left connection : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . TCPSocketConnection AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left connection AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'message' AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left socket . SocketMessageInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left message = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buf2String 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 . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataList 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 name AST#property_name#Right : AST#expression#Left '服务端' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msgType AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left self AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left msg AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( err ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '服务器启动失败' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 服务器启动失败的处理逻辑,如显示错误提示 } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async startServer(serverIp: string, serverPort: number) {
let ipAddress: socket.NetAddress = {
address: serverIp,
port: serverPort
};
try {
await this.tcpServer.listen(ipAddress);
console.info('服务器启动成功');
this.tcpServer.on('connect', (connection: socket.TCPSocketConnection) => {
connection.on('message', (data: socket.SocketMessageInfo) => {
const message = this.buf2String(data.message);
this.dataList.push({
name: '服务端',
msgType: 0,
self: false,
msg: message
});
});
});
} catch (err) {
console.info('服务器启动失败');
}
}
|
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/contact/label/LabelCreatedPage.ets#L36-L60
|
4d148e4bdbc2012cf35cbd0ef6ba449278e3ea5b
|
github
|
openharmony/interface_sdk-js
|
c349adc73e2ec1f61f6fca489b5af059e3ed6999
|
arkts/@arkts.utils.d.ets
|
arkts
|
request
|
Find or create an instance of AsyncLock using the specified name.
@param { string } name - name of the lock to find or create.
@returns { AsyncLock } Returns an instance of AsyncLock.
@static
@syscap SystemCapability.Utils.Lang
@atomicservice
@since 12
Find or create an instance of AsyncLock using the specified name.
@param { string } name - name of the lock to find or create.
@returns { AsyncLock } Returns an instance of AsyncLock.
@static
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 18
|
static request(name: string): AsyncLock;
|
AST#method_declaration#Left static request 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AsyncLock AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
|
static request(name: string): AsyncLock;
|
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.utils.d.ets#L126-L126
|
9bdc953b49477b8b127d2ce5cc8569ac47c8ccd0
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/services/settings/SettingsService.ets
|
arkts
|
resetToDefault
|
重置为默认设置
@returns 重置后的设置
|
async resetToDefault(): Promise<AppSettings> {
try {
const defaultSettings = this.createDefaultSettings();
await this.saveSettings(defaultSettings);
this.settings = defaultSettings;
hilog.info(0x0001, 'BirthdayReminder', 'Settings reset to default');
return defaultSettings;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to reset settings: ${businessError.message}`);
throw new Error(`Failed to reset settings: ${businessError.message}`);
}
}
|
AST#method_declaration#Left async resetToDefault 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 AppSettings AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left defaultSettings = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createDefaultSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . saveSettings AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left defaultSettings 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 . settings AST#member_expression#Right = AST#expression#Left defaultSettings 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0001 AST#expression#Right , AST#expression#Left 'BirthdayReminder' AST#expression#Right , AST#expression#Left 'Settings reset to default' 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 defaultSettings AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left businessError = AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0x0001 AST#expression#Right , AST#expression#Left 'BirthdayReminder' AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to reset settings: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#throw_statement#Left throw AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Error AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` Failed to reset settings: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left businessError AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#throw_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async resetToDefault(): Promise<AppSettings> {
try {
const defaultSettings = this.createDefaultSettings();
await this.saveSettings(defaultSettings);
this.settings = defaultSettings;
hilog.info(0x0001, 'BirthdayReminder', 'Settings reset to default');
return defaultSettings;
} catch (error) {
const businessError = error as BusinessError;
hilog.error(0x0001, 'BirthdayReminder', `Failed to reset settings: ${businessError.message}`);
throw new Error(`Failed to reset settings: ${businessError.message}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L343-L356
|
a2f0e56d5ca328e28dcb6643cdd3b48b2559b1c9
|
github
|
KoStudio/ArkTS-WordTree.git
|
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
|
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets
|
arkts
|
get
|
/ 获取主名+第一层扩展名(去除最外层扩展) / - "Book.sqlite" → "Book" / - "Book.sqlite.zip" → "Book.sqlite"
|
get baseNameWithInnerExtension(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null;
}
|
AST#method_declaration#Left get AST#ERROR#Left b as eNameWithInnerExtension AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . fileName AST#member_expression#Right AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CMetaInfoHelper AST#expression#Right . baseNameWithInnerExtension 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 . fileName AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#conditional_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
get baseNameWithInnerExtension(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseNameWithInnerExtension(this.fileName) : null;
}
|
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L28-L30
|
a3c1cabc118477028c567b8964e3fc829580594f
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets
|
arkts
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -24 },
primaryButton: {
value: $r('app.string.cancel'),
action: () => {
}
},
secondaryButton: {
value: $r('app.string.confirm'),
action: () => {
action();
}
}
}
)
}
|
AST#export_declaration#Left export AST#function_declaration#Left function showAlertDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left action : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#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 AlertDialog AST#expression#Right . show AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left title AST#property_name#Right : AST#expression#Left title AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left message AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 24 AST#expression#Right AST#unary_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 primaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.cancel' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left secondaryButton AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left value AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.confirm' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left action AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left action 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#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#function_declaration#Right AST#export_declaration#Right
|
export function showAlertDialog(title: Resource | string, message: Resource | string, action: () => void) {
AlertDialog.show(
{
title: title,
message: message,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -24 },
primaryButton: {
value: $r('app.string.cancel'),
action: () => {
}
},
secondaryButton: {
value: $r('app.string.confirm'),
action: () => {
action();
}
}
}
)
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/AlertDialogUtil.ets#L16-L36
|
975106eb85f6281270882282041135ce0bb9675d
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/Index.ets
|
arkts
|
buildContactsList
|
联系人列表
|
@Builder
buildContactsList() {
Column({ space: 16 }) {
Row() {
Text('联系人列表')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`共 ${this.getFilteredContacts().length} 人`)
.fontSize(14)
.fontColor(this.COLORS.textSecondary)
}
.width('100%')
// 联系人卡片列表
Column({ space: 12 }) {
ForEach(this.getFilteredContacts(), (contact: Contact) => {
this.buildContactCard(contact)
}, (contact: Contact) => contact.id)
}
.width('100%')
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactsList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 16 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '联系人列表' AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 18 AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Medium AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textPrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . layoutWeight ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#template_literal#Left ` 共 AST#template_substitution#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 . getFilteredContacts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right 人 ` AST#template_literal#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 14 AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . textSecondary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right // 联系人卡片列表 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 12 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getFilteredContacts AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . buildContactCard AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left contact AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left contact : AST#type_annotation#Left AST#primary_type#Left Contact 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 contact 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#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left '100%' AST#expression#Right ) AST#modifier_chain_expression#Left . padding ( AST#expression#Left 20 AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . COLORS AST#member_expression#Right AST#expression#Right . whitePrimary AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left 16 AST#expression#Right ) AST#modifier_chain_expression#Left . shadow ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 8 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left 'rgba(0,0,0,0.08)' AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetX AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offsetY AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buildContactsList() {
Column({ space: 16 }) {
Row() {
Text('联系人列表')
.fontSize(18)
.fontWeight(FontWeight.Medium)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Text(`共 ${this.getFilteredContacts().length} 人`)
.fontSize(14)
.fontColor(this.COLORS.textSecondary)
}
.width('100%')
Column({ space: 12 }) {
ForEach(this.getFilteredContacts(), (contact: Contact) => {
this.buildContactCard(contact)
}, (contact: Contact) => contact.id)
}
.width('100%')
}
.width('100%')
.padding(20)
.backgroundColor(this.COLORS.whitePrimary)
.borderRadius(16)
.shadow({
radius: 8,
color: 'rgba(0,0,0,0.08)',
offsetX: 0,
offsetY: 2
})
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1998-L2032
|
c2f3d863bf15130647c472e74b743db5fa8793d2
|
github
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_web/src/main/ets/utils/DownloadUtils.ets
|
arkts
|
onAbilityLifecycle
|
注册监听应用内生命周期。
|
static onAbilityLifecycle(context: common.UIAbilityContext) {
try {
const abilityLifecycleCallback: AbilityLifecycleCallback = {
onAbilityCreate: (ability: UIAbility): void => {
},
onNewWant:(ability: UIAbility): void => {
const parameters = ability.lastRequestWant.parameters;
if (parameters) {
const fileActionType = parameters["fileActionType"];
const uri = parameters["uri"] as string;
if (fileActionType === FileActionType.Preview && uri) {
Tools.openPreviewEasy(uri);
} else if (fileActionType === FileActionType.Save && uri) {
const filePath = FileUtils.getFilePath(uri);
Tools.saveDownload(filePath);
}
}
},
onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => {
const parameters = ability.lastRequestWant.parameters;
if (parameters) {
const fileActionType = parameters["fileActionType"];
const uri = parameters["uri"] as string;
if (fileActionType === FileActionType.Preview && uri) {
Tools.openPreviewEasy(uri);
} else if (fileActionType === FileActionType.Save && uri) {
const filePath = FileUtils.getFilePath(uri);
Tools.saveDownload(filePath);
}
}
},
onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onAbilityDestroy: (ability: UIAbility): void => {
},
onAbilityForeground: (ability: UIAbility): void => {
},
onAbilityBackground: (ability: UIAbility): void => {
},
onAbilityContinue: (ability: UIAbility): void => {
}
}
context.getApplicationContext().on('abilityLifecycle', abilityLifecycleCallback);
} catch (e) {
let err = e as BusinessError;
Tools.logError(`onAbilityLifecycle- 异常:${err.code} - ${err.message}`);
}
}
|
AST#method_declaration#Left static onAbilityLifecycle AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left abilityLifecycleCallback : AST#type_annotation#Left AST#primary_type#Left AbilityLifecycleCallback AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onAbilityCreate AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onNewWant AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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 parameters = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . lastRequestWant AST#member_expression#Right AST#expression#Right . parameters 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 parameters AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileActionType = AST#expression#Left AST#subscript_expression#Left AST#expression#Left parameters AST#expression#Right [ AST#expression#Left "fileActionType" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uri = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left parameters AST#expression#Right [ AST#expression#Left "uri" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 fileActionType AST#expression#Right === AST#expression#Left FileActionType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Preview AST#member_expression#Right AST#expression#Right && AST#expression#Left uri 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 Tools AST#expression#Right . openPreviewEasy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left fileActionType AST#expression#Right === AST#expression#Left FileActionType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Save AST#member_expression#Right AST#expression#Right && AST#expression#Left uri 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 filePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . getFilePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 Tools AST#expression#Right . saveDownload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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#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 onWindowStageCreate AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left parameters = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left ability AST#expression#Right . lastRequestWant AST#member_expression#Right AST#expression#Right . parameters 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 parameters AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left fileActionType = AST#expression#Left AST#subscript_expression#Left AST#expression#Left parameters AST#expression#Right [ AST#expression#Left "fileActionType" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left uri = AST#expression#Left AST#as_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left parameters AST#expression#Right [ AST#expression#Left "uri" AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 fileActionType AST#expression#Right === AST#expression#Left FileActionType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Preview AST#member_expression#Right AST#expression#Right && AST#expression#Left uri 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 Tools AST#expression#Right . openPreviewEasy AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left fileActionType AST#expression#Right === AST#expression#Left FileActionType AST#expression#Right AST#binary_expression#Right AST#expression#Right . Save AST#member_expression#Right AST#expression#Right && AST#expression#Left uri 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 filePath = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left FileUtils AST#expression#Right . getFilePath AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left uri AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right 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 Tools AST#expression#Right . saveDownload AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left filePath AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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#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 onWindowStageActive AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onWindowStageInactive AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onWindowStageDestroy AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , 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#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAbilityDestroy AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAbilityForeground AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAbilityBackground AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onAbilityContinue AST#property_name#Right : AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left ability : AST#type_annotation#Left AST#primary_type#Left UIAbility 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#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right AST#ERROR#Left context AST#ERROR#Right . getApplicationContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . on AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'abilityLifecycle' AST#expression#Right , AST#expression#Left abilityLifecycleCallback AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( e ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left err = AST#expression#Left AST#as_expression#Left AST#expression#Left e AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Tools AST#expression#Right . logError AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` onAbilityLifecycle- 异常: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . code AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right - AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static onAbilityLifecycle(context: common.UIAbilityContext) {
try {
const abilityLifecycleCallback: AbilityLifecycleCallback = {
onAbilityCreate: (ability: UIAbility): void => {
},
onNewWant:(ability: UIAbility): void => {
const parameters = ability.lastRequestWant.parameters;
if (parameters) {
const fileActionType = parameters["fileActionType"];
const uri = parameters["uri"] as string;
if (fileActionType === FileActionType.Preview && uri) {
Tools.openPreviewEasy(uri);
} else if (fileActionType === FileActionType.Save && uri) {
const filePath = FileUtils.getFilePath(uri);
Tools.saveDownload(filePath);
}
}
},
onWindowStageCreate: (ability: UIAbility, windowStage: window.WindowStage): void => {
const parameters = ability.lastRequestWant.parameters;
if (parameters) {
const fileActionType = parameters["fileActionType"];
const uri = parameters["uri"] as string;
if (fileActionType === FileActionType.Preview && uri) {
Tools.openPreviewEasy(uri);
} else if (fileActionType === FileActionType.Save && uri) {
const filePath = FileUtils.getFilePath(uri);
Tools.saveDownload(filePath);
}
}
},
onWindowStageActive: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onWindowStageInactive: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onWindowStageDestroy: (ability: UIAbility, windowStage: window.WindowStage): void => {
},
onAbilityDestroy: (ability: UIAbility): void => {
},
onAbilityForeground: (ability: UIAbility): void => {
},
onAbilityBackground: (ability: UIAbility): void => {
},
onAbilityContinue: (ability: UIAbility): void => {
}
}
context.getApplicationContext().on('abilityLifecycle', abilityLifecycleCallback);
} catch (e) {
let err = e as BusinessError;
Tools.logError(`onAbilityLifecycle- 异常:${err.code} - ${err.message}`);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L39-L98
|
9e97a673e7323a11791be289c2a6acfcef39a46e
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets
|
arkts
|
buttonBar
|
保存或取消保存的操作栏。
|
@Builder
buttonBar() {
Row() {
SaveButton({
icon: SaveIconStyle.FULL_FILLED,
text: SaveDescription.SAVE_IMAGE,
buttonType: ButtonType.Capsule
})
.onClick(async (event, result) => {
this.saveSnapshot(result);
})
.padding({
left: Constants.BUTTON_BAR_PADDING,
right: Constants.BUTTON_BAR_PADDING
})
.width(Constants.SAVE_BUTTON_WIDTH)
Button($r('app.string.web_page_snap_shot_web_snap_cancel'))
.width(Constants.BUTTON_WIDTH)
.onClick(() => {
// 恢复一切状态
this.closeSnapPopup();
})
}
.justifyContent(FlexAlign.SpaceEvenly)
.width(this.snapPopupWidth)
.height(Constants.BUTTON_BAR_HEIGHT)
.padding({
top: Constants.BUTTON_BAR_PADDING,
bottom: Constants.BUTTON_BAR_PADDING
})
.backgroundColor($r('app.string.web_page_snap_shot_web_snap_window_bottom_backgrounp_color'))
.animation({
duration: Constants.ANIMATE_DURATION,
curve: Curve.Friction
})
.borderRadius({
bottomLeft: Constants.BORDER_RADIUS,
bottomRight: Constants.BORDER_RADIUS
})
.transition(TransitionEffect.OPACITY.animation({
duration: Constants.ANIMATE_DURATION,
curve: Curve.Ease
})
.combine(TransitionEffect.scale({ y: Constants.BUTTON_BAR_SCALE }))
)
.visibility(this.showPreview ? Visibility.Visible : Visibility.Hidden)
}
|
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buttonBar 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 SaveButton ( AST#component_parameters#Left { AST#component_parameter#Left icon : AST#expression#Left AST#member_expression#Left AST#expression#Left SaveIconStyle AST#expression#Right . FULL_FILLED AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left SaveDescription AST#expression#Right . SAVE_IMAGE AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left buttonType : AST#expression#Left AST#member_expression#Left AST#expression#Left ButtonType AST#expression#Right . Capsule AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left async AST#parameter_list#Left ( AST#parameter#Left event AST#parameter#Right , AST#parameter#Left result AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . saveSnapshot AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#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 AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_BAR_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_BAR_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . SAVE_BUTTON_WIDTH AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.web_page_snap_shot_web_snap_cancel' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_WIDTH 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 . closeSnapPopup 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#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 . SpaceEvenly AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . snapPopupWidth 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 . BUTTON_BAR_HEIGHT 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#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_BAR_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_BAR_PADDING AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.web_page_snap_shot_web_snap_window_bottom_backgrounp_color' AST#expression#Right ) AST#resource_expression#Right 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 AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . ANIMATE_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Friction AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottomLeft AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BORDER_RADIUS AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottomRight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BORDER_RADIUS AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . transition ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect AST#expression#Right . OPACITY AST#member_expression#Right AST#expression#Right . animation AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . ANIMATE_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . Ease AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . combine AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left TransitionEffect 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 y AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . BUTTON_BAR_SCALE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 . showPreview 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#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
@Builder
buttonBar() {
Row() {
SaveButton({
icon: SaveIconStyle.FULL_FILLED,
text: SaveDescription.SAVE_IMAGE,
buttonType: ButtonType.Capsule
})
.onClick(async (event, result) => {
this.saveSnapshot(result);
})
.padding({
left: Constants.BUTTON_BAR_PADDING,
right: Constants.BUTTON_BAR_PADDING
})
.width(Constants.SAVE_BUTTON_WIDTH)
Button($r('app.string.web_page_snap_shot_web_snap_cancel'))
.width(Constants.BUTTON_WIDTH)
.onClick(() => {
this.closeSnapPopup();
})
}
.justifyContent(FlexAlign.SpaceEvenly)
.width(this.snapPopupWidth)
.height(Constants.BUTTON_BAR_HEIGHT)
.padding({
top: Constants.BUTTON_BAR_PADDING,
bottom: Constants.BUTTON_BAR_PADDING
})
.backgroundColor($r('app.string.web_page_snap_shot_web_snap_window_bottom_backgrounp_color'))
.animation({
duration: Constants.ANIMATE_DURATION,
curve: Curve.Friction
})
.borderRadius({
bottomLeft: Constants.BORDER_RADIUS,
bottomRight: Constants.BORDER_RADIUS
})
.transition(TransitionEffect.OPACITY.animation({
duration: Constants.ANIMATE_DURATION,
curve: Curve.Ease
})
.combine(TransitionEffect.scale({ y: Constants.BUTTON_BAR_SCALE }))
)
.visibility(this.showPreview ? Visibility.Visible : Visibility.Hidden)
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/viewmodel/PreviewWindowComponent.ets#L196-L243
|
762739e23b1fa368ab4bc475ca5fd7206b13d8d1
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/DateUtil.ets
|
arkts
|
getTodayStr
|
获取今天的时间,字符串类型
@param format 格式化字符串,(yyyy-MM-dd HH:mm:ss)
@returns
|
static getTodayStr(format?: string): string {
return DateUtil.getFormatDateStr(new Date(), format)
}
|
AST#method_declaration#Left static getTodayStr AST#parameter_list#Left ( AST#parameter#Left format ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left DateUtil AST#expression#Right . getFormatDateStr 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 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 format 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 getTodayStr(format?: string): string {
return DateUtil.getFormatDateStr(new Date(), format)
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L100-L102
|
e59fa12ba4b60f4e91685c1d4089e4a5430471e3
|
gitee
|
EL233/WeChat-HarmonyOS.git
|
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
|
entry/src/main/ets/view/PersonalInformation.ets
|
arkts
|
setHobbiesValue
|
设置兴趣值函数,将选中的兴趣项转换为字符串。
|
function setHobbiesValue(hobbyItems: HobbyItem[]): string {
if (CommonUtils.isEmptyArr(hobbyItems)) { // 如果兴趣项列表为空
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'hobbyItems length is 0'); // 记录日志
return '';
}
let hobbiesText: string = '';
// 过滤选中的兴趣项,并将其标签连接成字符串
hobbiesText = hobbyItems.filter((isCheckItem: HobbyItem) => isCheckItem?.isChecked)
.map<string>((checkedItem: HobbyItem) => checkedItem.label!)
.join(','); // 用逗号连接
return hobbiesText;
}
|
AST#function_declaration#Left function setHobbiesValue AST#parameter_list#Left ( AST#parameter#Left hobbyItems : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left HobbyItem [ ] 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 string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonUtils AST#expression#Right . isEmptyArr AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left hobbyItems 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0xFF00 AST#expression#Right , AST#expression#Left 'PersonalInformation' AST#expression#Right , AST#expression#Left '%{public}s' AST#expression#Right , AST#expression#Left 'hobbyItems length is 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#return_statement#Left return AST#expression#Left '' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left hobbiesText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 过滤选中的兴趣项,并将其标签连接成字符串 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left hobbiesText = 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 hobbyItems AST#expression#Right . filter AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left isCheckItem : AST#type_annotation#Left AST#primary_type#Left HobbyItem 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 isCheckItem AST#expression#Right ?. isChecked AST#member_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . map AST#member_expression#Right AST#expression#Right AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left checkedItem : AST#type_annotation#Left AST#primary_type#Left HobbyItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left checkedItem AST#expression#Right . label AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left ',' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 用逗号连接 AST#statement#Left AST#return_statement#Left return AST#expression#Left hobbiesText AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right
|
function setHobbiesValue(hobbyItems: HobbyItem[]): string {
if (CommonUtils.isEmptyArr(hobbyItems)) {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'hobbyItems length is 0');
return '';
}
let hobbiesText: string = '';
hobbiesText = hobbyItems.filter((isCheckItem: HobbyItem) => isCheckItem?.isChecked)
.map<string>((checkedItem: HobbyItem) => checkedItem.label!)
.join(',');
return hobbiesText;
}
|
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L42-L54
|
b92d363aad4a2e0d557dbe1b69594cb3c48b6494
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets
|
arkts
|
aboutToAppear
|
页面出现时加载数据
@returns {void} 无返回值
|
aboutToAppear(): void {
this.loadOrderLogistics();
super.aboutToAppear();
}
|
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadOrderLogistics 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 super AST#expression#Right . aboutToAppear AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
aboutToAppear(): void {
this.loadOrderLogistics();
super.aboutToAppear();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderLogisticsViewModel.ets#L44-L47
|
6f84357cba99c461c9b7d43b3b5a161449b63bbc
|
github
|
openharmony/codelabs
|
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
|
Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets
|
arkts
|
switchPlayState
|
Switching the Playback Status.
@param playState
|
switchPlayState(playState: number) {
let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController;
if (playState === PlayState.PLAY) {
this.playBarModel.playState = PlayState.PAUSE;
this.playBarModel.playStateIcon = $r('app.media.ic_pause');
playController.pause();
AvSessionUtil.setAVPlayState(avSession.PlaybackState.PLAYBACK_STATE_PAUSE);
} else {
this.playBarModel.playState = PlayState.PLAY;
this.playBarModel.playStateIcon = $r('app.media.ic_play');
Logger.info(TAG, `rawFileDescriptor: ${this.playBarModel!.musicItem!.rawFileDescriptor},
playValue ${this.playBarModel!.playValue}`);
playController.play(this.playBarModel.musicItem!.rawFileDescriptor, this.playBarModel.playValue);
AvSessionUtil.setAVPlayState(avSession.PlaybackState.PLAYBACK_STATE_PLAY);
}
}
|
AST#method_declaration#Left switchPlayState AST#parameter_list#Left ( AST#parameter#Left playState : 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 playController = 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 GlobalContext AST#expression#Right . getContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . getObject AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'audioPlayerController' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left AudioPlayerController AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left playState AST#expression#Right === AST#expression#Left PlayState AST#expression#Right AST#binary_expression#Right AST#expression#Right . PLAY 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 . playBarModel AST#member_expression#Right AST#expression#Right . playState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PlayState AST#expression#Right . PAUSE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playBarModel AST#member_expression#Right AST#expression#Right . playStateIcon AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_pause' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left playController AST#expression#Right . pause 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 AvSessionUtil AST#expression#Right . setAVPlayState 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 avSession AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PAUSE AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playBarModel AST#member_expression#Right AST#expression#Right . playState AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PlayState AST#expression#Right . PLAY AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playBarModel AST#member_expression#Right AST#expression#Right . playStateIcon AST#member_expression#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.ic_play' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left 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 ` rawFileDescriptor: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playBarModel AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . musicItem AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . rawFileDescriptor AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ,
playValue AST#template_substitution#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 . playBarModel AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . playValue 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 playController AST#expression#Right . play AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . playBarModel AST#member_expression#Right AST#expression#Right . musicItem AST#member_expression#Right AST#expression#Right ! AST#non_null_assertion_expression#Right AST#expression#Right . rawFileDescriptor 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 . playBarModel AST#member_expression#Right AST#expression#Right . playValue 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 AvSessionUtil AST#expression#Right . setAVPlayState 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 avSession AST#expression#Right . PlaybackState AST#member_expression#Right AST#expression#Right . PLAYBACK_STATE_PLAY 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#method_declaration#Right
|
switchPlayState(playState: number) {
let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController;
if (playState === PlayState.PLAY) {
this.playBarModel.playState = PlayState.PAUSE;
this.playBarModel.playStateIcon = $r('app.media.ic_pause');
playController.pause();
AvSessionUtil.setAVPlayState(avSession.PlaybackState.PLAYBACK_STATE_PAUSE);
} else {
this.playBarModel.playState = PlayState.PLAY;
this.playBarModel.playStateIcon = $r('app.media.ic_play');
Logger.info(TAG, `rawFileDescriptor: ${this.playBarModel!.musicItem!.rawFileDescriptor},
playValue ${this.playBarModel!.playValue}`);
playController.play(this.playBarModel.musicItem!.rawFileDescriptor, this.playBarModel.playValue);
AvSessionUtil.setAVPlayState(avSession.PlaybackState.PLAYBACK_STATE_PLAY);
}
}
|
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets#L57-L72
|
d7d42e07d2dd73d89bbb8562a2de8aa98846a631
|
gitee
|
IceYuanyyy/OxHornCampus.git
|
bb5686f77fa36db89687502e35898cda218d601f
|
entry/src/main/ets/viewmodel/TrainsMap.ets
|
arkts
|
TrainsMap
|
Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
@Observed
export class TrainsMap {
imgBg: ImageBitmap | null = null;
interval: number = 0;
/**
* Points of train routes.
*/
lineData: Array<Position> = [];
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class TrainsMap AST#class_body#Left { AST#property_declaration#Left imgBg : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ImageBitmap AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left interval : 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 /**
* Points of train routes.
*/ AST#property_declaration#Left lineData : 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 Position 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#class_body#Right AST#decorated_export_declaration#Right
|
@Observed
export class TrainsMap {
imgBg: ImageBitmap | null = null;
interval: number = 0;
lineData: Array<Position> = [];
}
|
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/TrainsMap.ets#L16-L24
|
0c06ebdff0907b0a8255e8e27faac9a96f739b00
|
github
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/prompt/ExceptionDialogUtil.ets
|
arkts
|
ExceptionDialogUtil
|
@Author csx
@DateTime 2024/3/28 10:50:03
@TODO ExceptionDialogUtil 异常提醒弹框工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
|
@Component
export struct ExceptionDialogUtil {
callBack: (data: string) => void = () => {
};
dialogController: CustomDialogController = new CustomDialogController({
builder: ExceptionUI({
callBack: (data: string) => {
this.callBack(data);
this.dialogController.close();
}
}),
autoCancel: false,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 10,
customStyle: false,
isModal: true
})
build() {
Column() {
Button('点我有奇迹')
.margin({ top: 20, bottom: 20 })
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
}
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ExceptionDialogUtil AST#component_body#Left { AST#property_declaration#Left callBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#expression#Left AST#object_literal#Left { } AST#object_literal#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left dialogController : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left CustomDialogController AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left builder AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left ExceptionUI AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left callBack 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 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 this AST#expression#Right . callBack 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right . close AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left autoCancel AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left alignment AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left DialogAlignment AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left offset AST#property_name#Right : AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left dx AST#property_name#Right : AST#expression#Left 0 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left dy AST#property_name#Right : AST#expression#Left AST#unary_expression#Left - AST#expression#Left 20 AST#expression#Right AST#unary_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 gridCount AST#property_name#Right : AST#expression#Left 10 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left customStyle AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left isModal AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 Button ( AST#expression#Left '点我有奇迹' 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 20 AST#expression#Right AST#property_assignment#Right , 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#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController AST#member_expression#Right AST#expression#Right != AST#expression#Left undefined AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dialogController 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#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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct ExceptionDialogUtil {
callBack: (data: string) => void = () => {
};
dialogController: CustomDialogController = new CustomDialogController({
builder: ExceptionUI({
callBack: (data: string) => {
this.callBack(data);
this.dialogController.close();
}
}),
autoCancel: false,
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: -20 },
gridCount: 10,
customStyle: false,
isModal: true
})
build() {
Column() {
Button('点我有奇迹')
.margin({ top: 20, bottom: 20 })
.onClick(() => {
if (this.dialogController != undefined) {
this.dialogController.open()
}
})
}
}
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/ExceptionDialogUtil.ets#L27-L57
|
848ae7b26478259665b689100aca3f49eb549a66
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets
|
arkts
|
FilterComponent
|
功能描述:
1.构建多重筛选的筛选条件。
2.通过筛选条件筛选出来相关数据。
实现原理:
1.得到筛选的数据后根据点击的筛选数据行数,使用has进行if判断看是否满足多重筛选的条件。
@param {Array<OptionsInterface>} filterParam - 筛选数据(必需)
@param {boolean} isShow - 筛选卡片是否显示(必需)
@param {Array<string>} changData - 筛选出来的数据(必需)
@param {Array<number>} arrayListData - 选择的数据的行数index数组(必需)
@param {SiteListDataSource} siteList - 场地信息集合(必需)
|
@Component
export struct FilterComponent {
@State filterParam: Array<OptionsInterface> =
[new OptionsInterface('停放时间', ['白天', '夜间', '全天'], []),
new OptionsInterface('套餐类型', ['次套餐', '日套餐', '月套餐'], []),
new OptionsInterface('是否支持充电', ['是'], [])]; // 筛选数据
@Link isShow: boolean; // 筛选卡片是否显示
@Link changData: Array<string>; // 筛选出来的数据
@State arrayListData: Array<number> = []; // 选择的数据的行数index数组
@Link siteList: SiteListDataSource; // 场地信息集合
build() {
Column() {
Row() {
Row() {
Text($r('app.string.multiple_screening_filter_component_national'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.width($r('app.string.multiple_screening_filter_component_national_width'))
.onClick(() => {
// 调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r("app.string.multiple_screening_toast_tips") });
})
Row() {
Text($r('app.string.multiple_screening_filter_component_sort'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.padding({ right: $r('app.integer.multiple_screening_filter_component_sort_padding') })
.onClick(() => {
// 调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r("app.string.multiple_screening_toast_tips") });
})
Row() {
Text($r('app.string.multiple_screening_filter_component_filter'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.onClick(() => {
this.isShow = !this.isShow;
})
}
.padding({
left: $r('app.integer.multiple_screening_filter_component_padding_left'),
right: $r('app.integer.multiple_screening_filter_component_padding_left'),
top: $r('app.integer.multiple_screening_filter_component_padding_left'),
bottom: $r('app.integer.multiple_screening_filter_component_padding_bottom')
})
this.filterCard()
}
.id('filterComponent')
.backgroundColor($r('app.color.multiple_screening_background_color'))
}
@Builder
filterCard() {
Column() {
// 筛选数据
ForEach(this.filterParam, (item: OptionsInterface, index: number) => {
FilterData({
item: item,
listIndex: index,
changData: this.changData,
arrayListData: $arrayListData
})
})
this.filterButton()
}
.height($r('app.integer.multiple_screening_filter_component_filter_card_height'))
.backgroundColor($r('app.color.multiple_screening_background_color'))
.width($r('app.string.multiple_screening_all_percentage'))
.position({
x: $r('app.integer.multiple_screening_filter_component_filter_card_position_x'),
y: $r('app.integer.multiple_screening_filter_component_filter_card_position_y')
})
.visibility(this.isShow ? Visibility.Visible : Visibility.None)
}
@Builder
filterButton() {
Row() {
Button($r('app.string.multiple_screening_filter_component_reset'))
.height($r('app.integer.multiple_screening_filter_component_reset_height'))
.width($r('app.integer.multiple_screening_filter_component_reset_width'))
.backgroundColor(Color.White)
.fontColor($r('app.color.multiple_screening_filter_component_reset_font'))
.onClick(() => {
this.filterParam.forEach(item => {
item.selectItem = [];
this.changData = [];
this.arrayListData = [];
})
// 还原数据
this.siteList.getInitalList()
})
Button($r('app.string.multiple_screening_filter_component_confirm'))
.height($r('app.integer.multiple_screening_filter_component_reset_height'))
.width($r('app.integer.multiple_screening_filter_component_reset_width'))
.backgroundColor(Color.White)
.fontColor($r('app.color.multiple_screening_filter_component_reset_font'))
.onClick(() => {
this.isShow = false;
let arrayListData = new Set(this.arrayListData)
if (arrayListData.has(0) && !arrayListData.has(1)) {
// 仅选择停放时间
this.siteList.timeMultiFilter(this.changData);
} else if (!arrayListData.has(0) && arrayListData.has(1)) {
// 仅选择套餐类型
this.siteList.typeMultiFilter(this.changData);
} else if (!arrayListData.has(0) && !arrayListData.has(1) && arrayListData.has(2)) {
// 仅选择充电
this.siteList.getInitalList();
} else if (this.changData.length === 0) {
// 未对数据进行选择
this.siteList.getInitalList();
} else {
// 多重筛选
this.siteList.multiFilter(this.changData);
}
if (this.siteList.totalCount() === 0) {
this.siteList.getInitalList();
promptAction.showToast({ message: $r('app.string.multiple_screening_filter_component_confirm_prompt') });
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.width($r('app.string.multiple_screening_filter_component_filter_button_width'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FilterComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right filterParam : 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 OptionsInterface AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OptionsInterface AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '停放时间' AST#expression#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#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OptionsInterface AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '套餐类型' AST#expression#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#array_literal#Right AST#expression#Right , AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left OptionsInterface AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left '是否支持充电' AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left '是' AST#expression#Right ] AST#array_literal#Right AST#expression#Right , 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#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 筛选数据 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 筛选卡片是否显示 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right changData : 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#property_declaration#Right // 筛选出来的数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right arrayListData : 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 number AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right ; AST#property_declaration#Right // 选择的数据的行数index数组 AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right siteList : AST#type_annotation#Left AST#primary_type#Left SiteListDataSource 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 Row ( ) 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#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_national' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.multiple_screening_ic_public_spinner' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_image' 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.multiple_screening_filter_component_filter_image' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_national_width' 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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.multiple_screening_toast_tips" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_sort' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.multiple_screening_ic_public_spinner' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_image' 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.multiple_screening_filter_component_filter_image' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_sort_padding' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onClick ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.multiple_screening_toast_tips" AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_filter' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.multiple_screening_ic_public_spinner' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_image' 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.multiple_screening_filter_component_filter_image' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . 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 . isShow 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 . isShow 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#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_padding_left' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_padding_bottom' 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#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterCard 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 'filterComponent' AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.multiple_screening_background_color' 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#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right filterCard AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 筛选数据 AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterParam 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 OptionsInterface 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 FilterData ( AST#component_parameters#Left { AST#component_parameter#Left item : AST#expression#Left item AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left listIndex : AST#expression#Left index AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left changData : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changData AST#member_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left arrayListData : AST#expression#Left $arrayListData 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#for_each_statement#Right AST#ui_control_flow#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . filterButton 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 . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_card_height' 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.multiple_screening_background_color' 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.multiple_screening_all_percentage' AST#expression#Right ) AST#resource_expression#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 AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_card_position_x' AST#expression#Right ) AST#resource_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#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_filter_card_position_y' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . 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 . isShow 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 . None 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 AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right filterButton 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 Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_reset' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_reset_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_reset_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 . White 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.multiple_screening_filter_component_reset_font' 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 . filterParam 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 item => 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 . selectItem AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . changData AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arrayListData AST#member_expression#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right // 还原数据 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . siteList AST#member_expression#Right AST#expression#Right . getInitalList 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_confirm' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_reset_height' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.integer.multiple_screening_filter_component_reset_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 . White 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.multiple_screening_filter_component_reset_font' 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 . isShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left arrayListData = 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#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . arrayListData AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#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 arrayListData AST#expression#Right . has 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#Left AST#unary_expression#Left ! AST#expression#Left arrayListData AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 . siteList AST#member_expression#Right AST#expression#Right . timeMultiFilter 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 . changData 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left arrayListData AST#expression#Right AST#unary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left arrayListData AST#expression#Right AST#binary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 . siteList AST#member_expression#Right AST#expression#Right . typeMultiFilter 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 . changData 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#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left arrayListData AST#expression#Right AST#unary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left arrayListData AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 1 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left arrayListData AST#expression#Right AST#binary_expression#Right AST#expression#Right . has AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 2 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 . siteList AST#member_expression#Right AST#expression#Right . getInitalList 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#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 . changData AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // 未对数据进行选择 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . siteList AST#member_expression#Right AST#expression#Right . getInitalList 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . siteList AST#member_expression#Right AST#expression#Right . multiFilter 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 . changData 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#if_statement#Right AST#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . siteList 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#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 . siteList AST#member_expression#Right AST#expression#Right . getInitalList 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_confirm_prompt' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right 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#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 . SpaceBetween AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.multiple_screening_filter_component_filter_button_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#builder_function_body#Right AST#method_declaration#Right } AST#component_body#Right AST#decorated_export_declaration#Right
|
@Component
export struct FilterComponent {
@State filterParam: Array<OptionsInterface> =
[new OptionsInterface('停放时间', ['白天', '夜间', '全天'], []),
new OptionsInterface('套餐类型', ['次套餐', '日套餐', '月套餐'], []),
new OptionsInterface('是否支持充电', ['是'], [])];
@Link isShow: boolean;
@Link changData: Array<string>;
@State arrayListData: Array<number> = [];
@Link siteList: SiteListDataSource;
build() {
Column() {
Row() {
Row() {
Text($r('app.string.multiple_screening_filter_component_national'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.width($r('app.string.multiple_screening_filter_component_national_width'))
.onClick(() => {
promptAction.showToast({ message: $r("app.string.multiple_screening_toast_tips") });
})
Row() {
Text($r('app.string.multiple_screening_filter_component_sort'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.padding({ right: $r('app.integer.multiple_screening_filter_component_sort_padding') })
.onClick(() => {
promptAction.showToast({ message: $r("app.string.multiple_screening_toast_tips") });
})
Row() {
Text($r('app.string.multiple_screening_filter_component_filter'))
.fontSize($r('app.integer.multiple_screening_filter_component_filter_text'))
Image($r('app.media.multiple_screening_ic_public_spinner'))
.width($r('app.integer.multiple_screening_filter_component_filter_image'))
.height($r('app.integer.multiple_screening_filter_component_filter_image'))
}
.onClick(() => {
this.isShow = !this.isShow;
})
}
.padding({
left: $r('app.integer.multiple_screening_filter_component_padding_left'),
right: $r('app.integer.multiple_screening_filter_component_padding_left'),
top: $r('app.integer.multiple_screening_filter_component_padding_left'),
bottom: $r('app.integer.multiple_screening_filter_component_padding_bottom')
})
this.filterCard()
}
.id('filterComponent')
.backgroundColor($r('app.color.multiple_screening_background_color'))
}
@Builder
filterCard() {
Column() {
ForEach(this.filterParam, (item: OptionsInterface, index: number) => {
FilterData({
item: item,
listIndex: index,
changData: this.changData,
arrayListData: $arrayListData
})
})
this.filterButton()
}
.height($r('app.integer.multiple_screening_filter_component_filter_card_height'))
.backgroundColor($r('app.color.multiple_screening_background_color'))
.width($r('app.string.multiple_screening_all_percentage'))
.position({
x: $r('app.integer.multiple_screening_filter_component_filter_card_position_x'),
y: $r('app.integer.multiple_screening_filter_component_filter_card_position_y')
})
.visibility(this.isShow ? Visibility.Visible : Visibility.None)
}
@Builder
filterButton() {
Row() {
Button($r('app.string.multiple_screening_filter_component_reset'))
.height($r('app.integer.multiple_screening_filter_component_reset_height'))
.width($r('app.integer.multiple_screening_filter_component_reset_width'))
.backgroundColor(Color.White)
.fontColor($r('app.color.multiple_screening_filter_component_reset_font'))
.onClick(() => {
this.filterParam.forEach(item => {
item.selectItem = [];
this.changData = [];
this.arrayListData = [];
})
this.siteList.getInitalList()
})
Button($r('app.string.multiple_screening_filter_component_confirm'))
.height($r('app.integer.multiple_screening_filter_component_reset_height'))
.width($r('app.integer.multiple_screening_filter_component_reset_width'))
.backgroundColor(Color.White)
.fontColor($r('app.color.multiple_screening_filter_component_reset_font'))
.onClick(() => {
this.isShow = false;
let arrayListData = new Set(this.arrayListData)
if (arrayListData.has(0) && !arrayListData.has(1)) {
this.siteList.timeMultiFilter(this.changData);
} else if (!arrayListData.has(0) && arrayListData.has(1)) {
this.siteList.typeMultiFilter(this.changData);
} else if (!arrayListData.has(0) && !arrayListData.has(1) && arrayListData.has(2)) {
this.siteList.getInitalList();
} else if (this.changData.length === 0) {
this.siteList.getInitalList();
} else {
this.siteList.multiFilter(this.changData);
}
if (this.siteList.totalCount() === 0) {
this.siteList.getInitalList();
promptAction.showToast({ message: $r('app.string.multiple_screening_filter_component_confirm_prompt') });
}
})
}
.justifyContent(FlexAlign.SpaceBetween)
.width($r('app.string.multiple_screening_filter_component_filter_button_width'))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/components/FilterComponent.ets#L48-L187
|
90cbacbc07ada76ff391aa23253552297c506235
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/palette/Index.ets
|
arkts
|
PaletteComponent
|
Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
|
export { PaletteComponent } from './src/main/ets/pages/PaletteMainPage';
|
AST#export_declaration#Left export { PaletteComponent } from './src/main/ets/pages/PaletteMainPage' ; AST#export_declaration#Right
|
export { PaletteComponent } from './src/main/ets/pages/PaletteMainPage';
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/Index.ets#L17-L17
|
dfa662bff55cbd6f481dab13ca228fad071822d3
|
gitee
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/base/LocationUtil.ets
|
arkts
|
getGeoLocation
|
获取用户当前定位-逆编码后(会申请APPROXIMATELY_LOCATION和LOCATION权限)
@returns 返回当前定位对象的json字符串
|
static async getGeoLocation(): Promise<string> {
let isAuth = AuthUtil.checkPermissions('ohos.permission.APPROXIMATELY_LOCATION') &&
AuthUtil.checkPermissions('ohos.permission.LOCATION');
if (!isAuth) {
//获取用户授权
let code =
await AuthUtil.reqPermissionsList(['ohos.permission.APPROXIMATELY_LOCATION', 'ohos.permission.LOCATION']);
if (!code) {
//授权失败
return '用户拒绝授权精准定位,获取定位失败~';
}
}
//授权成功获取当前定位
let current = await LocationUtil.getCurrentLocation();
//逆编码定位
let result = await LocationUtil.geoConvert(current.latitude, current.longitude);
if (result) {
return JSONObject.toJSONString(result);
}
return "获取定位失败~";
}
|
AST#method_declaration#Left static async getGeoLocation AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left isAuth = 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 AuthUtil AST#expression#Right . checkPermissions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ohos.permission.APPROXIMATELY_LOCATION' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right && AST#expression#Left AuthUtil AST#expression#Right AST#binary_expression#Right AST#expression#Right . checkPermissions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'ohos.permission.LOCATION' AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left isAuth AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { //获取用户授权 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left code = 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 AuthUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . reqPermissionsList AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left 'ohos.permission.APPROXIMATELY_LOCATION' AST#expression#Right , AST#expression#Left 'ohos.permission.LOCATION' AST#expression#Right ] AST#array_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left code AST#expression#Right AST#unary_expression#Right AST#expression#Right ) AST#block_statement#Left { //授权失败 AST#statement#Left AST#return_statement#Left return AST#expression#Left '用户拒绝授权精准定位,获取定位失败~' AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right //授权成功获取当前定位 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left current = 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 LocationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . getCurrentLocation 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 result = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left LocationUtil AST#expression#Right AST#await_expression#Right AST#expression#Right . geoConvert AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . latitude AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left current AST#expression#Right . longitude 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 result 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 JSONObject AST#expression#Right . toJSONString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#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 async getGeoLocation(): Promise<string> {
let isAuth = AuthUtil.checkPermissions('ohos.permission.APPROXIMATELY_LOCATION') &&
AuthUtil.checkPermissions('ohos.permission.LOCATION');
if (!isAuth) {
let code =
await AuthUtil.reqPermissionsList(['ohos.permission.APPROXIMATELY_LOCATION', 'ohos.permission.LOCATION']);
if (!code) {
return '用户拒绝授权精准定位,获取定位失败~';
}
}
let current = await LocationUtil.getCurrentLocation();
let result = await LocationUtil.geoConvert(current.latitude, current.longitude);
if (result) {
return JSONObject.toJSONString(result);
}
return "获取定位失败~";
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/LocationUtil.ets#L47-L67
|
23d25d6da561deec1391f53e3c0ed55768db197f
|
gitee
|
BohanSu/LumosAgent-HarmonyOS.git
|
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
|
entry/src/main/ets/viewmodel/MainViewModel.ets
|
arkts
|
getMaskedApiKey
|
获取脱敏的API密钥(用于显示)
|
async getMaskedApiKey(): Promise<string> {
return await this.configService.getMaskedApiKey();
}
|
AST#method_declaration#Left async getMaskedApiKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#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 this AST#expression#Right AST#await_expression#Right AST#expression#Right . configService AST#member_expression#Right AST#expression#Right . getMaskedApiKey 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
|
async getMaskedApiKey(): Promise<string> {
return await this.configService.getMaskedApiKey();
}
|
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/viewmodel/MainViewModel.ets#L700-L702
|
7f9325220d00144417bb36c9773d1bc17400b31e
|
github
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/UserInfoRepository.ets
|
arkts
|
updatePassword
|
更新用户密码
@param {Record<string, string>} params - 修改密码参数
@returns {Promise<NetworkResponse<Unknown>>} 更新结果
|
async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.updatePassword(params);
}
|
AST#method_declaration#Left async updatePassword 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#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#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . networkDataSource AST#member_expression#Right AST#expression#Right . updatePassword AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left params AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> {
return this.networkDataSource.updatePassword(params);
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/UserInfoRepository.ets#L36-L38
|
41fbb029192152b8fd8dc6d39620122ab7f144c5
|
github
|
AlbertZyc/tab-layout
|
4ba256eead3792c84128f8679b26ac159a2d7f06
|
entry/src/main/ets/BasicDataSource.ets
|
arkts
|
unregisterDataChangeListener
|
该方法为框架侧调用,为对应的LazyForEach组件在数据源处去除listener监听
|
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
|
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
|
unregisterDataChangeListener(listener: DataChangeListener): void {
const pos = this.listeners.indexOf(listener);
if (pos >= 0) {
this.listeners.splice(pos, 1);
}
}
|
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L30-L35
|
950ce01706897cf43097aafaf92290f7fdbdda8b
|
gitee
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animateTo/template2/Index.ets
|
arkts
|
向下
|
build() {
Column() {
if (this.isShow) {
Column()
.width(200)
.height(this.heightSize)
.backgroundColor('blue')
.onClick(() => {
// 建议使用this.getUIContext()?.animateTo()
this.getUIContext()?.animateTo({
duration: 2000,
curve: Curve.EaseOut,
iterations: 1,
playMode: PlayMode.Normal,
onFinish: () => {
this.count--;
if (this.count == 0 && !this.isToBottom) { // 组件只有在向下做完动画才会消失
this.isShow = false;
}
}
}, () => {
this.count++;
if (this.isToBottom) {
this.heightSize = 60;
} else {
this.heightSize = 100;
}
this.isToBottom = !this.isToBottom;
})
})
}
}.width('100%').height('100%').margin({ top: 5 })
.justifyContent(FlexAlign.End)
}
|
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isShow AST#member_expression#Right AST#expression#Right ) { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left 200 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightSize AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left 'blue' 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 { // 建议使用this.getUIContext()?.animateTo() AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getUIContext AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ?. animateTo AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left 2000 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left curve AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Curve AST#expression#Right . EaseOut AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left iterations AST#property_name#Right : AST#expression#Left 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left playMode AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left PlayMode AST#expression#Right . Normal AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left onFinish 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#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right AST#expression#Right -- AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right AST#expression#Right == AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#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 . isToBottom 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 . isShow AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . count AST#member_expression#Right AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isToBottom 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 . heightSize AST#member_expression#Right = AST#expression#Left 60 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right else AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . heightSize 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#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 . isToBottom 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 . isToBottom AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 . height ( 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 5 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 . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Right
|
build() {
Column() {
if (this.isShow) {
Column()
.width(200)
.height(this.heightSize)
.backgroundColor('blue')
.onClick(() => {
this.getUIContext()?.animateTo({
duration: 2000,
curve: Curve.EaseOut,
iterations: 1,
playMode: PlayMode.Normal,
onFinish: () => {
this.count--;
if (this.count == 0 && !this.isToBottom) {
this.isShow = false;
}
}
}, () => {
this.count++;
if (this.isToBottom) {
this.heightSize = 60;
} else {
this.heightSize = 100;
}
this.isToBottom = !this.isToBottom;
})
})
}
}.width('100%').height('100%').margin({ top: 5 })
.justifyContent(FlexAlign.End)
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Animation/entry/src/main/ets/pages/animateTo/template2/Index.ets#L23-L56
|
618c6edd2b275be8df0abddb49dfc37c49df2dd8
|
gitee
|
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/PermissionUtil.ets
|
arkts
|
requestPermissions
|
申请授权(支持权限组合)
@param permissions 需要授权的权限
@returns true表示授权成功继续业务操作,false表示用户拒绝授权
|
static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
//requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
let request = await atManager.requestPermissionsFromUser(context,
Array.isArray(permissions) ? [...permissions] : [permissions]);
let requestGrant: boolean = PermissionUtil.getGrantSuccess(request); //鉴权结果
return requestGrant;
}
|
AST#method_declaration#Left static async requestPermissions AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Permissions AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left 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#variable_declaration#Left const AST#variable_declarator#Left atManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left abilityAccessCtrl . AtManager 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 abilityAccessCtrl AST#expression#Right . createAtManager 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 context : AST#type_annotation#Left AST#primary_type#Left Context 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 . getContext 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 //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left request = 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 atManager AST#expression#Right AST#await_expression#Right AST#expression#Right . requestPermissionsFromUser AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left context AST#expression#Right , AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Array AST#expression#Right . isArray AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left permissions AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ? AST#expression#Left AST#array_literal#Left [ ... AST#expression#Left permissions AST#expression#Right ] AST#array_literal#Right AST#expression#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left permissions AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#conditional_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 requestGrant : AST#type_annotation#Left AST#primary_type#Left boolean 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 PermissionUtil AST#expression#Right . getGrantSuccess AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( 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 requestGrant AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async requestPermissions(permissions: Permissions | Array<Permissions>): Promise<boolean> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
const context: Context = AppUtil.getContext();
let request = await atManager.requestPermissionsFromUser(context,
Array.isArray(permissions) ? [...permissions] : [permissions]);
let requestGrant: boolean = PermissionUtil.getGrantSuccess(request);
return requestGrant;
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PermissionUtil.ets#L66-L74
|
06ac061685723f70d722ef8c5b9ced39ad72b493
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/GlobalTypes.ets
|
arkts
|
通知类型枚举
|
export enum NotificationType {
BIRTHDAY = 'birthday',
ANNIVERSARY = 'anniversary',
REMINDER = 'reminder',
SYSTEM = 'system'
}
|
AST#export_declaration#Left export AST#enum_declaration#Left enum NotificationType AST#enum_body#Left { AST#enum_member#Left BIRTHDAY = AST#expression#Left 'birthday' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left ANNIVERSARY = AST#expression#Left 'anniversary' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left REMINDER = AST#expression#Left 'reminder' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SYSTEM = AST#expression#Left 'system' AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#Right
|
export enum NotificationType {
BIRTHDAY = 'birthday',
ANNIVERSARY = 'anniversary',
REMINDER = 'reminder',
SYSTEM = 'system'
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L77-L82
|
705ad68d5e16af0f8e0ac0fa65fb340d5f606b49
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/pages/contacts/ContactImportPage.ets
|
arkts
|
parseJsonContent
|
解析JSON内容
|
private parseJsonContent() {
if (!this.jsonContent.trim()) {
this.jsonParseResult = null;
return;
}
this.jsonParseResult = JsonParser.parseJsonContent(this.jsonContent);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`JSON parsed: ${this.jsonParseResult.validRecords}/${this.jsonParseResult.totalRecords} valid, ${this.jsonParseResult.errors.length} errors`);
}
|
AST#method_declaration#Left private parseJsonContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . jsonContent AST#member_expression#Right AST#expression#Right . trim AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . jsonParseResult AST#member_expression#Right = AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . jsonParseResult AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JsonParser AST#expression#Right . parseJsonContent 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 . jsonContent 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 hilog AST#expression#Right . info AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` JSON parsed: 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 . jsonParseResult AST#member_expression#Right AST#expression#Right . validRecords 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . jsonParseResult AST#member_expression#Right AST#expression#Right . totalRecords AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right valid, AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . jsonParseResult AST#member_expression#Right AST#expression#Right . errors AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right errors ` 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
|
private parseJsonContent() {
if (!this.jsonContent.trim()) {
this.jsonParseResult = null;
return;
}
this.jsonParseResult = JsonParser.parseJsonContent(this.jsonContent);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`JSON parsed: ${this.jsonParseResult.validRecords}/${this.jsonParseResult.totalRecords} valid, ${this.jsonParseResult.errors.length} errors`);
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactImportPage.ets#L824-L833
|
6f4c0ca10a35d77837e7b65fc0124b66238bfe94
|
github
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
|
arkts
|
doEntityRecognition
|
智能识别
|
doEntityRecognition(): void {
textProcessing.getEntity(this.recognizeText, {
entityTypes: [EntityType.NAME, EntityType.PHONE_NO, EntityType.LOCATION]
}).then(result => {
this.formatEntityResult(result);
}).catch((err: BusinessError) => {
console.error(`getEntity errorCode: ${err.code} errorMessage: ${err.message}`);
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
//清除loading
clearLoading(this.loadingId);
})
}
|
AST#method_declaration#Left doEntityRecognition AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textProcessing AST#expression#Right . getEntity 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 . recognizeText AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left entityTypes AST#property_name#Right : AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left EntityType AST#expression#Right . NAME AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left EntityType AST#expression#Right . PHONE_NO AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left EntityType AST#expression#Right . LOCATION AST#member_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#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 result => 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 . formatEntityResult AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left result AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . catch AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left err : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#template_literal#Left ` getEntity errorCode: 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 errorMessage: AST#template_substitution#Left $ { AST#expression#Left AST#member_expression#Left AST#expression#Left err AST#expression#Right . message AST#member_expression#Right AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.addressrecognize_recognize_fail_text' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left duration AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TOAST_DURATION AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //清除loading AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left clearLoading AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadingId 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#builder_function_body#Right AST#method_declaration#Right
|
doEntityRecognition(): void {
textProcessing.getEntity(this.recognizeText, {
entityTypes: [EntityType.NAME, EntityType.PHONE_NO, EntityType.LOCATION]
}).then(result => {
this.formatEntityResult(result);
}).catch((err: BusinessError) => {
console.error(`getEntity errorCode: ${err.code} errorMessage: ${err.message}`);
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
clearLoading(this.loadingId);
})
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L179-L193
|
9a3be85df54eaed0f87f10cb134a99fba9ff5052
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/model/src/main/ets/entity/Auth.ets
|
arkts
|
构造函数,支持对接口返回的数据做空值兜底
@param {Partial<Auth>} data - 原始认证数据
|
constructor(data?: Partial<Auth>) {
if (data) {
this.token = data.token ?? "";
this.refreshToken = data.refreshToken ?? "";
this.expire = data.expire ?? 0;
this.refreshExpire = data.refreshExpire ?? 0;
this.createdAt = data.createdAt ?? Date.now();
}
}
|
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left data ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Auth AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left data 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 . token AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . token AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . refreshToken AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . refreshToken AST#member_expression#Right AST#expression#Right ?? AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right 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 . expire AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . expire AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . refreshExpire AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . refreshExpire AST#member_expression#Right AST#expression#Right ?? AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . createdAt AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left data AST#expression#Right . createdAt AST#member_expression#Right AST#expression#Right ?? AST#expression#Left Date AST#expression#Right AST#binary_expression#Right AST#expression#Right . now AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#constructor_declaration#Right
|
constructor(data?: Partial<Auth>) {
if (data) {
this.token = data.token ?? "";
this.refreshToken = data.refreshToken ?? "";
this.expire = data.expire ?? 0;
this.refreshExpire = data.refreshExpire ?? 0;
this.createdAt = data.createdAt ?? Date.now();
}
}
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Auth.ets#L33-L41
|
0656e9ed38892b2508707e1639e938fad69062ab
|
github
|
|
yunkss/ef-tool
|
75f6761a0f2805d97183504745bf23c975ae514d
|
ef_ui/src/main/ets/ui/base/PickerUtil.ets
|
arkts
|
selectPhotoVideo
|
拉起照片和视频选择 -返回值方式
@param options 选择入参详见efPickerOptions 参数中只有maxNumber使用
@returns
|
static async selectPhotoVideo(options?: efPickerOptions): Promise<Array<string>> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
selectOpts.maxSelectNumber = options.maxNumber;
selectOpts.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_VIDEO_TYPE;
//创建picker
let photoPicker = new photoAccessHelper.PhotoViewPicker();
//拉起选择
let list: photoAccessHelper.PhotoSelectResult = await photoPicker.select(selectOpts);
//回调
if (list !== null && list !== undefined) {
return list.photoUris;
}
return new Array<string>();
}
|
AST#method_declaration#Left static async selectPhotoVideo AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left efPickerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options 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#assignment_expression#Left options = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left efPickerOptions 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#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maxNumber AST#member_expression#Right = AST#expression#Left 5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left options AST#expression#Right AST#unary_expression#Right AST#expression#Right . maxNumber AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maxNumber AST#member_expression#Right = AST#expression#Left 5 AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left selectOpts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left photoAccessHelper AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoSelectOptions AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left selectOpts AST#expression#Right . maxSelectNumber AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left options AST#expression#Right . maxNumber 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 selectOpts AST#expression#Right . MIMEType AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left photoAccessHelper AST#expression#Right . PhotoViewMIMETypes AST#member_expression#Right AST#expression#Right . IMAGE_VIDEO_TYPE AST#member_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //创建picker AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left photoPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left photoAccessHelper AST#expression#Right AST#new_expression#Right AST#expression#Right . PhotoViewPicker AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right //拉起选择 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left list : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectResult AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left photoPicker AST#expression#Right AST#await_expression#Right AST#expression#Right . select AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left selectOpts 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#binary_expression#Left AST#expression#Left list AST#expression#Right !== AST#expression#Left AST#null_literal#Left null AST#null_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right && AST#expression#Left AST#binary_expression#Left AST#expression#Left list 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#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left list AST#expression#Right . photoUris 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#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Array 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#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
static async selectPhotoVideo(options?: efPickerOptions): Promise<Array<string>> {
if (!options) {
options = new efPickerOptions();
options.maxNumber = 5;
}
if (!options.maxNumber) {
options.maxNumber = 5;
}
let selectOpts = new photoAccessHelper.PhotoSelectOptions();
selectOpts.maxSelectNumber = options.maxNumber;
selectOpts.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_VIDEO_TYPE;
let photoPicker = new photoAccessHelper.PhotoViewPicker();
let list: photoAccessHelper.PhotoSelectResult = await photoPicker.select(selectOpts);
if (list !== null && list !== undefined) {
return list.photoUris;
}
return new Array<string>();
}
|
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PickerUtil.ets#L166-L186
|
ee5a31b597f04d05ccaf5c3cfdbeecabf7e809c2
|
gitee
|
harmonyos-cases/cases
|
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
|
CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets
|
arkts
|
EditAddressView
|
最大输入字符数
功能描述: 本示例通过使用TextPicker滑动选择文本内容组件实现三级联动选择省市区,并回填到输入框
推荐场景: 需要填写地址的场景,如:快递收获地址选择等
核心组件:
1. TextPickerView 滑动选择文本内容组件
实现步骤:
1. 初始化textPicker标题。
@example
title: string | Resource = $r('app.string.editaddress_bind_sheet_title');
2. 读取文件中的省市区json数据。
@example
async loadRegion(): Promise<void> {
try {
// 通过getRawFileContent()获取resources/rawfile目录下对应的文件内容,得到一个字节数组
getContext(this).resourceManager.getRawFileContent(this.fileName, (error: BusinessError, value: Uint8Array) => {
let rawFile = value;
let textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let retStr =
textDecoder.decodeToString(rawFile, { stream: false }); // 再用@ohos.util (util工具函数)的TextDecoder给它解析出来
this.cascade = JSON.parse(retStr);
console.log('pqz' + this.cascade)
})
} catch (error) {
let code = (error as BusinessError).code;
let message = (error as BusinessError).message;
console.error(`callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
}
}
3.构建TextPickerView视图组件
@example
@Builder
textPickerBuild(cascade: Array<Cascade>,
selectHandle: (selectArr: number | number []) => void,
cancelHandle: () => void,
indexArr: number | number [], title: string | Resource) {
Column() {
TextPickerView({
cascade,
selectHandle,
cancelHandle,
indexArr,
title
});
}
}
4.将组件绑定在半模态
@example
.bindSheet($$this.isPresent,
this.textPickerBuild(this.cascade,
(selectArr: number | number []) => {
this.getSelectedPlace(selectArr);
this.isPresent = false;
this.isTextViewClicked = false;
}, () => {
this.isPresent = false;
this.isTextViewClicked = false;
}, this.addressForm.provinceArr, this.title), {
// TextInput绑定半模态转场
height: this.sheetHeight, // 半模态高度
dragBar: this.showDragBar, // 是否显示控制条
// 平板或折叠屏展开态在中间显示
preferType: this.isCenter ? SheetType.CENTER : SheetType.POPUP,
backgroundColor: $r('app.color.editaddress_btn_bgc'),
showClose: false, // 是否显示关闭图标
shouldDismiss: ((sheetDismiss: SheetDismiss) => { // 半模态页面交互式关闭回调函数
sheetDismiss.dismiss();
})
})
|
@Component
export struct EditAddressView {
@StorageLink('keyboardHeight') keyboardHeight: number = 0;
// 收件人输入框是否被选中
@State isClicked: boolean = false;
// 手机号输入框是否被选中
@State isClicked1: boolean = false;
// 所在地区输入框是否被选中
@State isTextViewClicked?: boolean = false;
// 详细地址输入框是否被选中
@State isClicked3: boolean = false;
// 地址标签是否被选中
@State isChecked: boolean = false;
// 智能填写输入框默认值
@State pasteString: string = "";
// 智能框输入值
@State addressString: string = "";
// 省市区数据
@State addressForm: Address = new Address("", "", [0, 0, 0], "", "", "");
// 标识是否需要软键盘避让
@State flag: boolean = false;
// 是否显示半屏模态页面
@State isPresent: boolean = false;
// 半模态高度
@State sheetHeight: number = 300;
// 是否显示控制条
@State showDragBar: boolean = true;
// 平板或折叠屏展开态在中间显示
@State isCenter: boolean = true;
// 省市区数据存放文件地址
fileName: string = 'regionsdata.json';
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
// 存放省市区数据
@State cascade: Array<Cascade> = [];
// 滚动控制器
scroller: ListScroller = new ListScroller();
// textPicker标题
title: string | Resource = $r('app.string.editaddress_bind_sheet_title');
aboutToAppear(): void {
this.loadRegion();
}
/**
* 从文件中读取省市区json数据
*/
async loadRegion(): Promise<void> {
try {
// 通过getRawFileContent()获取resources/rawfile目录下对应的文件内容,得到一个字节数组
getContext(this).resourceManager.getRawFileContent(this.fileName, (error: BusinessError, value: Uint8Array) => {
let rawFile = value;
let textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let retStr =
textDecoder.decodeToString(rawFile, { stream: false }); // 再用@ohos.util (util工具函数)的TextDecoder给它解析出来
this.cascade = JSON.parse(retStr);
})
} catch (error) {
let code = (error as BusinessError).code;
let message = (error as BusinessError).message;
console.error(`callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
}
}
/**
* 保存时,校验表单从上到下每项必填的方法
*/
validForm(): boolean {
if (!this.addressForm.name) {
promptAction.showToast({ message: $r('app.string.editaddress_name_judge') });
return false;
}
if (!this.addressForm.phone) {
promptAction.showToast({ message: $r('app.string.editaddress_phone_judge') });
return false;
}
if (this.addressForm.phone.length < 11) {
promptAction.showToast({ message: $r('app.string.editaddress_phone_judge_less_eleven') });
return false;
}
if (!this.addressForm.areaName) {
promptAction.showToast({ message: $r('app.string.editaddress_place_judge') });
return false;
}
if (!this.addressForm.area) {
promptAction.showToast({ message: $r('app.string.editaddress_detail_address_judge') });
return false;
}
return true;
}
/**
* 从TextPicker返回选中的数据中逐级查找省、市、区的名称,并将其组合成一个完整的地址字符串。
*/
getSelectedPlace(selectArr: number | number []) {
if (selectArr instanceof Array) {
let province = this.cascade[selectArr[0]]; // 获取省信息
let areaName = ""; // 存储最终构建的省市区名称
if (province) {
areaName += this.cascade[selectArr[0]].text; // 省的名称添加到容器里
if (province.children) { // 检查是否有市的信息
let city = province.children[selectArr[1]]; // 市的名称添加到容器里
if (city) {
areaName += city.text;
if (city.children) { // 检查是否有区的信息
areaName += city.children[selectArr[2]].text; // 区的名称添加到容器里
}
}
}
}
this.addressForm.areaName = areaName; // 将取出的省市区拼接的字符串回填给TextInput
return;
}
}
/**
* TextPickerView视图
*
* @param {Array<Cascade>} cascade - 联动资源属性
* @param {void} selectHandle - 点击确定逻辑
* @param {void} cancelHandle - 点击取消逻辑
* @param {number | number []} indexArr - 默认选中项在数组中的索引值
* @param {string | Resource} title - TextPickerView标题
*/
@Builder
textPickerBuild(cascade: Array<Cascade>,
selectHandle: (selectArr: number | number []) => void,
cancelHandle: () => void,
indexArr: number | number [], title: string | Resource) {
Column() {
TextPickerView({
cascade,
selectHandle,
cancelHandle,
indexArr,
title
});
}
}
build() {
Column() {
List({ scroller: this.scroller }) {
ListItem() {
Column() {
Text($r('app.string.editaddress_address_msg'))
.fontColor(Color.Black)
.fontSize(CommonConstants.TEXT_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width($r('app.string.editaddress_address_width'))
.height(CommonConstants.TEXT_HEIGHT)
.padding({ top: CommonConstants.PADDING_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_receiver') })
TextInput({ placeholder: $r('app.string.editaddress_receiver_name'), text: this.addressForm.name })
.margin({ left: CommonConstants.MARGIN_LEFT_TWO, right: CommonConstants.MARGIN_RIGHT_TWO })
.width($r('app.string.editaddress_textInput_width'))
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS_TWO)
.borderWidth(1)
.borderColor(this.isClicked ? $r('app.color.editaddress_editaddress_save_bgc_color') :
Color.Transparent)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.name = value;
})
.onEditChange(() => {
this.isClicked = !this.isClicked;
})
.id('recipient')
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.LIST_ITEM_ROW_HEIGHT)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_phone_number') })
Row() {
Text($r('app.string.editaddress_86'))
.fontSize(CommonConstants.LABEL_FONTSIZE)
.padding({ left: CommonConstants.PADDING_LEFT })
.onClick(() => {
// 调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
Image($r('app.media.editaddress_down'))
.aspectRatio(1)
.width(15)
.padding({ left: CommonConstants.PADDING_LEFT_TWO })
.onClick(() => {
// 调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
TextInput({ placeholder: $r('app.string.editaddress_phone_number'), text: this.addressForm.phone })
.type(InputType.PhoneNumber)// 电话号码输入模式
.backgroundColor(Color.Transparent)
.width($r('app.string.editaddress_textInput_width'))
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.phone = value;
if (value.length > PHONE_NUMBER_LENGTH) {
this.addressForm.phone = value.substring(0, PHONE_NUMBER_LENGTH)
promptAction.showToast({
// 设置最大输入手机号不能超过11位
message: $r('app.string.editaddress_phone_judge_more_eleven')
})
}
})
.onEditChange(() => {
this.isClicked1 = !this.isClicked1;
})
.id('phoneNumber')
}
.border({
color: this.isClicked1 ? $r('app.color.editaddress_editaddress_save_bgc_color') : Color.Transparent,
width: 1,
radius: CommonConstants.BORDER_RADIUS_THREE
})
.width($r('app.string.editaddress_textInput_width'))
.margin({ left: CommonConstants.MARGIN_LEFT_TWO })
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_local') })
Stack({ alignContent: Alignment.End }) {
TextInput({ placeholder: $r('app.string.editaddress_pca'), text: this.addressForm.areaName })
.width(CommonConstants.FULL_PERCENT)
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BORDER_RADIUS_THREE)
.enableKeyboardOnFocus(false)
.bindSheet($$this.isPresent,
this.textPickerBuild(this.cascade,
(selectArr: number | number []) => {
this.getSelectedPlace(selectArr);
this.isPresent = false;
this.isTextViewClicked = false;
}, () => {
this.isPresent = false;
this.isTextViewClicked = false;
}, this.addressForm.provinceArr, this.title), {
// TextInput绑定半模态转场
height: this.sheetHeight, // 半模态高度
dragBar: this.showDragBar, // 是否显示控制条
// 平板或折叠屏展开态在中间显示
preferType: this.isCenter ? SheetType.CENTER : SheetType.POPUP,
backgroundColor: $r('app.color.editaddress_btn_bgc'),
showClose: false, // 是否显示关闭图标
shouldDismiss: ((sheetDismiss: SheetDismiss) => { // 半模态页面交互式关闭回调函数
sheetDismiss.dismiss();
})
})
.onClick(() => {
this.isPresent = true;
this.isTextViewClicked = true;
})
.id('selectAddress')
Image($r('app.media.editaddress_right'))
.aspectRatio(1)
.width(CommonConstants.IMAGE_HEIGHT)
.padding({ right: CommonConstants.PADDING_RIGHT })
.onClick(() => {
this.isPresent = true;
})
}
.width($r('app.string.editaddress_textInput_width'))
.height(CommonConstants.STACK_HEIGHT_TWO)
.margin({ left: CommonConstants.MARGIN_LEFT })
.border({
color: this.isTextViewClicked ? $r('app.color.editaddress_editaddress_save_bgc_color') :
Color.Transparent,
width: 1,
radius: CommonConstants.BUBBLE_BORDER_RADIUS_TWO
})
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_detail_address') })
Stack({ alignContent: Alignment.End }) {
TextArea({ placeholder: $r('app.string.editaddress_detail_msg'), text: this.addressForm.area })
.width(CommonConstants.FULL_PERCENT)
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS_TWO)
.height(CommonConstants.TEXT_INPUT_HEIGHT)
.contentType(ContentType.FULL_STREET_ADDRESS)
.enableAutoFill(true)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.area = value;
})
.onEditChange(() => {
this.isClicked3 = !this.isClicked3;
})
.id('detailAddress')
Image($r('app.media.editaddres_loaction'))
.aspectRatio(1)
.width(CommonConstants.IMAGE_HEIGHT_TWO)
.onClick(() => {
// 调用Toast显示提示:此样式仅为案例展示
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
}
.width($r('app.string.editaddress_stack_width'))
.height(CommonConstants.STACK_HEIGHT)
.margin({ left: CommonConstants.MARGIN_LEFT, top: CommonConstants.MARGIN_TOP_THREE })
.border({
color: this.isClicked3 ? $r('app.color.editaddress_editaddress_save_bgc_color') : Color.Transparent,
width: 1,
radius: CommonConstants.BUBBLE_BORDER_RADIUS_TWO
})
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_THREE)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
Text($r('app.string.editaddress_address_tag'))
.fontColor(Color.Black)
.fontSize(CommonConstants.LABEL_NAME_FONTSIZE)
.fontWeight(CommonConstants.LABEL_FONT_WEIGHT)
.textAlign(TextAlign.Start)
Row() {
ForEach(ADDRESS_LABEL, (item: number) => {
Stack({ alignContent: Alignment.TopEnd }) {
Text('' + item)
.width(CommonConstants.BUBBLE_AREA_HEIGHT)
.height(CommonConstants.BUBBLE_AREA_HEIGHT)
.fontSize(CommonConstants.BUBBLE_FONTSIZE)
.fontColor(Color.White)
.fontWeight(CommonConstants.LABEL_BUBBLE_FONT_WEIGHT)
.textAlign(TextAlign.Center)
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS)
.onClick(() => {
this.addressForm.tag = '' + item;
})
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.margin({ left: CommonConstants.MARGIN_LEFT_THREE })
if (this.addressForm.tag === '' + item) { // 如果被选中,该地址标签打勾
Text("√")
.fontSize(CommonConstants.BUBBLE_CHECK_FONTSIZE)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.BUBBLE_CHECK_HEIGHT)
.height(CommonConstants.BUBBLE_CHECK_HEIGHT)
.fontColor(Color.White)
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.textAlign(TextAlign.Center)
.border({
width: 2,
color: Color.White,
radius: 55
})
.margin({ top: $r('app.string.editaddress_label_check') })
}
}
}, (item: string) => item)
}
.margin({ left: CommonConstants.BUBBLE_CHECK_FONTSIZE })
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_FOUR })
}
.margin({ left: CommonConstants.MARGIN_LEFT, right: CommonConstants.MARGIN_RIGHT })
}
.backgroundColor(Color.White)
.borderRadius(CommonConstants.BORDER_RADIUS)
.height(CommonConstants.LIST_ITEM_HEIGHT)
ListItem() {
Column() {
Text($r('app.string.editaddress_AI_write'))
.fontSize(CommonConstants.TEXT_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.TEXT_HEIGHT)
.padding({ top: CommonConstants.PADDING_TOP_TWO, bottom: CommonConstants.PADDING_BOTTOM })
TextArea({ placeholder: $r('app.string.editaddress_AI_write_msg'), text: this.pasteString })
.backgroundColor(Color.Transparent)
.contentType(ContentType.FULL_STREET_ADDRESS)
.enableAutoFill(true)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.padding({ left: 0, top: 12 })// 此处left:0表示光标顶格输入
.height(CommonConstants.TEXT_AREA_HEIGHT)
.onDidInsert((info: InsertValue) => {
this.addressString = info.insertValue;
})
.onFocus(() => {
this.flag = true; // 获得焦点时,标识需要键盘避让
})
.onBlur(() => {
this.flag = false; // 失去焦点时,标识不需要键盘避让
})
Row() {
/*
* TODO:知识点:已正式上架的应用,可使用智能填充服务进行地址识别。
* 详见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/scenario-fusion-intelligentfilling-autocomplete-V5
*/
Text($r('app.string.editaddress_paste'))
.fontColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.fontSize(CommonConstants.LABEL_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.End)
.width(CommonConstants.FULL_PERCENT)
.onClick(() => {
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
}
.height(CommonConstants.ROW_HEIGHT_TWO)
.width($r('app.string.editaddress_row_width'))
}.margin({ left: CommonConstants.MARGIN_LEFT, right: CommonConstants.MARGIN_RIGHT })
}
.backgroundColor(Color.White)
.borderRadius(CommonConstants.BORDER_RADIUS)
.height(CommonConstants.LIST_ITEM_HEIGHT_TWO)
.margin({ top: CommonConstants.MARGIN_TOP })
}
.onAreaChange(() => {
// 控制列表滚动条到底部
this.scroller.scrollEdge(Edge.Bottom);
})
.width($r('app.string.editaddress_list_width'))
// 列表高度-(键盘高度-底部row组件高度)即为键盘避让模式下列表的高度,再通过List.onAreaChange(){this.scroller.scrollEdge(Edge.Bottom);}
// 控制列表高度变化时使滚动条到达底部,从而实现类似键盘避让的效果。
.height(this.flag ?
px2vp(CommonConstants.LIST_HEIGHT - (this.keyboardHeight - CommonConstants.AVOID_AREA_HEIGHT)) :
px2vp(CommonConstants.LIST_HEIGHT))
.scrollBar(BarState.Off)
Blank()
Row() {
Button($r('app.string.editaddress_save'))
.borderRadius(CommonConstants.BORDER_RADIUS_TWO)
.fontWeight(FontWeight.Bold)
.foregroundColor(Color.White)
.height(CommonConstants.BUTTON_HEIGHT)
.width($r('app.string.editaddress_button_width'))
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.expandSafeArea([SafeAreaType.KEYBOARD])
.onClick(() => {
if (this.validForm()) {
promptAction.showToast({ message: $r('app.string.editaddress_save_success') });
}
})
}
.alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.Center)
.height(CommonConstants.ROW_HEIGHT)
.width($r('app.string.editaddress_row_width'))
}
.padding({ bottom: px2vp(this.avoidAreaBottomToModule) })
.width($r('app.string.editaddress_column_width'))
.height($r('app.string.editaddress_column_height'))
.backgroundColor($r('app.color.editaddress_column_bgc_color'))
}
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EditAddressView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'keyboardHeight' AST#expression#Right ) AST#decorator#Right keyboardHeight : 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 isClicked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 手机号输入框是否被选中 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isClicked1 : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 所在地区输入框是否被选中 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isTextViewClicked ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 详细地址输入框是否被选中 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isClicked3 : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 地址标签是否被选中 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isChecked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 智能填写输入框默认值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right pasteString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right // 智能框输入值 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right addressString : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right ; AST#property_declaration#Right // 省市区数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right addressForm : AST#type_annotation#Left AST#primary_type#Left Address 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 Address AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "" AST#expression#Right , AST#expression#Left "" AST#expression#Right , AST#expression#Left AST#array_literal#Left [ AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right , AST#expression#Left 0 AST#expression#Right ] AST#array_literal#Right AST#expression#Right , AST#expression#Left "" AST#expression#Right , AST#expression#Left "" AST#expression#Right , AST#expression#Left "" 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 flag : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 是否显示半屏模态页面 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isPresent : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right // 半模态高度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right sheetHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 300 AST#expression#Right ; AST#property_declaration#Right // 是否显示控制条 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right showDragBar : 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 isCenter : 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 fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'regionsdata.json' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'avoidAreaBottomToModule' AST#expression#Right ) AST#decorator#Right avoidAreaBottomToModule : 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 cascade : 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 Cascade 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 scroller : AST#type_annotation#Left AST#primary_type#Left ListScroller 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 ListScroller 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 // textPicker标题 AST#property_declaration#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_bind_sheet_title' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ; AST#property_declaration#Right AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . loadRegion 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 /**
* 从文件中读取省市区json数据
*/ AST#method_declaration#Left async loadRegion 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 { // 通过getRawFileContent()获取resources/rawfile目录下对应的文件内容,得到一个字节数组 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#call_expression#Left AST#expression#Left getContext AST#expression#Right AST#argument_list#Left ( AST#expression#Left this AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . resourceManager AST#member_expression#Right AST#expression#Right . getRawFileContent 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 . fileName AST#member_expression#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#variable_declaration#Left let AST#variable_declarator#Left rawFile = AST#expression#Left value AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left textDecoder = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left util AST#expression#Right . TextDecoder AST#member_expression#Right AST#expression#Right . create AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 'utf-8' AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left ignoreBOM AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left retStr = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left textDecoder AST#expression#Right . decodeToString AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left rawFile AST#expression#Right , AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left stream AST#property_name#Right : AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 再用@ohos.util (util工具函数)的TextDecoder给它解析出来 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 . cascade AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left JSON AST#expression#Right . parse AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left retStr 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#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left code = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . code AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left message = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#as_expression#Left AST#expression#Left error AST#expression#Right as AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#as_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right . message AST#member_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#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 ` callback getRawFileContent failed, error code: AST#template_substitution#Left $ { AST#expression#Left code AST#expression#Right } AST#template_substitution#Right , message: AST#template_substitution#Left $ { AST#expression#Left message AST#expression#Right } AST#template_substitution#Right . ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 保存时,校验表单从上到下每项必填的方法
*/ AST#method_declaration#Left validForm 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_name_judge' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_phone_judge' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#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#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right < AST#expression#Left 11 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_phone_judge_less_eleven' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_place_judge' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . area AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_detail_address_judge' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#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#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 从TextPicker返回选中的数据中逐级查找省、市、区的名称,并将其组合成一个完整的地址字符串。
*/ AST#method_declaration#Left getSelectedPlace AST#parameter_list#Left ( AST#parameter#Left selectArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left selectArr AST#expression#Right instanceof AST#expression#Left Array 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 province = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cascade AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left selectArr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 获取省信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left areaName = AST#expression#Left "" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 存储最终构建的省市区名称 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left province AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left areaName += 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 . cascade AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left selectArr AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . text 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . children AST#member_expression#Right AST#expression#Right ) AST#block_statement#Left { // 检查是否有市的信息 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left city = AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left province AST#expression#Right . children AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left selectArr AST#expression#Right [ AST#expression#Left 1 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 市的名称添加到容器里 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left city AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left areaName += AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . text 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#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . children 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 areaName += AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left city AST#expression#Right . children AST#member_expression#Right AST#expression#Right [ AST#expression#Left AST#subscript_expression#Left AST#expression#Left selectArr AST#expression#Right [ AST#expression#Left 2 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right . text 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#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right = AST#expression#Left areaName AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 将取出的省市区拼接的字符串回填给TextInput 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#method_declaration#Right /**
* TextPickerView视图
*
* @param {Array<Cascade>} cascade - 联动资源属性
* @param {void} selectHandle - 点击确定逻辑
* @param {void} cancelHandle - 点击取消逻辑
* @param {number | number []} indexArr - 默认选中项在数组中的索引值
* @param {string | Resource} title - TextPickerView标题
*/ AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right textPickerBuild AST#parameter_list#Left ( AST#parameter#Left cascade : 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 Cascade 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 selectHandle : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left selectArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cancelHandle : 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 indexArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#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#ui_custom_component_statement#Left TextPickerView ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left cascade AST#property_assignment#Right , AST#property_assignment#Left selectHandle AST#property_assignment#Right , AST#property_assignment#Left cancelHandle AST#property_assignment#Right , AST#property_assignment#Left indexArr AST#property_assignment#Right , AST#property_assignment#Left title AST#property_assignment#Right } AST#object_literal#Right AST#expression#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#builder_function_body#Right AST#method_declaration#Right AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter#Left scroller : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) 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 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.editaddress_address_msg' 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 . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_address_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_HEIGHT 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#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 label ( AST#component_parameters#Left { AST#component_parameter#Left labelName : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_receiver' AST#expression#Right ) AST#resource_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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_receiver_name' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . name AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_RIGHT_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_textInput_width' 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.editaddress_textInput_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_BORDER_RADIUS_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderWidth ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . borderColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClicked AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONTSIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONT_WEIGHT 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 value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . name 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 . onEditChange ( 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 . isClicked 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 . isClicked 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 . id ( AST#expression#Left 'recipient' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_ITEM_ROW_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left label ( AST#component_parameters#Left { AST#component_parameter#Left labelName : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_phone_number' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_86' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LABEL_FONTSIZE 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 left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_LEFT AST#member_expression#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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.editaddress_down' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left 15 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 AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_LEFT_TWO AST#member_expression#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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_phone_number' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . type ( AST#expression#Left AST#member_expression#Left AST#expression#Left InputType AST#expression#Right . PhoneNumber AST#member_expression#Right AST#expression#Right ) // 电话号码输入模式 AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_textInput_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONTSIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONT_WEIGHT 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 value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . phone 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#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value AST#expression#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left PHONE_NUMBER_LENGTH AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . phone AST#member_expression#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left value 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 PHONE_NUMBER_LENGTH 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { // 设置最大输入手机号不能超过11位 AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_phone_judge_more_eleven' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onEditChange ( 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 . isClicked1 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 . isClicked1 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 . id ( AST#expression#Left 'phoneNumber' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClicked1 AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Transparent 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 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BORDER_RADIUS_THREE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_textInput_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_textInput_bgc_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#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 CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT_FOUR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left label ( AST#component_parameters#Left { AST#component_parameter#Left labelName : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_local' AST#expression#Right ) AST#resource_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#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 . End 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 TextInput ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_pca' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . areaName AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_textInput_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BORDER_RADIUS_THREE AST#member_expression#Right 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#Left . bindSheet ( AST#expression#Left AST#member_expression#Left AST#expression#Left $$this AST#expression#Right . isPresent AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . textPickerBuild 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 . cascade AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left selectArr : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getSelectedPlace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left selectArr 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 . isPresent 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 . isTextViewClicked 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#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 . isPresent 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 . isTextViewClicked 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#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . provinceArr AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . title AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right , AST#expression#Left AST#object_literal#Left { // TextInput绑定半模态转场 AST#property_assignment#Left AST#property_name#Left height AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . sheetHeight AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 半模态高度 AST#property_assignment#Left AST#property_name#Left dragBar AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showDragBar AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , // 是否显示控制条 // 平板或折叠屏展开态在中间显示 AST#property_assignment#Left AST#property_name#Left preferType AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isCenter AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#member_expression#Left AST#expression#Left SheetType AST#expression#Right . CENTER AST#member_expression#Right AST#expression#Right : AST#expression#Left SheetType AST#expression#Right AST#conditional_expression#Right AST#expression#Right . POPUP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left backgroundColor AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_btn_bgc' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left showClose 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 shouldDismiss AST#property_name#Right : AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left sheetDismiss : AST#type_annotation#Left AST#primary_type#Left SheetDismiss 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 sheetDismiss AST#expression#Right . dismiss 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#parenthesized_expression#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPresent AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isTextViewClicked 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#Left . id ( AST#expression#Left 'selectAddress' 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.editaddress_right' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . IMAGE_HEIGHT 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 right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_RIGHT AST#member_expression#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#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isPresent AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_textInput_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . STACK_HEIGHT_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isTextViewClicked AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Transparent 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 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_BORDER_RADIUS_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT_FOUR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left label ( AST#component_parameters#Left { AST#component_parameter#Left labelName : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_detail_address' AST#expression#Right ) AST#resource_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#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 . End 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 TextArea ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_detail_msg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . area AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_textInput_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_BORDER_RADIUS_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_INPUT_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . contentType ( AST#expression#Left AST#member_expression#Left AST#expression#Left ContentType AST#expression#Right . FULL_STREET_ADDRESS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableAutoFill ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONTSIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONT_WEIGHT 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 value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . area 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 . onEditChange ( 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 . isClicked3 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 . isClicked3 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 . id ( AST#expression#Left 'detailAddress' AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#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.editaddres_loaction' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . aspectRatio ( AST#expression#Left 1 AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . IMAGE_HEIGHT_TWO 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 { // 调用Toast显示提示:此样式仅为案例展示 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_stack_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . STACK_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_THREE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isClicked3 AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right : AST#expression#Left Color AST#expression#Right AST#conditional_expression#Right AST#expression#Right . Transparent 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 1 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_BORDER_RADIUS_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT_THREE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_address_tag' 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 . Black AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LABEL_NAME_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LABEL_FONT_WEIGHT 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 . Start 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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left ADDRESS_LABEL AST#expression#Right , AST#ui_builder_arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#ui_arrow_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right . TopEnd AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#binary_expression#Left AST#expression#Left '' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_AREA_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_AREA_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LABEL_BUBBLE_FONT_WEIGHT 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 . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_BORDER_RADIUS 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . tag AST#member_expression#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left '' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT_THREE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . addressForm AST#member_expression#Right AST#expression#Right . tag AST#member_expression#Right AST#expression#Right === AST#expression#Left AST#binary_expression#Left AST#expression#Left '' AST#expression#Right + AST#expression#Left item AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) { // 如果被选中,该地址标签打勾 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "√" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_CHECK_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_CHECK_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_CHECK_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . textAlign ( AST#expression#Left AST#member_expression#Left AST#expression#Left TextAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . border ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left width AST#property_name#Right : AST#expression#Left 2 AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left color AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . White AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left radius AST#property_name#Right : AST#expression#Left 55 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_label_check' 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#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_if_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#ui_arrow_function_body#Right AST#ui_builder_arrow_function#Right , AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left item AST#expression#Right AST#arrow_function#Right AST#expression#Right ) AST#for_each_statement#Right AST#ui_control_flow#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUBBLE_CHECK_FONTSIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT_FOUR AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP_FOUR AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_RIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BORDER_RADIUS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_ITEM_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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ListItem ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_AI_write' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 . Start AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_HEIGHT 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#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_TOP_TWO AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PADDING_BOTTOM AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TextArea ( AST#component_parameters#Left { AST#component_parameter#Left placeholder : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_AI_write_msg' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#component_parameter#Right , AST#component_parameter#Left text : AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . pasteString AST#member_expression#Right AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color AST#expression#Right . Transparent AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . contentType ( AST#expression#Left AST#member_expression#Left AST#expression#Left ContentType AST#expression#Right . FULL_STREET_ADDRESS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . enableAutoFill ( AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Left . placeholderFont ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left size AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONTSIZE AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left weight AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . PLACE_HOLDER_FONT_WEIGHT AST#member_expression#Right 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 0 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#object_literal#Right AST#expression#Right ) // 此处left:0表示光标顶格输入 AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . TEXT_AREA_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . onDidInsert ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( AST#parameter#Left info : AST#type_annotation#Left AST#primary_type#Left InsertValue 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 . addressString AST#member_expression#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left info AST#expression#Right . insertValue 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 . onFocus ( 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 . flag 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#Left . onBlur ( 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 . flag AST#member_expression#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 失去焦点时,标识不需要键盘避让 } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { /*
* TODO:知识点:已正式上架的应用,可使用智能填充服务进行地址识别。
* 详见:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/scenario-fusion-intelligentfilling-autocomplete-V5
*/ 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.editaddress_paste' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.color.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LABEL_FONTSIZE AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold 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 . End AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . FULL_PERCENT 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 promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_only_show_ui' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_row_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#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left left AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_LEFT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#property_name#Left right AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_RIGHT AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#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 . White AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BORDER_RADIUS AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_ITEM_HEIGHT_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . margin ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left top AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . MARGIN_TOP AST#member_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#container_content_body#Right AST#ui_component#Right AST#modifier_chain_expression#Left . onAreaChange ( 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 . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom 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 . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_list_width' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) // 列表高度-(键盘高度-底部row组件高度)即为键盘避让模式下列表的高度,再通过List.onAreaChange(){this.scroller.scrollEdge(Edge.Bottom);} // 控制列表高度变化时使滚动条到达底部,从而实现类似键盘避让的效果。 AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . flag AST#member_expression#Right AST#expression#Right ? AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_HEIGHT 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 AST#member_expression#Left AST#expression#Left this AST#expression#Right . keyboardHeight AST#member_expression#Right AST#expression#Right - AST#expression#Left CommonConstants AST#expression#Right AST#binary_expression#Right AST#expression#Right . AVOID_AREA_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right : AST#expression#Left px2vp AST#expression#Right AST#conditional_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . LIST_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_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#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 Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Button ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_save' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . borderRadius ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BORDER_RADIUS_TWO AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . fontWeight ( AST#expression#Left AST#member_expression#Left AST#expression#Left FontWeight AST#expression#Right . Bold AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . foregroundColor ( 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 . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . BUTTON_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_button_width' 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.editaddress_editaddress_save_bgc_color' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . expandSafeArea ( AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#member_expression#Left AST#expression#Left SafeAreaType AST#expression#Right . KEYBOARD AST#member_expression#Right AST#expression#Right ] AST#array_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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . validForm AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left promptAction AST#expression#Right . showToast AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left message AST#property_name#Right : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_save_success' AST#expression#Right ) AST#resource_expression#Right AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#arrow_function#Right AST#expression#Right ) AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#modifier_chain_expression#Right AST#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 VerticalAlign AST#expression#Right . Bottom AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . justifyContent ( AST#expression#Left AST#member_expression#Left AST#expression#Left FlexAlign AST#expression#Right . Center AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expression#Left AST#member_expression#Left AST#expression#Left CommonConstants AST#expression#Right . ROW_HEIGHT AST#member_expression#Right AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_row_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#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 . padding ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left bottom AST#property_name#Right : AST#expression#Left AST#call_expression#Left AST#expression#Left px2vp AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avoidAreaBottomToModule 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#modifier_chain_expression#Left . width ( AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.string.editaddress_column_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.editaddress_column_height' 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.editaddress_column_bgc_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#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 EditAddressView {
@StorageLink('keyboardHeight') keyboardHeight: number = 0;
@State isClicked: boolean = false;
@State isClicked1: boolean = false;
@State isTextViewClicked?: boolean = false;
@State isClicked3: boolean = false;
@State isChecked: boolean = false;
@State pasteString: string = "";
@State addressString: string = "";
@State addressForm: Address = new Address("", "", [0, 0, 0], "", "", "");
@State flag: boolean = false;
@State isPresent: boolean = false;
@State sheetHeight: number = 300;
@State showDragBar: boolean = true;
@State isCenter: boolean = true;
存放文件地址
fileName: string = 'regionsdata.json';
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
@State cascade: Array<Cascade> = [];
scroller: ListScroller = new ListScroller();
title: string | Resource = $r('app.string.editaddress_bind_sheet_title');
aboutToAppear(): void {
this.loadRegion();
}
async loadRegion(): Promise<void> {
try {
getContext(this).resourceManager.getRawFileContent(this.fileName, (error: BusinessError, value: Uint8Array) => {
let rawFile = value;
let textDecoder = util.TextDecoder.create('utf-8', { ignoreBOM: true });
let retStr =
textDecoder.decodeToString(rawFile, { stream: false });
this.cascade = JSON.parse(retStr);
})
} catch (error) {
let code = (error as BusinessError).code;
let message = (error as BusinessError).message;
console.error(`callback getRawFileContent failed, error code: ${code}, message: ${message}.`);
}
}
validForm(): boolean {
if (!this.addressForm.name) {
promptAction.showToast({ message: $r('app.string.editaddress_name_judge') });
return false;
}
if (!this.addressForm.phone) {
promptAction.showToast({ message: $r('app.string.editaddress_phone_judge') });
return false;
}
if (this.addressForm.phone.length < 11) {
promptAction.showToast({ message: $r('app.string.editaddress_phone_judge_less_eleven') });
return false;
}
if (!this.addressForm.areaName) {
promptAction.showToast({ message: $r('app.string.editaddress_place_judge') });
return false;
}
if (!this.addressForm.area) {
promptAction.showToast({ message: $r('app.string.editaddress_detail_address_judge') });
return false;
}
return true;
}
getSelectedPlace(selectArr: number | number []) {
if (selectArr instanceof Array) {
let province = this.cascade[selectArr[0]];
let areaName = "";
if (province) {
areaName += this.cascade[selectArr[0]].text;
if (province.children) {
let city = province.children[selectArr[1]];
if (city) {
areaName += city.text;
if (city.children) {
areaName += city.children[selectArr[2]].text;
}
}
}
}
this.addressForm.areaName = areaName;
return;
}
}
@Builder
textPickerBuild(cascade: Array<Cascade>,
selectHandle: (selectArr: number | number []) => void,
cancelHandle: () => void,
indexArr: number | number [], title: string | Resource) {
Column() {
TextPickerView({
cascade,
selectHandle,
cancelHandle,
indexArr,
title
});
}
}
build() {
Column() {
List({ scroller: this.scroller }) {
ListItem() {
Column() {
Text($r('app.string.editaddress_address_msg'))
.fontColor(Color.Black)
.fontSize(CommonConstants.TEXT_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width($r('app.string.editaddress_address_width'))
.height(CommonConstants.TEXT_HEIGHT)
.padding({ top: CommonConstants.PADDING_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_receiver') })
TextInput({ placeholder: $r('app.string.editaddress_receiver_name'), text: this.addressForm.name })
.margin({ left: CommonConstants.MARGIN_LEFT_TWO, right: CommonConstants.MARGIN_RIGHT_TWO })
.width($r('app.string.editaddress_textInput_width'))
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS_TWO)
.borderWidth(1)
.borderColor(this.isClicked ? $r('app.color.editaddress_editaddress_save_bgc_color') :
Color.Transparent)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.name = value;
})
.onEditChange(() => {
this.isClicked = !this.isClicked;
})
.id('recipient')
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.LIST_ITEM_ROW_HEIGHT)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_phone_number') })
Row() {
Text($r('app.string.editaddress_86'))
.fontSize(CommonConstants.LABEL_FONTSIZE)
.padding({ left: CommonConstants.PADDING_LEFT })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
Image($r('app.media.editaddress_down'))
.aspectRatio(1)
.width(15)
.padding({ left: CommonConstants.PADDING_LEFT_TWO })
.onClick(() => {
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
TextInput({ placeholder: $r('app.string.editaddress_phone_number'), text: this.addressForm.phone })
.type(InputType.PhoneNumber)
.backgroundColor(Color.Transparent)
.width($r('app.string.editaddress_textInput_width'))
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.phone = value;
if (value.length > PHONE_NUMBER_LENGTH) {
this.addressForm.phone = value.substring(0, PHONE_NUMBER_LENGTH)
promptAction.showToast({
message: $r('app.string.editaddress_phone_judge_more_eleven')
})
}
})
.onEditChange(() => {
this.isClicked1 = !this.isClicked1;
})
.id('phoneNumber')
}
.border({
color: this.isClicked1 ? $r('app.color.editaddress_editaddress_save_bgc_color') : Color.Transparent,
width: 1,
radius: CommonConstants.BORDER_RADIUS_THREE
})
.width($r('app.string.editaddress_textInput_width'))
.margin({ left: CommonConstants.MARGIN_LEFT_TWO })
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_local') })
Stack({ alignContent: Alignment.End }) {
TextInput({ placeholder: $r('app.string.editaddress_pca'), text: this.addressForm.areaName })
.width(CommonConstants.FULL_PERCENT)
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BORDER_RADIUS_THREE)
.enableKeyboardOnFocus(false)
.bindSheet($$this.isPresent,
this.textPickerBuild(this.cascade,
(selectArr: number | number []) => {
this.getSelectedPlace(selectArr);
this.isPresent = false;
this.isTextViewClicked = false;
}, () => {
this.isPresent = false;
this.isTextViewClicked = false;
}, this.addressForm.provinceArr, this.title), {
height: this.sheetHeight,
dragBar: this.showDragBar,
preferType: this.isCenter ? SheetType.CENTER : SheetType.POPUP,
backgroundColor: $r('app.color.editaddress_btn_bgc'),
showClose: false,
shouldDismiss: ((sheetDismiss: SheetDismiss) => {
sheetDismiss.dismiss();
})
})
.onClick(() => {
this.isPresent = true;
this.isTextViewClicked = true;
})
.id('selectAddress')
Image($r('app.media.editaddress_right'))
.aspectRatio(1)
.width(CommonConstants.IMAGE_HEIGHT)
.padding({ right: CommonConstants.PADDING_RIGHT })
.onClick(() => {
this.isPresent = true;
})
}
.width($r('app.string.editaddress_textInput_width'))
.height(CommonConstants.STACK_HEIGHT_TWO)
.margin({ left: CommonConstants.MARGIN_LEFT })
.border({
color: this.isTextViewClicked ? $r('app.color.editaddress_editaddress_save_bgc_color') :
Color.Transparent,
width: 1,
radius: CommonConstants.BUBBLE_BORDER_RADIUS_TWO
})
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
label({ labelName: $r('app.string.editaddress_detail_address') })
Stack({ alignContent: Alignment.End }) {
TextArea({ placeholder: $r('app.string.editaddress_detail_msg'), text: this.addressForm.area })
.width(CommonConstants.FULL_PERCENT)
.backgroundColor($r('app.color.editaddress_textInput_bgc_color'))
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS_TWO)
.height(CommonConstants.TEXT_INPUT_HEIGHT)
.contentType(ContentType.FULL_STREET_ADDRESS)
.enableAutoFill(true)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.onChange((value: string) => {
this.addressForm.area = value;
})
.onEditChange(() => {
this.isClicked3 = !this.isClicked3;
})
.id('detailAddress')
Image($r('app.media.editaddres_loaction'))
.aspectRatio(1)
.width(CommonConstants.IMAGE_HEIGHT_TWO)
.onClick(() => {
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
}
.width($r('app.string.editaddress_stack_width'))
.height(CommonConstants.STACK_HEIGHT)
.margin({ left: CommonConstants.MARGIN_LEFT, top: CommonConstants.MARGIN_TOP_THREE })
.border({
color: this.isClicked3 ? $r('app.color.editaddress_editaddress_save_bgc_color') : Color.Transparent,
width: 1,
radius: CommonConstants.BUBBLE_BORDER_RADIUS_TWO
})
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_THREE)
.margin({ top: CommonConstants.MARGIN_TOP_TWO })
Row() {
Text($r('app.string.editaddress_address_tag'))
.fontColor(Color.Black)
.fontSize(CommonConstants.LABEL_NAME_FONTSIZE)
.fontWeight(CommonConstants.LABEL_FONT_WEIGHT)
.textAlign(TextAlign.Start)
Row() {
ForEach(ADDRESS_LABEL, (item: number) => {
Stack({ alignContent: Alignment.TopEnd }) {
Text('' + item)
.width(CommonConstants.BUBBLE_AREA_HEIGHT)
.height(CommonConstants.BUBBLE_AREA_HEIGHT)
.fontSize(CommonConstants.BUBBLE_FONTSIZE)
.fontColor(Color.White)
.fontWeight(CommonConstants.LABEL_BUBBLE_FONT_WEIGHT)
.textAlign(TextAlign.Center)
.borderRadius(CommonConstants.BUBBLE_BORDER_RADIUS)
.onClick(() => {
this.addressForm.tag = '' + item;
})
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.margin({ left: CommonConstants.MARGIN_LEFT_THREE })
if (this.addressForm.tag === '' + item) {
Text("√")
.fontSize(CommonConstants.BUBBLE_CHECK_FONTSIZE)
.fontWeight(FontWeight.Bold)
.width(CommonConstants.BUBBLE_CHECK_HEIGHT)
.height(CommonConstants.BUBBLE_CHECK_HEIGHT)
.fontColor(Color.White)
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.textAlign(TextAlign.Center)
.border({
width: 2,
color: Color.White,
radius: 55
})
.margin({ top: $r('app.string.editaddress_label_check') })
}
}
}, (item: string) => item)
}
.margin({ left: CommonConstants.BUBBLE_CHECK_FONTSIZE })
}
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.ROW_HEIGHT_FOUR)
.margin({ top: CommonConstants.MARGIN_TOP_FOUR })
}
.margin({ left: CommonConstants.MARGIN_LEFT, right: CommonConstants.MARGIN_RIGHT })
}
.backgroundColor(Color.White)
.borderRadius(CommonConstants.BORDER_RADIUS)
.height(CommonConstants.LIST_ITEM_HEIGHT)
ListItem() {
Column() {
Text($r('app.string.editaddress_AI_write'))
.fontSize(CommonConstants.TEXT_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.Start)
.width(CommonConstants.FULL_PERCENT)
.height(CommonConstants.TEXT_HEIGHT)
.padding({ top: CommonConstants.PADDING_TOP_TWO, bottom: CommonConstants.PADDING_BOTTOM })
TextArea({ placeholder: $r('app.string.editaddress_AI_write_msg'), text: this.pasteString })
.backgroundColor(Color.Transparent)
.contentType(ContentType.FULL_STREET_ADDRESS)
.enableAutoFill(true)
.placeholderFont({
size: CommonConstants.PLACE_HOLDER_FONTSIZE,
weight: CommonConstants.PLACE_HOLDER_FONT_WEIGHT
})
.padding({ left: 0, top: 12 })
.height(CommonConstants.TEXT_AREA_HEIGHT)
.onDidInsert((info: InsertValue) => {
this.addressString = info.insertValue;
})
.onFocus(() => {
this.flag = true;
})
.onBlur(() => {
this.flag = false;
})
Row() {
Text($r('app.string.editaddress_paste'))
.fontColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.fontSize(CommonConstants.LABEL_FONTSIZE)
.fontWeight(FontWeight.Bold)
.textAlign(TextAlign.End)
.width(CommonConstants.FULL_PERCENT)
.onClick(() => {
promptAction.showToast({ message: $r('app.string.editaddress_only_show_ui') });
})
}
.height(CommonConstants.ROW_HEIGHT_TWO)
.width($r('app.string.editaddress_row_width'))
}.margin({ left: CommonConstants.MARGIN_LEFT, right: CommonConstants.MARGIN_RIGHT })
}
.backgroundColor(Color.White)
.borderRadius(CommonConstants.BORDER_RADIUS)
.height(CommonConstants.LIST_ITEM_HEIGHT_TWO)
.margin({ top: CommonConstants.MARGIN_TOP })
}
.onAreaChange(() => {
this.scroller.scrollEdge(Edge.Bottom);
})
.width($r('app.string.editaddress_list_width'))
.height(this.flag ?
px2vp(CommonConstants.LIST_HEIGHT - (this.keyboardHeight - CommonConstants.AVOID_AREA_HEIGHT)) :
px2vp(CommonConstants.LIST_HEIGHT))
.scrollBar(BarState.Off)
Blank()
Row() {
Button($r('app.string.editaddress_save'))
.borderRadius(CommonConstants.BORDER_RADIUS_TWO)
.fontWeight(FontWeight.Bold)
.foregroundColor(Color.White)
.height(CommonConstants.BUTTON_HEIGHT)
.width($r('app.string.editaddress_button_width'))
.backgroundColor($r('app.color.editaddress_editaddress_save_bgc_color'))
.expandSafeArea([SafeAreaType.KEYBOARD])
.onClick(() => {
if (this.validForm()) {
promptAction.showToast({ message: $r('app.string.editaddress_save_success') });
}
})
}
.alignItems(VerticalAlign.Bottom)
.justifyContent(FlexAlign.Center)
.height(CommonConstants.ROW_HEIGHT)
.width($r('app.string.editaddress_row_width'))
}
.padding({ bottom: px2vp(this.avoidAreaBottomToModule) })
.width($r('app.string.editaddress_column_width'))
.height($r('app.string.editaddress_column_height'))
.backgroundColor($r('app.color.editaddress_column_bgc_color'))
}
}
|
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/editaddress/src/main/ets/view/EditAddressView.ets#L107-L591
|
b2c119933516f4eb56ed8727aa0cacdd1f2e879e
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/GreetingTypes.ets
|
arkts
|
导出的祝福语条目接口(重新定义以匹配使用)
|
export interface ExportedGreeting {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string[];
isCustom: boolean;
usageCount: number;
rating: number;
createdAt: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface ExportedGreeting 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#type_member#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left style : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left occasion : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tags : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isCustom : 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 usageCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left rating : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : 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 ExportedGreeting {
id: string;
content: string;
style: string;
occasion: string;
language: string;
tags: string[];
isCustom: boolean;
usageCount: number;
rating: number;
createdAt: string;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L322-L333
|
3b50a5de97b9cd7f06ead03eba93fe8b2320ffed
|
github
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
core/data/src/main/ets/repository/FootprintRepository.ets
|
arkts
|
@file 用户足迹本地仓库,封装数据库数据源并提供业务方法。
@author Joker.X
|
export class FootprintRepository {
/**
* 本地数据源实例
*/
private dataSource: FootprintLocalDataSource;
/**
* 构造函数
* @param {FootprintLocalDataSource} dataSource 可选的数据源实例
*/
constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
}
/**
* 添加足迹记录
* @param {Footprint} footprint 足迹记录
* @returns {Promise<void>} Promise<void>
*/
addFootprint(footprint: Footprint): Promise<void> {
return this.dataSource.addFootprint(footprint);
}
/**
* 根据商品ID删除足迹记录
* @param {number} goodsId 商品ID
* @returns {Promise<void>} Promise<void>
*/
removeFootprint(goodsId: number): Promise<void> {
return this.dataSource.removeFootprint(goodsId);
}
/**
* 清空所有足迹记录
* @returns {Promise<void>} Promise<void>
*/
clearAllFootprints(): Promise<void> {
return this.dataSource.clearAllFootprints();
}
/**
* 获取所有足迹记录,按浏览时间倒序
* @returns {Promise<Footprint[]>} 足迹列表
*/
getAllFootprints(): Promise<Footprint[]> {
return this.dataSource.getAllFootprints();
}
/**
* 获取足迹记录总数量
* @returns {Promise<number>} 足迹数量
*/
getFootprintCount(): Promise<number> {
return this.dataSource.getFootprintCount();
}
/**
* 获取指定数量的最新足迹记录
* @param {number} limit 限制数量
* @returns {Promise<Footprint[]>} 足迹列表
*/
getRecentFootprints(limit: number): Promise<Footprint[]> {
return this.dataSource.getRecentFootprints(limit);
}
/**
* 根据商品ID获取足迹记录
* @param {number} goodsId 商品ID
* @returns {Promise<Footprint | undefined>} 匹配到的足迹
*/
getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> {
return this.dataSource.getFootprintByGoodsId(goodsId);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class FootprintRepository AST#class_body#Left { /**
* 本地数据源实例
*/ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left FootprintLocalDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
* 构造函数
* @param {FootprintLocalDataSource} dataSource 可选的数据源实例
*/ AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left dataSource : AST#type_annotation#Left AST#primary_type#Left FootprintLocalDataSource 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 FootprintLocalDataSourceImpl AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#parameter#Right ) AST#parameter_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 . dataSource AST#member_expression#Right = AST#expression#Left dataSource 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 /**
* 添加足迹记录
* @param {Footprint} footprint 足迹记录
* @returns {Promise<void>} Promise<void>
*/ AST#method_declaration#Left addFootprint AST#parameter_list#Left ( AST#parameter#Left footprint : AST#type_annotation#Left AST#primary_type#Left Footprint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . addFootprint AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left footprint 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 /**
* 根据商品ID删除足迹记录
* @param {number} goodsId 商品ID
* @returns {Promise<void>} Promise<void>
*/ AST#method_declaration#Left removeFootprint AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left 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 this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . removeFootprint AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId 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 /**
* 清空所有足迹记录
* @returns {Promise<void>} Promise<void>
*/ AST#method_declaration#Left clearAllFootprints 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 this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . clearAllFootprints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取所有足迹记录,按浏览时间倒序
* @returns {Promise<Footprint[]>} 足迹列表
*/ AST#method_declaration#Left getAllFootprints AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Footprint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getAllFootprints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 获取足迹记录总数量
* @returns {Promise<number>} 足迹数量
*/ AST#method_declaration#Left getFootprintCount 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#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getFootprintCount 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 /**
* 获取指定数量的最新足迹记录
* @param {number} limit 限制数量
* @returns {Promise<Footprint[]>} 足迹列表
*/ AST#method_declaration#Left getRecentFootprints AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Footprint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getRecentFootprints AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left limit 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 /**
* 根据商品ID获取足迹记录
* @param {number} goodsId 商品ID
* @returns {Promise<Footprint | undefined>} 匹配到的足迹
*/ AST#method_declaration#Left getFootprintByGoodsId AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Footprint AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#generic_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . dataSource AST#member_expression#Right AST#expression#Right . getFootprintByGoodsId AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left goodsId AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class FootprintRepository {
private dataSource: FootprintLocalDataSource;
constructor(dataSource: FootprintLocalDataSource = new FootprintLocalDataSourceImpl()) {
this.dataSource = dataSource;
}
addFootprint(footprint: Footprint): Promise<void> {
return this.dataSource.addFootprint(footprint);
}
removeFootprint(goodsId: number): Promise<void> {
return this.dataSource.removeFootprint(goodsId);
}
clearAllFootprints(): Promise<void> {
return this.dataSource.clearAllFootprints();
}
getAllFootprints(): Promise<Footprint[]> {
return this.dataSource.getAllFootprints();
}
getFootprintCount(): Promise<number> {
return this.dataSource.getFootprintCount();
}
getRecentFootprints(limit: number): Promise<Footprint[]> {
return this.dataSource.getRecentFootprints(limit);
}
getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> {
return this.dataSource.getFootprintByGoodsId(goodsId);
}
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L8-L81
|
37e4669864876dd344674b8df5173ae4c3461561
|
github
|
|
openharmony-tpc/ohos_mpchart
|
4fb43a7137320ef2fee2634598f53d93975dfb4a
|
library/src/main/ets/components/data/RadarData.ets
|
arkts
|
setLabels
|
Sets the labels that should be drawn around the RadarChart at the end of each web line.
@param labels
|
setLabels(labels: string[]): void;
|
AST#method_declaration#Left setLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#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
|
setLabels(labels: string[]): void;
|
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/RadarData.ets#L43-L43
|
6f7ff2564f45fe04175819dc61c9a1198e93dedb
|
gitee
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/CommonTypes.ets
|
arkts
|
选择器选项接口
|
export interface SelectOption {
label: string;
value: string | number;
disabled?: boolean;
icon?: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface SelectOption AST#object_type#Left { AST#type_member#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left value : 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#type_member#Left disabled ? : 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 icon ? : 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 SelectOption {
label: string;
value: string | number;
disabled?: boolean;
icon?: string;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L146-L151
|
de8df7e34b2b41f9642c173b526ca2dfa3a60b12
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/GreetingTypes.ets
|
arkts
|
AI模型配置接口
|
export interface AIModelConfig {
id: string;
name: string;
provider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
isDefault: boolean;
enabled: boolean;
createdAt: string;
updatedAt: string;
}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface AIModelConfig 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#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left AIProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left apiUrl ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left model : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left maxTokens : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left temperature : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left topP ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left frequencyPenalty ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left presencePenalty ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isDefault : 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 enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left createdAt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left updatedAt : 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 AIModelConfig {
id: string;
name: string;
provider: AIProvider;
apiKey: string;
apiUrl?: string;
model: string;
maxTokens: number;
temperature: number;
topP?: number;
frequencyPenalty?: number;
presencePenalty?: number;
isDefault: boolean;
enabled: boolean;
createdAt: string;
updatedAt: string;
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L487-L503
|
201395148a103fc9319017e83ecdefb27513bc90
|
github
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
entry/src/main/ets/common/types/GlobalTypes.ets
|
arkts
|
区域接口
|
export interface Area extends Position, Size {}
|
AST#export_declaration#Left export AST#interface_declaration#Left interface Area AST#extends_clause#Left extends Position , Size AST#extends_clause#Right AST#object_type#Left { } AST#object_type#Right AST#interface_declaration#Right AST#export_declaration#Right
|
export interface Area extends Position, Size {}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L132-L132
|
62d063d97750da871cf20ba3b5a480e26669ebcc
|
github
|
|
zl3624/harmonyos_network_samples
|
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
|
code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets
|
arkts
|
buildBodyContent
|
构造上传文本文件的body内容
|
buildBodyContent(boundary: string, fileName: string, content: string) {
let body = `--${boundary}\r\n`
body = body + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
body = body + `Content-Type: text/plain\r\n`
body = body + '\r\n'
body = body + content
body = body + '\r\n'
body = body + `--${boundary}`
body = body + '--\r\n'
return body
}
|
AST#method_declaration#Left buildBodyContent AST#parameter_list#Left ( AST#parameter#Left boundary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ERROR#Left let body AST#ERROR#Left = AST#expression#Left AST#template_literal#Left ` -- AST#template_substitution#Left $ { AST#expression#Left boundary AST#expression#Right } AST#template_substitution#Right \r \n ` AST#template_literal#Right AST#expression#Right body = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left AST#template_literal#Left ` Content-Disposition: form-data; name="file"; filename=" AST#template_substitution#Left $ { AST#expression#Left fileName AST#expression#Right } AST#template_substitution#Right " \r \n ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right body = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left AST#template_literal#Left ` Content-Type: text/plain \r \n ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right body = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left '\r\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right body AST#ERROR#Right = AST#expression#Left body AST#expression#Right + AST#assignment_expression#Left content AST#ERROR#Left body = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left '\r\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right body = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left AST#template_literal#Left ` -- AST#template_substitution#Left $ { AST#expression#Left boundary AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right body AST#ERROR#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left body AST#expression#Right + AST#expression#Left '--\r\n' AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right return AST#expression#Left body AST#expression#Right AST#ERROR#Right } AST#builder_function_body#Right AST#method_declaration#Right
|
buildBodyContent(boundary: string, fileName: string, content: string) {
let body = `--${boundary}\r\n`
body = body + `Content-Disposition: form-data; name="file"; filename="${fileName}"\r\n`
body = body + `Content-Type: text/plain\r\n`
body = body + '\r\n'
body = body + content
body = body + '\r\n'
body = body + `--${boundary}`
body = body + '--\r\n'
return body
}
|
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestUpload/entry/src/main/ets/pages/Index.ets#L101-L111
|
71420987cf737efb990ca42f84e17c1cfcc30e5c
|
gitee
|
tongyuyan/harmony-utils
|
697472f011a43e783eeefaa28ef9d713c4171726
|
harmony_utils/src/main/ets/utils/NumberUtil.ets
|
arkts
|
TODO number工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01
|
export class NumberUtil {
/**
* 检查值是否为NaN
* @param value
* @returns
*/
static isNaN(value: Any): boolean {
return Number.isNaN(value);
}
/**
* 检查值是否为有限数字
* @param value
* @returns
*/
static isFinite(value: Any): boolean {
return Number.isFinite(value);
}
/**
* 检查值是否为整数
* @param value
* @returns
*/
static isInteger(value: Any): boolean {
return Number.isInteger(value);
}
/**
* 检查值是否为安全整数
* @param value
* @returns
*/
static isSafeInteger(value: Any): boolean {
return Number.isSafeInteger(value);
}
/**
* 判断是否是数值
* @param value 需要判断的参数
*/
static isNumber(value: Any): boolean {
return (typeof value === "number") && !NumberUtil.isNaN(value);
}
/**
* 检查数字是否为偶数
* @param {number} num - 要检查的数字
* @returns {boolean} 如果是偶数返回 true,否则返回 false
*/
static isEven(num: number): boolean {
return num % 2 === 0;
}
/**
* 检查数字是否为奇数
* @param {number} num - 要检查的数字
* @returns {boolean} 如果是奇数返回 true,否则返回 false
*/
static isOdd(num: number): boolean {
return num % 2 !== 0;
}
/**
* 将字符串转换为Number。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/
static toNumber(value: string, defaultValue: number = Number.NaN): number {
let num = Number(value).valueOf();
if (isNaN(num)) {
return defaultValue;
}
return num
}
/**
* 将字符串转换为整数。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/
static toInt(value: string, defaultValue: number = Number.NaN): number {
const parseValue = parseInt(value);
if (isNaN(parseValue)) {
return defaultValue;
}
return parseValue;
}
/**
* 将字符串转换为浮点数。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/
static toFloat(value: string, defaultValue: number = Number.NaN): number {
const parseValue = parseFloat(value);
if (isNaN(parseValue)) {
return defaultValue;
}
return parseValue;
}
/**
* 计算数字的平均值
* @param numbers - 要计算的数字列表
* @returns 平均值
*/
static average(...numbers: number[]): number {
if (numbers.length > 0) {
const sum = numbers.reduce((acc, num) => acc + num, 0);
return sum / numbers.length;
}
return 0;
}
/**
* 保留几位小数(默认保留两位小数)
* @param value
* @param digit 位数,默认保留两位小数;digit小于0返回value原值。-1、0、1、2、3、4、5、6、7、8、9...这样的Int类型数据
* @returns
*/
static keepDecimals(value: number, digit: number = 2): number {
if (digit > 0) {
digit = Math.trunc(digit); //取整
const digits = Math.pow(10, digit);
return Math.round(value * digits) / digits;
} else if (digit === 0) {
return Math.round(value);
}
return value;
}
/**
* 加法
* @param x
* @param y
* @returns
*/
static add(x: number, y: number): number {
return NumberUtil.addDecimal(x, y).toNumber();
}
/**
* 减法
* @param x
* @param y
* @returns
*/
static sub(x: number, y: number): number {
return NumberUtil.subDecimal(x, y).toNumber();
}
/**
* 求和
* @param x
* @param y
* @returns
*/
static sum(...n: number[]): number {
return NumberUtil.sumDecimal(...n).toNumber();
}
/**
* 构造Decimal
* @param value
* @returns
*/
static toDecimal(value: Value): Decimal {
return new Decimal(value);
}
/**
* 加法Decimal
* @param x
* @param y
* @returns
*/
static addDecimal(x: Value, y: Value): Decimal {
return Decimal.add(x, y);
}
/**
* 减法Decimal
* @param x
* @param y
* @returns
*/
static subDecimal(x: Value, y: Value): Decimal {
return Decimal.sub(x, y);
}
/**
* 求和Decimal
* @param x
* @param y
* @returns
*/
static sumDecimal(...n: Value[]): Decimal {
return Decimal.sum(...n);
}
}
|
AST#export_declaration#Left export AST#class_declaration#Left class NumberUtil AST#class_body#Left { /**
* 检查值是否为NaN
* @param value
* @returns
*/ AST#method_declaration#Left static isNaN AST#parameter_list#Left ( AST#parameter#Left value : 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 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 Number AST#expression#Right . isNaN 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 /**
* 检查值是否为有限数字
* @param value
* @returns
*/ AST#method_declaration#Left static isFinite AST#parameter_list#Left ( AST#parameter#Left value : 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 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 Number AST#expression#Right . isFinite 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 /**
* 检查值是否为整数
* @param value
* @returns
*/ AST#method_declaration#Left static isInteger AST#parameter_list#Left ( AST#parameter#Left value : 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 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 Number AST#expression#Right . isInteger 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 /**
* 检查值是否为安全整数
* @param value
* @returns
*/ AST#method_declaration#Left static isSafeInteger AST#parameter_list#Left ( AST#parameter#Left value : 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 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 Number AST#expression#Right . isSafeInteger 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 /**
* 判断是否是数值
* @param value 需要判断的参数
*/ AST#method_declaration#Left static isNumber AST#parameter_list#Left ( AST#parameter#Left value : 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 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#parenthesized_expression#Left ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left typeof AST#expression#Left value AST#expression#Right AST#unary_expression#Right AST#expression#Right === AST#expression#Left "number" AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right && AST#expression#Left AST#unary_expression#Left ! AST#expression#Left NumberUtil AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right . isNaN 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 /**
* 检查数字是否为偶数
* @param {number} num - 要检查的数字
* @returns {boolean} 如果是偶数返回 true,否则返回 false
*/ AST#method_declaration#Left static isEven 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left num AST#expression#Right % AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 检查数字是否为奇数
* @param {number} num - 要检查的数字
* @returns {boolean} 如果是奇数返回 true,否则返回 false
*/ AST#method_declaration#Left static isOdd 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 boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left num AST#expression#Right % AST#expression#Left 2 AST#expression#Right AST#binary_expression#Right AST#expression#Right !== AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 将字符串转换为Number。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/ AST#method_declaration#Left static toNumber AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : 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 Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#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 num = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left Number 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 . valueOf 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#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left num 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 defaultValue 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 num AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 将字符串转换为整数。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/ AST#method_declaration#Left static toInt AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : 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 Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#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 const AST#variable_declarator#Left parseValue = AST#expression#Left AST#call_expression#Left AST#expression#Left parseInt 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left parseValue 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 defaultValue 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 parseValue AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 将字符串转换为浮点数。
* @param value 要转换的字符串
* @param defaultValue 异常时给默认值
* @returns
*/ AST#method_declaration#Left static toFloat AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : 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 Number AST#expression#Right . NaN AST#member_expression#Right AST#expression#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 const AST#variable_declarator#Left parseValue = AST#expression#Left AST#call_expression#Left AST#expression#Left parseFloat 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#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left isNaN AST#expression#Right AST#argument_list#Left ( AST#expression#Left parseValue 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 defaultValue 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 parseValue AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 计算数字的平均值
* @param numbers - 要计算的数字列表
* @returns 平均值
*/ AST#method_declaration#Left static average AST#parameter_list#Left ( AST#parameter#Left ... numbers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number 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 numbers 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#variable_declaration#Left const AST#variable_declarator#Left sum = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left numbers AST#expression#Right . reduce 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 acc AST#parameter#Right , AST#parameter#Left num AST#parameter#Right ) AST#parameter_list#Right => AST#expression#Left AST#binary_expression#Left AST#expression#Left acc AST#expression#Right + AST#expression#Left num AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#arrow_function#Right AST#expression#Right , AST#expression#Left 0 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#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 AST#binary_expression#Left AST#expression#Left sum AST#expression#Right / AST#expression#Left numbers AST#expression#Right AST#binary_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#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left 0 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 保留几位小数(默认保留两位小数)
* @param value
* @param digit 位数,默认保留两位小数;digit小于0返回value原值。-1、0、1、2、3、4、5、6、7、8、9...这样的Int类型数据
* @returns
*/ AST#method_declaration#Left static keepDecimals AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left digit : 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#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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left digit AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left digit = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . trunc AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left digit AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right //取整 AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left digits = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . pow AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 10 AST#expression#Right , AST#expression#Left digit AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left 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 AST#binary_expression#Left AST#expression#Left value AST#expression#Right * AST#expression#Left digits AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#expression#Left digits 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 digit AST#expression#Right === AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math AST#expression#Right . round 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#if_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left value AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 加法
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static add AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 NumberUtil AST#expression#Right . addDecimal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toNumber 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 /**
* 减法
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static sub AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#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 NumberUtil AST#expression#Right . subDecimal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toNumber 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 /**
* 求和
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static sum AST#parameter_list#Left ( AST#parameter#Left ... n : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left 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 NumberUtil AST#expression#Right . sumDecimal AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left n AST#expression#Right AST#spread_element#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . toNumber 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 /**
* 构造Decimal
* @param value
* @returns
*/ AST#method_declaration#Left static toDecimal AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Decimal AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Decimal AST#expression#Right AST#new_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 /**
* 加法Decimal
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static addDecimal AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Decimal 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 Decimal AST#expression#Right . add AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 减法Decimal
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static subDecimal AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left Value AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Decimal 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 Decimal AST#expression#Right . sub AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left x AST#expression#Right , AST#expression#Left y AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right /**
* 求和Decimal
* @param x
* @param y
* @returns
*/ AST#method_declaration#Left static sumDecimal AST#parameter_list#Left ( AST#parameter#Left ... n : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Value [ ] 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 Decimal 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 Decimal AST#expression#Right . sum AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#spread_element#Left ... AST#expression#Left n AST#expression#Right AST#spread_element#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
|
export class NumberUtil {
static isNaN(value: Any): boolean {
return Number.isNaN(value);
}
static isFinite(value: Any): boolean {
return Number.isFinite(value);
}
static isInteger(value: Any): boolean {
return Number.isInteger(value);
}
static isSafeInteger(value: Any): boolean {
return Number.isSafeInteger(value);
}
static isNumber(value: Any): boolean {
return (typeof value === "number") && !NumberUtil.isNaN(value);
}
static isEven(num: number): boolean {
return num % 2 === 0;
}
static isOdd(num: number): boolean {
return num % 2 !== 0;
}
static toNumber(value: string, defaultValue: number = Number.NaN): number {
let num = Number(value).valueOf();
if (isNaN(num)) {
return defaultValue;
}
return num
}
static toInt(value: string, defaultValue: number = Number.NaN): number {
const parseValue = parseInt(value);
if (isNaN(parseValue)) {
return defaultValue;
}
return parseValue;
}
static toFloat(value: string, defaultValue: number = Number.NaN): number {
const parseValue = parseFloat(value);
if (isNaN(parseValue)) {
return defaultValue;
}
return parseValue;
}
static average(...numbers: number[]): number {
if (numbers.length > 0) {
const sum = numbers.reduce((acc, num) => acc + num, 0);
return sum / numbers.length;
}
return 0;
}
static keepDecimals(value: number, digit: number = 2): number {
if (digit > 0) {
digit = Math.trunc(digit);
const digits = Math.pow(10, digit);
return Math.round(value * digits) / digits;
} else if (digit === 0) {
return Math.round(value);
}
return value;
}
static add(x: number, y: number): number {
return NumberUtil.addDecimal(x, y).toNumber();
}
static sub(x: number, y: number): number {
return NumberUtil.subDecimal(x, y).toNumber();
}
static sum(...n: number[]): number {
return NumberUtil.sumDecimal(...n).toNumber();
}
static toDecimal(value: Value): Decimal {
return new Decimal(value);
}
static addDecimal(x: Value, y: Value): Decimal {
return Decimal.add(x, y);
}
static subDecimal(x: Value, y: Value): Decimal {
return Decimal.sub(x, y);
}
static sumDecimal(...n: Value[]): Decimal {
return Decimal.sum(...n);
}
}
|
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L27-L244
|
7908bb4ba3f3000bcdfb9815a44331ecbbb58ab5
|
gitee
|
|
bigbear20240612/birthday_reminder.git
|
647c411a6619affd42eb5d163ff18db4b34b27ff
|
harmonyos/src/main/ets/pages/CalendarPage.ets
|
arkts
|
loadCalendarData
|
加载日历数据
|
private async loadCalendarData(): Promise<void> {
try {
// 获取当前月份的所有联系人
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
// 生成日历天数
this.calendarDays = this.generateCalendarDays(this.currentDate, contacts);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load calendar data: ${error}`);
}
}
|
AST#method_declaration#Left private async loadCalendarData 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 const AST#variable_declarator#Left contacts = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression#Left this AST#expression#Right AST#await_expression#Right AST#expression#Right . contactService AST#member_expression#Right AST#expression#Right . searchContacts 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 pageSize AST#property_name#Right : AST#expression#Left 1000 AST#expression#Right AST#property_assignment#Right } AST#object_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // 生成日历天数 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . calendarDays 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 . generateCalendarDays 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 . currentDate AST#member_expression#Right AST#expression#Right , AST#expression#Left contacts AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Left catch ( error ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . DOMAIN_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#member_expression#Left AST#expression#Left LogConstants AST#expression#Right . TAG_APP AST#member_expression#Right AST#expression#Right , AST#expression#Left AST#template_literal#Left ` Failed to load calendar data: AST#template_substitution#Left $ { AST#expression#Left error AST#expression#Right } AST#template_substitution#Right ` AST#template_literal#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#catch_clause#Right AST#try_statement#Right AST#statement#Right } AST#block_statement#Right AST#method_declaration#Right
|
private async loadCalendarData(): Promise<void> {
try {
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
this.calendarDays = this.generateCalendarDays(this.currentDate, contacts);
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to load calendar data: ${error}`);
}
}
|
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/CalendarPage.ets#L68-L78
|
8dc8513690f4e20766b321280fb79c186e7b43c7
|
github
|
awa_Liny/LinysBrowser_NEXT
|
a5cd96a9aa8114cae4972937f94a8967e55d4a10
|
home/src/main/ets/utils/url_tools.ets
|
arkts
|
Analyze and divides the text data items and out put a unified list of texts and links
@param data_list strings
@returns [extracted_data: string[], extracted_type: string[]]
|
export function extract_links_from_text(data_list: string[]) {
let extracted_data: string[] = [];
let extracted_type: string[] = [];
for (let index = 0; index < data_list.length; index++) {
let text = data_list[index];
// let match = text.match(/(file|https?|meow):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g);
let match = text.match(/([a-zA-Z][a-zA-Z0-9+.-]*):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g);
console.log('[extract_links_from_text] [' + match?.join("\n") + "]");
if (match) {
for (let inner = 0; inner < match.length; inner++) {
let this_url = match[inner]
let position = text.indexOf(this_url);
if (text.substring(0, position).replace(/\s*/, "").length > 0) {
extracted_data.push(text.substring(0, position).replaceAll(/(^\s*)|(\s*$)/g, ""));
extracted_type.push("text");
}
extracted_data.push(this_url);
if (this_url.substring(0, 4) == 'file') {
// TODO: this is only valid when IMAGE is the only allowed file type.
extracted_type.push("image");
} else {
extracted_type.push("url");
}
text = text.substring(position + this_url.length);
}
}
if (text.replace(/\s*/, "").length > 0) {
extracted_data.push(text.replaceAll(/(^\s*)|(\s*$)/g, ""));
extracted_type.push("text");
}
}
return [extracted_data, extracted_type]
}
|
AST#export_declaration#Left export AST#function_declaration#Left function extract_links_from_text AST#parameter_list#Left ( AST#parameter#Left data_list : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extracted_data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left extracted_type : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ ] AST#array_literal#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left index = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left index AST#expression#Right < AST#expression#Left data_list AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left index AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left text = AST#expression#Left AST#subscript_expression#Left AST#expression#Left data_list AST#expression#Right [ AST#expression#Left index AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right // let match = text.match(/(file|https?|meow):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g); AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left match = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . match AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#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#subscript_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left a AST#expression#Right - AST#expression#Left zA AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left Z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#ERROR#Left . AST#ERROR#Right AST#expression#Left AST#unary_expression#Left - AST#expression#Left AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#ERROR#Left * ) : \ / \ AST#ERROR#Right / AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left A AST#expression#Right AST#unary_expression#Right AST#expression#Right - AST#expression#Left Za AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left + & @ # / % ? AST#ERROR#Left = AST#ERROR#Right AST#expression#Left AST#unary_expression#Left ~ AST#expression#Left _ AST#expression#Right AST#unary_expression#Right AST#expression#Right | ! : AST#ERROR#Right , AST#ERROR#Left . ; AST#ERROR#Right ] AST#array_literal#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#unary_expression#Left - AST#expression#Left A AST#expression#Right AST#unary_expression#Right AST#expression#Right - AST#expression#Left Za AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left z0 AST#expression#Right AST#binary_expression#Right AST#expression#Right - AST#expression#Left 9 AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left + & @ # AST#ERROR#Right / AST#ERROR#Left %= AST#ERROR#Right AST#expression#Left AST#unary_expression#Left ~ AST#expression#Left _ AST#expression#Right AST#unary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right | AST#expression#Left AST#expression#Right AST#binary_expression#Right AST#expression#Right ] AST#array_literal#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log 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 AST#binary_expression#Left AST#expression#Left '[extract_links_from_text] [' AST#expression#Right + AST#expression#Left match AST#expression#Right AST#binary_expression#Right AST#expression#Right ?. join AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "\n" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right + AST#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#if_statement#Left if ( AST#expression#Left match AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left inner = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left inner AST#expression#Right < AST#expression#Left match AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left inner AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left this_url = AST#expression#Left AST#subscript_expression#Left AST#expression#Left match AST#expression#Right [ AST#expression#Left inner AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#variable_declarator#Right AST#variable_declaration#Right AST#statement#Right AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left position = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . indexOf AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this_url 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#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text 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 position AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \s * / , AST#ERROR#Right AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extracted_data AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text 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 position AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s * AST#ERROR#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \s * AST#ERROR#Right AST#expression#Left AST#state_binding_expression#Left $ AST#state_binding_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left "" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 extracted_type AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "text" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extracted_data AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left this_url AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this_url 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 4 AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right == AST#expression#Left 'file' AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { // TODO: this is only valid when IMAGE is the only allowed file type. AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extracted_type AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "image" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#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 extracted_type AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "url" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } 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 text = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . substring AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left position AST#expression#Right + AST#expression#Left this_url AST#expression#Right AST#binary_expression#Right AST#expression#Right . length AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . replace AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#argument_list#Right AST#call_expression#Right AST#expression#Right / AST#ERROR#Left \s * / , AST#ERROR#Right AST#expression#Left "" AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#ERROR#Left ) AST#ERROR#Right . length AST#member_expression#Right AST#expression#Right > AST#expression#Left 0 AST#expression#Right AST#binary_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left extracted_data AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left text AST#expression#Right . replaceAll AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#ERROR#Left / AST#ERROR#Right AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AST#expression#Right AST#ERROR#Left ^ \s * AST#ERROR#Right ) AST#parenthesized_expression#Right AST#expression#Right | AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#ERROR#Left \s * AST#ERROR#Right AST#expression#Left AST#state_binding_expression#Left $ AST#state_binding_expression#Right AST#expression#Right ) AST#parenthesized_expression#Right AST#expression#Right / AST#expression#Left g AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#binary_expression#Right AST#expression#Right , AST#expression#Left "" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#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 extracted_type AST#expression#Right . push AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left "text" AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#for_statement#Right AST#statement#Right AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#array_literal#Left [ AST#expression#Left extracted_data AST#expression#Right , AST#expression#Left extracted_type AST#expression#Right ] AST#array_literal#Right AST#expression#Right AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
|
export function extract_links_from_text(data_list: string[]) {
let extracted_data: string[] = [];
let extracted_type: string[] = [];
for (let index = 0; index < data_list.length; index++) {
let text = data_list[index];
let match = text.match(/([a-zA-Z][a-zA-Z0-9+.-]*):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g);
console.log('[extract_links_from_text] [' + match?.join("\n") + "]");
if (match) {
for (let inner = 0; inner < match.length; inner++) {
let this_url = match[inner]
let position = text.indexOf(this_url);
if (text.substring(0, position).replace(/\s*/, "").length > 0) {
extracted_data.push(text.substring(0, position).replaceAll(/(^\s*)|(\s*$)/g, ""));
extracted_type.push("text");
}
extracted_data.push(this_url);
if (this_url.substring(0, 4) == 'file') {
extracted_type.push("image");
} else {
extracted_type.push("url");
}
text = text.substring(position + this_url.length);
}
}
if (text.replace(/\s*/, "").length > 0) {
extracted_data.push(text.replaceAll(/(^\s*)|(\s*$)/g, ""));
extracted_type.push("text");
}
}
return [extracted_data, extracted_type]
}
|
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L363-L396
|
b1d30b47c031876be0f6e58af74f37e0685a201e
|
gitee
|
|
Joker-x-dev/CoolMallArkTS.git
|
9f3fabf89fb277692cb82daf734c220c7282919c
|
feature/goods/src/main/ets/navigation/GoodsSearchNav.ets
|
arkts
|
GoodsSearchNav
|
@file 商品搜索页面导航入口
@returns {void} 无返回值
@author Joker.X
|
@Builder
export function GoodsSearchNav(): void {
GoodsSearchPage();
}
|
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function GoodsSearchNav 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_custom_component_statement#Left GoodsSearchPage ( ) ; AST#ui_custom_component_statement#Right } AST#builder_function_body#Right AST#decorated_export_declaration#Right
|
@Builder
export function GoodsSearchNav(): void {
GoodsSearchPage();
}
|
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsSearchNav.ets#L8-L11
|
5b72828b2c50e9186abc782451ca7845d6dbe902
|
github
|
openharmony/applications_app_samples
|
a826ab0e75fe51d028c1c5af58188e908736b53b
|
code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets
|
arkts
|
sharedArrayBufferUsage
|
根据传入的值isAtomics判断是否使用原子操作
|
sharedArrayBufferUsage(isAtomics: boolean) {
// 创建长度为4的SharedArrayBuffer对象
let sab: SharedArrayBuffer = new SharedArrayBuffer(4);
// 由于SharedArrayBuffer是原始二进制数据缓冲区,无法直接使用,所以这里转换为Int32Array类型进行后续操作
let int32Array: Int32Array = new Int32Array(sab);
int32Array[0] = 0;
// 创建Task对象,并放入TaskGroup中执行
let taskGroup: taskpool.TaskGroup = new taskpool.TaskGroup();
for (let i = 0; i < this.taskNum; i++) {
if (isAtomics) {
taskGroup.addTask(new taskpool.Task(atomicsProcess, int32Array));
} else {
taskGroup.addTask(new taskpool.Task(normalProcess, int32Array));
}
}
taskpool.execute(taskGroup).then(() => {
// 将结果打印在Text上
this.result = this.result + "\n" + int32Array;
// 如果Scroll不在底部,则滑到到底部
if (!this.scroller.isAtEnd()) {
this.scroller.scrollEdge(Edge.Bottom);
}
}).catch((e: BusinessError) => {
logger.error(e.message);
})
}
|
AST#method_declaration#Left sharedArrayBufferUsage AST#parameter_list#Left ( AST#parameter#Left isAtomics : 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 { // 创建长度为4的SharedArrayBuffer对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left sab : AST#type_annotation#Left AST#primary_type#Left SharedArrayBuffer 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 SharedArrayBuffer AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left 4 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 // 由于SharedArrayBuffer是原始二进制数据缓冲区,无法直接使用,所以这里转换为Int32Array类型进行后续操作 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left int32Array : AST#type_annotation#Left AST#primary_type#Left Int32Array 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 Int32Array AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left sab 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#subscript_expression#Left AST#expression#Left int32Array AST#expression#Right [ AST#expression#Left 0 AST#expression#Right ] AST#subscript_expression#Right AST#expression#Right AST#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 // 创建Task对象,并放入TaskGroup中执行 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left taskGroup : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left taskpool . TaskGroup 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#new_expression#Left new AST#expression#Left taskpool AST#expression#Right AST#new_expression#Right AST#expression#Right . TaskGroup 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#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left i AST#expression#Right < AST#expression#Left this AST#expression#Right AST#binary_expression#Right AST#expression#Right . taskNum AST#member_expression#Right AST#expression#Right ; AST#expression#Left AST#update_expression#Left AST#expression#Left i AST#expression#Right ++ AST#update_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left isAtomics 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 taskGroup AST#expression#Right . addTask 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#new_expression#Left new AST#expression#Left taskpool AST#expression#Right AST#new_expression#Right AST#expression#Right . Task AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left atomicsProcess AST#expression#Right , AST#expression#Left int32Array 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 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 taskGroup AST#expression#Right . addTask 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#new_expression#Left new AST#expression#Left taskpool AST#expression#Right AST#new_expression#Right AST#expression#Right . Task AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left normalProcess AST#expression#Right , AST#expression#Left int32Array AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#if_statement#Right AST#statement#Right } AST#block_statement#Right AST#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 AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left taskpool AST#expression#Right . execute AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left taskGroup AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right . then AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#block_statement#Left { // 将结果打印在Text上 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 . result AST#member_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 this AST#expression#Right . result AST#member_expression#Right AST#expression#Right + AST#expression#Left "\n" AST#expression#Right AST#binary_expression#Right AST#expression#Right + AST#expression#Left int32Array AST#expression#Right AST#binary_expression#Right AST#expression#Right AST#assignment_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right // 如果Scroll不在底部,则滑到到底部 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#unary_expression#Left ! AST#expression#Left this AST#expression#Right AST#unary_expression#Right AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . isAtEnd AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ) AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . scroller AST#member_expression#Right AST#expression#Right . scrollEdge AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left Edge AST#expression#Right . Bottom 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#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 e : AST#type_annotation#Left AST#primary_type#Left BusinessError AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right => AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . error AST#member_expression#Right AST#expression#Right AST#argument_list#Left ( AST#expression#Left AST#member_expression#Left AST#expression#Left e AST#expression#Right . message AST#member_expression#Right AST#expression#Right ) AST#argument_list#Right AST#call_expression#Right AST#expression#Right ; AST#expression_statement#Right AST#statement#Right } AST#block_statement#Right AST#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
|
sharedArrayBufferUsage(isAtomics: boolean) {
let sab: SharedArrayBuffer = new SharedArrayBuffer(4);
let int32Array: Int32Array = new Int32Array(sab);
int32Array[0] = 0;
let taskGroup: taskpool.TaskGroup = new taskpool.TaskGroup();
for (let i = 0; i < this.taskNum; i++) {
if (isAtomics) {
taskGroup.addTask(new taskpool.Task(atomicsProcess, int32Array));
} else {
taskGroup.addTask(new taskpool.Task(normalProcess, int32Array));
}
}
taskpool.execute(taskGroup).then(() => {
this.result = this.result + "\n" + int32Array;
if (!this.scroller.isAtEnd()) {
this.scroller.scrollEdge(Edge.Bottom);
}
}).catch((e: BusinessError) => {
logger.error(e.message);
})
}
|
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/memoryShared/src/main/ets/pages/AtomicsUsage.ets#L67-L94
|
23f41cd40f72c7c1982abc06ee3deadbbc2c2331
|
gitee
|
Joker-x-dev/HarmonyKit.git
|
f97197ce157df7f303244fba42e34918306dfb08
|
core/designsystem/src/main/ets/constants/LayoutPercent.ets
|
arkts
|
55% 百分比
|
export const P55: string = "55%";
|
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P55 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "55%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
|
export const P55: string = "55%";
|
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L64-L64
|
d31b742c7a56f772e2b707d034ffce5d23e534df
|
github
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.